From 8a582f0b08c744d43c3a52789a825121de45de2d Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 27 Dec 2021 19:01:45 +0100 Subject: [PATCH 01/11] Create gradle.yml --- .github/workflows/gradle.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 00000000..75df7524 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,31 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Java CI with Gradle + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + - name: Build with Gradle + uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021 + with: + arguments: build From 32abd7e14e405c85af2af2bba219e67beb9fc881 Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 27 Dec 2021 19:04:33 +0100 Subject: [PATCH 02/11] Update gradle.yml --- .github/workflows/gradle.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 75df7524..db67e0d7 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -26,6 +26,4 @@ jobs: java-version: '11' distribution: 'adopt' - name: Build with Gradle - uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021 - with: - arguments: build + - run: gradle build From 77b8147f9b2f2410246a87a472173174f86cfce1 Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 27 Dec 2021 19:05:33 +0100 Subject: [PATCH 03/11] Update gradle.yml --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index db67e0d7..c40bf3c4 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -26,4 +26,4 @@ jobs: java-version: '11' distribution: 'adopt' - name: Build with Gradle - - run: gradle build + run: gradle build From 81209b0cf813769c8b03166b18e03e02f3400aea Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 27 Dec 2021 19:07:05 +0100 Subject: [PATCH 04/11] Update gradle.yml --- .github/workflows/gradle.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index c40bf3c4..d47a452c 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -20,10 +20,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v2 + - name: Set up JDK 8 + uses: actions/setup-java@v1 with: - java-version: '11' + java-version: '8' distribution: 'adopt' - name: Build with Gradle run: gradle build From e7a6292fe9eb4f40fff4bd324463013e864f03d6 Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 27 Dec 2021 19:10:09 +0100 Subject: [PATCH 05/11] Update gradle.yml --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index d47a452c..c16f020a 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -26,4 +26,4 @@ jobs: java-version: '8' distribution: 'adopt' - name: Build with Gradle - run: gradle build + run: ./gradlew build From 86a893916d8dd27fda2c2df40afd1150a0227a7d Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 27 Dec 2021 19:20:06 +0100 Subject: [PATCH 06/11] Update gradle.yml --- .github/workflows/gradle.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index c16f020a..35021f0b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -20,10 +20,12 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 8 + - name: Set up JDK 11 uses: actions/setup-java@v1 with: - java-version: '8' + java-version: '11' distribution: 'adopt' + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b - name: Build with Gradle run: ./gradlew build From 58d9ac7fdd80860dda3a6125a51e9fc5510f7084 Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 27 Dec 2021 19:21:59 +0100 Subject: [PATCH 07/11] Update gradle.yml --- .github/workflows/gradle.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 35021f0b..1b56d3c0 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -27,5 +27,7 @@ jobs: distribution: 'adopt' - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b + - name: Make gradlew executable + run: chmod +x ./gradlew - name: Build with Gradle run: ./gradlew build From ef8197b275d303b1e9b8b50eb53459e7c401be94 Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 27 Dec 2021 19:24:16 +0100 Subject: [PATCH 08/11] Update gradle.yml --- .github/workflows/gradle.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 1b56d3c0..20abaf30 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -25,9 +25,12 @@ jobs: with: java-version: '11' distribution: 'adopt' + cache: gradle - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b - name: Make gradlew executable run: chmod +x ./gradlew + - name: Build with Gradle + run: ./gradlew generateSource - name: Build with Gradle run: ./gradlew build From af623946512c0cc54f2bfcd4f39d0672371f91f9 Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 27 Dec 2021 20:04:50 +0100 Subject: [PATCH 09/11] Testing for secrets to be present --- build.gradle | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index a3136a29..fd016cca 100644 --- a/build.gradle +++ b/build.gradle @@ -87,8 +87,11 @@ test { } uploadArchives { - Properties props = new Properties() - props.load(new FileInputStream("$buildDir/credentials.properties")) + Properties props = new Properties() + if(file("$buildDir/credentials.properties").exists()) + { + props.load(new FileInputStream("$buildDir/credentials.properties")) + } repositories.mavenDeployer { repository(url: 'https://maven.speiger.com/repository/main') { authentication(userName: props.mavenUser, password: props.mavenPassword) From b46a739008a084daec8dea5ea94bd3e1b1cc8088 Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 27 Dec 2021 20:28:45 +0100 Subject: [PATCH 10/11] Finishing Build Action --- .github/workflows/gradle.yml | 4 ++-- build.gradle | 12 +++++++++-- .../builder/PrimitiveCollectionsBuilder.java | 20 ++++++++++++++++--- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 20abaf30..5b0607ab 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -30,7 +30,7 @@ jobs: uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b - name: Make gradlew executable run: chmod +x ./gradlew - - name: Build with Gradle - run: ./gradlew generateSource + - name: Generate SourceCode with Gradle + run: ./gradlew generateGithubSource - name: Build with Gradle run: ./gradlew build diff --git a/build.gradle b/build.gradle index fd016cca..3a7923b0 100644 --- a/build.gradle +++ b/build.gradle @@ -42,8 +42,8 @@ configurations { } dependencies { - builderCompile 'de.speiger:Simple-Code-Generator:1.0.5' - runtimeOnly 'de.speiger:Simple-Code-Generator:1.0.5' + builderCompile 'de.speiger:Simple-Code-Generator:1.0.6' + runtimeOnly 'de.speiger:Simple-Code-Generator:1.0.6' testImplementation 'junit:junit:4.12' testImplementation 'com.google.guava:guava-testlib:31.0.1-jre' } @@ -55,6 +55,14 @@ task generateSource(type: JavaExec) { main = 'speiger.src.builder.PrimitiveCollectionsBuilder' } +task generateGithubSource(type: JavaExec) { + group = 'internal' + description = 'Builds the sourcecode for Github Actions' + classpath = sourceSets.builder.runtimeClasspath + main = 'speiger.src.builder.PrimitiveCollectionsBuilder' + args = ['false', 'true'] +} + task forceGenerateSource(type: JavaExec) { group = 'internal' description = 'Builds the sourcecode forceful' diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index 212d336e..efebcf58 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -29,12 +29,22 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor public PrimitiveCollectionsBuilder() { - super(Paths.get("src/builder/resources/speiger/assets/collections/templates/"), Paths.get("src/main/java/speiger/src/collections/"), Paths.get("src/builder/resources/speiger/assets/collections/")); + this(false); + } + + public PrimitiveCollectionsBuilder(boolean silencedSuccess) + { + super(silencedSuccess, Paths.get("src/builder/resources/speiger/assets/collections/templates/"), Paths.get("src/main/java/speiger/src/collections/"), Paths.get("src/builder/resources/speiger/assets/collections/")); } public PrimitiveCollectionsBuilder(Path sourceFolder, Path outputFolder, Path dataFolder) { - super(sourceFolder, outputFolder, dataFolder); + this(false, sourceFolder, outputFolder, dataFolder); + } + + public PrimitiveCollectionsBuilder(boolean silencedSuccess, Path sourceFolder, Path outputFolder, Path dataFolder) + { + super(silencedSuccess, sourceFolder, outputFolder, dataFolder); } @Override @@ -159,10 +169,14 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor new PrimitiveCollectionsBuilder().process(false); } else if(args.length == 1) { new PrimitiveCollectionsBuilder().process(Boolean.parseBoolean(args[0])); + } else if(args.length == 2) { + new PrimitiveCollectionsBuilder(Boolean.parseBoolean(args[1])).process(Boolean.parseBoolean(args[0])); } else if(args.length == 3) { new PrimitiveCollectionsBuilder(Paths.get(args[0]), Paths.get(args[1]), Paths.get(args[2])).process(false); } else if(args.length == 4) { - new PrimitiveCollectionsBuilder(Paths.get(args[0]), Paths.get(args[1]), Paths.get(args[2])).process(Boolean.parseBoolean(args[3])); + new PrimitiveCollectionsBuilder(false, Paths.get(args[0]), Paths.get(args[1]), Paths.get(args[2])).process(Boolean.parseBoolean(args[3])); + } else if(args.length == 4) { + new PrimitiveCollectionsBuilder(Boolean.parseBoolean(args[4]), Paths.get(args[0]), Paths.get(args[1]), Paths.get(args[2])).process(Boolean.parseBoolean(args[3])); } else { System.out.println("Invalid argument count passed in"); System.exit(1); From c8b89e6847be0f8e2d9d0e8f656c97e9314e4609 Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 27 Dec 2021 20:34:15 +0100 Subject: [PATCH 11/11] Renaming file for what the action did. --- .github/workflows/{gradle.yml => build_validator.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{gradle.yml => build_validator.yml} (100%) diff --git a/.github/workflows/gradle.yml b/.github/workflows/build_validator.yml similarity index 100% rename from .github/workflows/gradle.yml rename to .github/workflows/build_validator.yml