diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d701926623daa2b1b7e6d6828c74c3f56b2c0e6c..78a6a932e6140ff617237101e8a693505195e7e0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,7 +33,7 @@ publish: stage: publish script: - "./gradlew setDevVersionForCI" - - "./gradlew publishPluginMavenPublicationToMavenRepository" + - "./gradlew publishPlugins" only: - dev - master @@ -48,7 +48,6 @@ pages: script: - cd pages && mkdocs build only: - - dev - master artifacts: paths: diff --git a/build.gradle b/build.gradle index ac8b64524fa6219e8a76c76c7338ce1a7b364c0a..b5f245e804fb79146d00fba8519a6dfeff0c23bf 100644 --- a/build.gradle +++ b/build.gradle @@ -5,12 +5,14 @@ plugins { } group 'org.jastadd.preprocessor' -mainClassName = 'org.jastadd.preprocessor.testing.doc.DocumentationCreator' +application.mainClassName = 'org.jastadd.preprocessor.testing.doc.DocumentationCreator' gradlePlugin { plugins { RelastPlugin { - id = 'testing' + id = 'org.jastadd.preprocessor.testing' + displayName = 'JastAdd Preprocessor Testing' + description = 'A plugin to specify compile tasks for test cases of a JastAdd preprocessor' implementationClass = 'org.jastadd.preprocessor.testing.plugin.PreprocessorPlugin' } } @@ -19,9 +21,9 @@ gradlePlugin { java.toolchain.languageVersion = JavaLanguageVersion.of(8) def versionFile = 'src/main/resources/PreprocessorTesting.properties' -def oldProps = new Properties() try { + def oldProps = new Properties() file(versionFile).withInputStream { stream -> oldProps.load(stream) } version = oldProps['version'] } catch (ignored) { @@ -51,23 +53,17 @@ task setDevVersionForCI() { } } -//830 publishing { publications { maven(MavenPublication) { - groupId = "org.jastadd.preprocessor" - artifactId = "testing" - from components.java // jar +// groupId = "org.jastadd.preprocessor" +// artifactId = "testing" + from components.java } } repositories { maven { url "https://git-st.inf.tu-dresden.de/api/v4/projects/$System.env.CI_PROJECT_ID/packages/maven" - // Uncomment the following lines to publish manually (and comment out the other credentials section) -// credentials(HttpHeaderCredentials) { -// name = "Private-Token" -// value = gitLabPrivateToken // the variable resides in ~/.gradle/gradle.properties -// } credentials(HttpHeaderCredentials) { name = 'Job-Token' value = System.getenv("CI_JOB_TOKEN") diff --git a/src/main/java/org/jastadd/preprocessor/testing/plugin/CompilerLocationExtension.java b/src/main/java/org/jastadd/preprocessor/testing/plugin/CompilerLocationExtension.java index 1cb967b0db8e6906bfaa5eb3991475ef9152fc7c..362d47e930b173ce4e2173a7a4ca8897110740ad 100644 --- a/src/main/java/org/jastadd/preprocessor/testing/plugin/CompilerLocationExtension.java +++ b/src/main/java/org/jastadd/preprocessor/testing/plugin/CompilerLocationExtension.java @@ -1,6 +1,8 @@ package org.jastadd.preprocessor.testing.plugin; import org.gradle.api.Project; +import org.gradle.api.file.FileCollection; +import org.gradle.api.model.ReplacedBy; import org.gradle.api.provider.Property; /** @@ -10,18 +12,34 @@ import org.gradle.api.provider.Property; */ public class CompilerLocationExtension { public Property<String> relastCompilerLocation; + public Property<FileCollection> relastCompilerConfiguration; public Property<String> ragconnectCompilerLocation; + public Property<FileCollection> ragconnectCompilerConfiguration; public CompilerLocationExtension(Project project) { relastCompilerLocation = project.getObjects().property(String.class); + relastCompilerConfiguration = project.getObjects().property(FileCollection.class); ragconnectCompilerLocation = project.getObjects().property(String.class); + ragconnectCompilerConfiguration = project.getObjects().property(FileCollection.class); } + @Deprecated + @ReplacedBy("relastCompilerConfiguration") public Property<String> getRelastCompilerLocation() { return relastCompilerLocation; } + public Property<FileCollection> getRelastCompilerConfiguration() { + return relastCompilerConfiguration; + } + + @Deprecated + @ReplacedBy("ragconnectCompilerConfiguration") public Property<String> getRagconnectCompilerLocation() { return ragconnectCompilerLocation; } + + public Property<FileCollection> getRagconnectCompilerConfiguration() { + return ragconnectCompilerConfiguration; + } } diff --git a/src/main/java/org/jastadd/preprocessor/testing/plugin/PreprocessorPlugin.java b/src/main/java/org/jastadd/preprocessor/testing/plugin/PreprocessorPlugin.java index 718f01d0f52db9ed5b099186400cb09bb03d2553..fa5289fd6f05c8c3ed3f40721c5f81a7907e0abe 100644 --- a/src/main/java/org/jastadd/preprocessor/testing/plugin/PreprocessorPlugin.java +++ b/src/main/java/org/jastadd/preprocessor/testing/plugin/PreprocessorPlugin.java @@ -29,8 +29,10 @@ public class PreprocessorPlugin implements Plugin<Project> { // set compiler locations (if set) project.afterEvaluate(p -> { - RelastTest.setCompilerLocation(extension.getRelastCompilerLocation().getOrNull()); + RelastTest.setRelastCompilerLocation(extension.getRelastCompilerLocation().getOrNull()); + RelastTest.setRelastCompilerConfiguration(extension.getRelastCompilerConfiguration().getOrNull()); RagConnectTest.setRagconnectCompilerLocation(extension.getRagconnectCompilerLocation().getOrNull()); + RagConnectTest.setRagconnectCompilerConfiguration(extension.getRagconnectCompilerConfiguration().getOrNull()); }); // setup tasks diff --git a/src/main/java/org/jastadd/preprocessor/testing/plugin/RagConnectTest.java b/src/main/java/org/jastadd/preprocessor/testing/plugin/RagConnectTest.java index 5969de4ec638a717f099525731dd98ad9304163c..0bdfc734b56a689781e2752c2492a4e65756cbba 100644 --- a/src/main/java/org/jastadd/preprocessor/testing/plugin/RagConnectTest.java +++ b/src/main/java/org/jastadd/preprocessor/testing/plugin/RagConnectTest.java @@ -21,16 +21,21 @@ import static groovy.lang.Closure.DELEGATE_FIRST; * @author rschoene - Initial contribution */ public abstract class RagConnectTest extends RelastTest { + // configuration from plugin + private static String ragconnectCompilerLocation; + private static FileCollection ragconnectCompilerConfiguration; @Nested abstract RagConnectConfiguration getRagconnect(); - private static String ragconnectCompilerLocation; - public static void setRagconnectCompilerLocation(String ragconnectCompilerLocation) { RagConnectTest.ragconnectCompilerLocation = ragconnectCompilerLocation; } + public static void setRagconnectCompilerConfiguration(FileCollection ragconnectCompilerConfiguration) { + RagConnectTest.ragconnectCompilerConfiguration = ragconnectCompilerConfiguration; + } + @SuppressWarnings("unused") public void ragconnect(Closure<?> c) { c.setResolveStrategy(DELEGATE_FIRST); @@ -91,10 +96,14 @@ public abstract class RagConnectTest extends RelastTest { List<Object> args = new ArrayList<>(); javaExecSpec.setClasspath(runtimeClasspath); if (ragconnectCompilerLocation != null) { + if (isVerbose()) { + System.err.println("ragconnectCompilerLocation is deprecated, use ragconnectCompilerConfiguration instead"); + } javaExecSpec.setMain("-jar"); args.add(ragconnectCompilerLocation); } else { - javaExecSpec.setMain("org.jastadd.ragconnect.compiler.Compiler"); + javaExecSpec.setClasspath(RagConnectTest.ragconnectCompilerConfiguration); + javaExecSpec.getMainClass().set("org.jastadd.ragconnect.compiler.Compiler"); } args.add("--o=" + getRagconnect().getOutputDir()); args.add("--rootNode=" + getRagconnect().getRootNode()); diff --git a/src/main/java/org/jastadd/preprocessor/testing/plugin/RelastTest.java b/src/main/java/org/jastadd/preprocessor/testing/plugin/RelastTest.java index 102c05da2064be1fb660cd3ebaa5113271b28e00..03491c5639db650d0da8315548d8e500b23f281e 100644 --- a/src/main/java/org/jastadd/preprocessor/testing/plugin/RelastTest.java +++ b/src/main/java/org/jastadd/preprocessor/testing/plugin/RelastTest.java @@ -26,7 +26,8 @@ import static groovy.lang.Closure.DELEGATE_FIRST; */ public abstract class RelastTest extends DefaultTask { // configuration from plugin - private static String compilerLocation; + private static String relastCompilerLocation; + private static FileCollection relastCompilerConfiguration; @Nested abstract RelastConfiguration getRelast(); @@ -34,8 +35,12 @@ public abstract class RelastTest extends DefaultTask { @Nested abstract JastAddConfiguration getJastadd(); - public static void setCompilerLocation(String compilerLocation) { - RelastTest.compilerLocation = compilerLocation; + public static void setRelastCompilerLocation(String relastCompilerLocation) { + RelastTest.relastCompilerLocation = relastCompilerLocation; + } + + public static void setRelastCompilerConfiguration(FileCollection relastCompilerConfiguration) { + RelastTest.relastCompilerConfiguration = relastCompilerConfiguration; } private static final String[] genSuffixes = {".ast", ".jadd", "RefResolver.jadd", "ResolverStubs.jrag", "Serializer.jadd"}; @@ -115,11 +120,15 @@ public abstract class RelastTest extends DefaultTask { project.javaexec(javaExecSpec -> { List<String> args = new ArrayList<>(); javaExecSpec.setClasspath(runtimeClasspath); - if (RelastTest.compilerLocation != null) { + if (RelastTest.relastCompilerLocation != null) { + if (isVerbose()) { + System.err.println("relastCompilerLocation is deprecated, use relastCompilerConfiguration instead"); + } javaExecSpec.setMain("-jar"); - args.add(RelastTest.compilerLocation); + args.add(RelastTest.relastCompilerLocation); } else { - javaExecSpec.setMain("org.jastadd.relast.compiler.Compiler"); + javaExecSpec.setClasspath(RelastTest.relastCompilerConfiguration); + javaExecSpec.getMainClass().set("org.jastadd.relast.compiler.Compiler"); } for (File file : getRelast().getInputFiles()) { args.add(file.getAbsolutePath()); diff --git a/src/main/resources/PreprocessorTesting.properties b/src/main/resources/PreprocessorTesting.properties index 82284e0a60a8e61ec8b4563dadac383ce8c9118e..b26c950f5705189611dc53462e83ad8611a9a50d 100644 --- a/src/main/resources/PreprocessorTesting.properties +++ b/src/main/resources/PreprocessorTesting.properties @@ -1,2 +1,2 @@ -#Thu Mar 10 17:44:30 CET 2022 -version=0.2.14 +#Thu Mar 24 10:14:25 CET 2022 +version=0.3.0