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
Branches
Tags
No related merge requests found
Pipeline #13180 failed
......@@ -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:
......
......@@ -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")
......
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;
}
}
......@@ -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
......
......@@ -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());
......
......@@ -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());
......
#Thu Mar 10 17:44:30 CET 2022
version=0.2.14
#Thu Mar 24 10:14:25 CET 2022
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