Skip to content
Snippets Groups Projects
Commit 5c51354e authored by René Schöne's avatar René Schöne
Browse files

Working on 0.3.0

- use plugin with id and not with apply
- use relast and ragconnect via configurations and not with jars
parent 7db0b8e3
No related branches found
No related tags found
No related merge requests found
Pipeline #13180 failed
...@@ -33,7 +33,7 @@ publish: ...@@ -33,7 +33,7 @@ publish:
stage: publish stage: publish
script: script:
- "./gradlew setDevVersionForCI" - "./gradlew setDevVersionForCI"
- "./gradlew publishPluginMavenPublicationToMavenRepository" - "./gradlew publishPlugins"
only: only:
- dev - dev
- master - master
...@@ -48,7 +48,6 @@ pages: ...@@ -48,7 +48,6 @@ pages:
script: script:
- cd pages && mkdocs build - cd pages && mkdocs build
only: only:
- dev
- master - master
artifacts: artifacts:
paths: paths:
......
...@@ -5,12 +5,14 @@ plugins { ...@@ -5,12 +5,14 @@ plugins {
} }
group 'org.jastadd.preprocessor' group 'org.jastadd.preprocessor'
mainClassName = 'org.jastadd.preprocessor.testing.doc.DocumentationCreator' application.mainClassName = 'org.jastadd.preprocessor.testing.doc.DocumentationCreator'
gradlePlugin { gradlePlugin {
plugins { plugins {
RelastPlugin { 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' implementationClass = 'org.jastadd.preprocessor.testing.plugin.PreprocessorPlugin'
} }
} }
...@@ -19,9 +21,9 @@ gradlePlugin { ...@@ -19,9 +21,9 @@ gradlePlugin {
java.toolchain.languageVersion = JavaLanguageVersion.of(8) java.toolchain.languageVersion = JavaLanguageVersion.of(8)
def versionFile = 'src/main/resources/PreprocessorTesting.properties' def versionFile = 'src/main/resources/PreprocessorTesting.properties'
def oldProps = new Properties()
try { try {
def oldProps = new Properties()
file(versionFile).withInputStream { stream -> oldProps.load(stream) } file(versionFile).withInputStream { stream -> oldProps.load(stream) }
version = oldProps['version'] version = oldProps['version']
} catch (ignored) { } catch (ignored) {
...@@ -51,23 +53,17 @@ task setDevVersionForCI() { ...@@ -51,23 +53,17 @@ task setDevVersionForCI() {
} }
} }
//830
publishing { publishing {
publications { publications {
maven(MavenPublication) { maven(MavenPublication) {
groupId = "org.jastadd.preprocessor" // groupId = "org.jastadd.preprocessor"
artifactId = "testing" // artifactId = "testing"
from components.java // jar from components.java
} }
} }
repositories { repositories {
maven { maven {
url "https://git-st.inf.tu-dresden.de/api/v4/projects/$System.env.CI_PROJECT_ID/packages/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) { credentials(HttpHeaderCredentials) {
name = 'Job-Token' name = 'Job-Token'
value = System.getenv("CI_JOB_TOKEN") value = System.getenv("CI_JOB_TOKEN")
......
package org.jastadd.preprocessor.testing.plugin; package org.jastadd.preprocessor.testing.plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.file.FileCollection;
import org.gradle.api.model.ReplacedBy;
import org.gradle.api.provider.Property; import org.gradle.api.provider.Property;
/** /**
...@@ -10,18 +12,34 @@ import org.gradle.api.provider.Property; ...@@ -10,18 +12,34 @@ import org.gradle.api.provider.Property;
*/ */
public class CompilerLocationExtension { public class CompilerLocationExtension {
public Property<String> relastCompilerLocation; public Property<String> relastCompilerLocation;
public Property<FileCollection> relastCompilerConfiguration;
public Property<String> ragconnectCompilerLocation; public Property<String> ragconnectCompilerLocation;
public Property<FileCollection> ragconnectCompilerConfiguration;
public CompilerLocationExtension(Project project) { public CompilerLocationExtension(Project project) {
relastCompilerLocation = project.getObjects().property(String.class); relastCompilerLocation = project.getObjects().property(String.class);
relastCompilerConfiguration = project.getObjects().property(FileCollection.class);
ragconnectCompilerLocation = project.getObjects().property(String.class); ragconnectCompilerLocation = project.getObjects().property(String.class);
ragconnectCompilerConfiguration = project.getObjects().property(FileCollection.class);
} }
@Deprecated
@ReplacedBy("relastCompilerConfiguration")
public Property<String> getRelastCompilerLocation() { public Property<String> getRelastCompilerLocation() {
return relastCompilerLocation; return relastCompilerLocation;
} }
public Property<FileCollection> getRelastCompilerConfiguration() {
return relastCompilerConfiguration;
}
@Deprecated
@ReplacedBy("ragconnectCompilerConfiguration")
public Property<String> getRagconnectCompilerLocation() { public Property<String> getRagconnectCompilerLocation() {
return ragconnectCompilerLocation; return ragconnectCompilerLocation;
} }
public Property<FileCollection> getRagconnectCompilerConfiguration() {
return ragconnectCompilerConfiguration;
}
} }
...@@ -29,8 +29,10 @@ public class PreprocessorPlugin implements Plugin<Project> { ...@@ -29,8 +29,10 @@ public class PreprocessorPlugin implements Plugin<Project> {
// set compiler locations (if set) // set compiler locations (if set)
project.afterEvaluate(p -> { project.afterEvaluate(p -> {
RelastTest.setCompilerLocation(extension.getRelastCompilerLocation().getOrNull()); RelastTest.setRelastCompilerLocation(extension.getRelastCompilerLocation().getOrNull());
RelastTest.setRelastCompilerConfiguration(extension.getRelastCompilerConfiguration().getOrNull());
RagConnectTest.setRagconnectCompilerLocation(extension.getRagconnectCompilerLocation().getOrNull()); RagConnectTest.setRagconnectCompilerLocation(extension.getRagconnectCompilerLocation().getOrNull());
RagConnectTest.setRagconnectCompilerConfiguration(extension.getRagconnectCompilerConfiguration().getOrNull());
}); });
// setup tasks // setup tasks
......
...@@ -21,16 +21,21 @@ import static groovy.lang.Closure.DELEGATE_FIRST; ...@@ -21,16 +21,21 @@ import static groovy.lang.Closure.DELEGATE_FIRST;
* @author rschoene - Initial contribution * @author rschoene - Initial contribution
*/ */
public abstract class RagConnectTest extends RelastTest { public abstract class RagConnectTest extends RelastTest {
// configuration from plugin
private static String ragconnectCompilerLocation;
private static FileCollection ragconnectCompilerConfiguration;
@Nested @Nested
abstract RagConnectConfiguration getRagconnect(); abstract RagConnectConfiguration getRagconnect();
private static String ragconnectCompilerLocation;
public static void setRagconnectCompilerLocation(String ragconnectCompilerLocation) { public static void setRagconnectCompilerLocation(String ragconnectCompilerLocation) {
RagConnectTest.ragconnectCompilerLocation = ragconnectCompilerLocation; RagConnectTest.ragconnectCompilerLocation = ragconnectCompilerLocation;
} }
public static void setRagconnectCompilerConfiguration(FileCollection ragconnectCompilerConfiguration) {
RagConnectTest.ragconnectCompilerConfiguration = ragconnectCompilerConfiguration;
}
@SuppressWarnings("unused") @SuppressWarnings("unused")
public void ragconnect(Closure<?> c) { public void ragconnect(Closure<?> c) {
c.setResolveStrategy(DELEGATE_FIRST); c.setResolveStrategy(DELEGATE_FIRST);
...@@ -91,10 +96,14 @@ public abstract class RagConnectTest extends RelastTest { ...@@ -91,10 +96,14 @@ public abstract class RagConnectTest extends RelastTest {
List<Object> args = new ArrayList<>(); List<Object> args = new ArrayList<>();
javaExecSpec.setClasspath(runtimeClasspath); javaExecSpec.setClasspath(runtimeClasspath);
if (ragconnectCompilerLocation != null) { if (ragconnectCompilerLocation != null) {
if (isVerbose()) {
System.err.println("ragconnectCompilerLocation is deprecated, use ragconnectCompilerConfiguration instead");
}
javaExecSpec.setMain("-jar"); javaExecSpec.setMain("-jar");
args.add(ragconnectCompilerLocation); args.add(ragconnectCompilerLocation);
} else { } 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("--o=" + getRagconnect().getOutputDir());
args.add("--rootNode=" + getRagconnect().getRootNode()); args.add("--rootNode=" + getRagconnect().getRootNode());
......
...@@ -26,7 +26,8 @@ import static groovy.lang.Closure.DELEGATE_FIRST; ...@@ -26,7 +26,8 @@ import static groovy.lang.Closure.DELEGATE_FIRST;
*/ */
public abstract class RelastTest extends DefaultTask { public abstract class RelastTest extends DefaultTask {
// configuration from plugin // configuration from plugin
private static String compilerLocation; private static String relastCompilerLocation;
private static FileCollection relastCompilerConfiguration;
@Nested @Nested
abstract RelastConfiguration getRelast(); abstract RelastConfiguration getRelast();
...@@ -34,8 +35,12 @@ public abstract class RelastTest extends DefaultTask { ...@@ -34,8 +35,12 @@ public abstract class RelastTest extends DefaultTask {
@Nested @Nested
abstract JastAddConfiguration getJastadd(); abstract JastAddConfiguration getJastadd();
public static void setCompilerLocation(String compilerLocation) { public static void setRelastCompilerLocation(String relastCompilerLocation) {
RelastTest.compilerLocation = compilerLocation; 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"}; private static final String[] genSuffixes = {".ast", ".jadd", "RefResolver.jadd", "ResolverStubs.jrag", "Serializer.jadd"};
...@@ -115,11 +120,15 @@ public abstract class RelastTest extends DefaultTask { ...@@ -115,11 +120,15 @@ public abstract class RelastTest extends DefaultTask {
project.javaexec(javaExecSpec -> { project.javaexec(javaExecSpec -> {
List<String> args = new ArrayList<>(); List<String> args = new ArrayList<>();
javaExecSpec.setClasspath(runtimeClasspath); 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"); javaExecSpec.setMain("-jar");
args.add(RelastTest.compilerLocation); args.add(RelastTest.relastCompilerLocation);
} else { } 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()) { for (File file : getRelast().getInputFiles()) {
args.add(file.getAbsolutePath()); args.add(file.getAbsolutePath());
......
#Thu Mar 10 17:44:30 CET 2022 #Thu Mar 24 10:14:25 CET 2022
version=0.2.14 version=0.3.0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment