From b46a739008a084daec8dea5ea94bd3e1b1cc8088 Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 27 Dec 2021 20:28:45 +0100 Subject: [PATCH] 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);