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

Working on 0.3.0

- add jastadd compiler location and configuration
parent 7508910e
Branches
No related tags found
No related merge requests found
Pipeline #13183 passed
......@@ -11,18 +11,32 @@ import org.gradle.api.provider.Property;
* @author rschoene - Initial contribution
*/
public class CompilerLocationExtension {
public Property<String> jastaddCompilerLocation;
public Property<FileCollection> jastaddCompilerConfiguration;
public Property<String> relastCompilerLocation;
public Property<FileCollection> relastCompilerConfiguration;
public Property<String> ragconnectCompilerLocation;
public Property<FileCollection> ragconnectCompilerConfiguration;
public CompilerLocationExtension(Project project) {
jastaddCompilerLocation = project.getObjects().property(String.class);
jastaddCompilerConfiguration = project.getObjects().property(FileCollection.class);
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("jastaddCompilerConfiguration")
public Property<String> getJastAddCompilerLocation() {
return jastaddCompilerLocation;
}
public Property<FileCollection> getJastAddCompilerConfiguration() {
return jastaddCompilerConfiguration;
}
@Deprecated
@ReplacedBy("relastCompilerConfiguration")
public Property<String> getRelastCompilerLocation() {
......
......@@ -29,6 +29,8 @@ public class PreprocessorPlugin implements Plugin<Project> {
// set compiler locations (if set)
project.afterEvaluate(p -> {
RelastTest.setJastAddCompilerLocation(extension.getJastAddCompilerLocation().getOrNull());
RelastTest.setJastAddCompilerConfiguration(extension.getJastAddCompilerConfiguration().getOrNull());
RelastTest.setRelastCompilerLocation(extension.getRelastCompilerLocation().getOrNull());
RelastTest.setRelastCompilerConfiguration(extension.getRelastCompilerConfiguration().getOrNull());
RagConnectTest.setRagconnectCompilerLocation(extension.getRagconnectCompilerLocation().getOrNull());
......
......@@ -94,11 +94,11 @@ public abstract class RagConnectTest extends RelastTest {
FileCollection runtimeClasspath = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
project.javaexec(javaExecSpec -> {
List<Object> args = new ArrayList<>();
javaExecSpec.setClasspath(runtimeClasspath);
if (ragconnectCompilerLocation != null) {
if (isVerbose()) {
System.err.println("ragconnectCompilerLocation is deprecated, use ragconnectCompilerConfiguration instead");
}
javaExecSpec.setClasspath(runtimeClasspath);
javaExecSpec.setMain("-jar");
args.add(ragconnectCompilerLocation);
} else {
......
......@@ -26,6 +26,8 @@ import static groovy.lang.Closure.DELEGATE_FIRST;
*/
public abstract class RelastTest extends DefaultTask {
// configuration from plugin
private static String jastaddCompilerLocation;
private static FileCollection jastaddCompilerConfiguration;
private static String relastCompilerLocation;
private static FileCollection relastCompilerConfiguration;
......@@ -35,6 +37,14 @@ public abstract class RelastTest extends DefaultTask {
@Nested
abstract JastAddConfiguration getJastadd();
public static void setJastAddCompilerLocation(String jastaddCompilerLocation) {
RelastTest.jastaddCompilerLocation = jastaddCompilerLocation;
}
public static void setJastAddCompilerConfiguration(FileCollection jastaddCompilerConfiguration) {
RelastTest.jastaddCompilerConfiguration = jastaddCompilerConfiguration;
}
public static void setRelastCompilerLocation(String relastCompilerLocation) {
RelastTest.relastCompilerLocation = relastCompilerLocation;
}
......@@ -119,11 +129,11 @@ public abstract class RelastTest extends DefaultTask {
FileCollection runtimeClasspath = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
project.javaexec(javaExecSpec -> {
List<String> args = new ArrayList<>();
javaExecSpec.setClasspath(runtimeClasspath);
if (RelastTest.relastCompilerLocation != null) {
if (isVerbose()) {
System.err.println("relastCompilerLocation is deprecated, use relastCompilerConfiguration instead");
}
javaExecSpec.setClasspath(runtimeClasspath);
javaExecSpec.setMain("-jar");
args.add(RelastTest.relastCompilerLocation);
} else {
......@@ -175,9 +185,18 @@ public abstract class RelastTest extends DefaultTask {
SourceSetContainer sourceSets = (SourceSetContainer) project.getProperties().get("sourceSets");
FileCollection runtimeClasspath = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
project.javaexec(javaExecSpec -> {
javaExecSpec.setClasspath(runtimeClasspath);
javaExecSpec.setMain("org.jastadd.JastAdd");
List<Object> args = new ArrayList<>();
if (RelastTest.jastaddCompilerLocation != null) {
if (isVerbose()) {
System.err.println("jastaddCompilerLocation is deprecated, use jastaddCompilerConfiguration instead");
}
javaExecSpec.setClasspath(runtimeClasspath);
javaExecSpec.setMain("-jar");
args.add(RelastTest.jastaddCompilerLocation);
} else {
javaExecSpec.setClasspath(RelastTest.jastaddCompilerConfiguration);
javaExecSpec.getMainClass().set("org.jastadd.JastAdd");
}
args.add("--o=" + pathToAbsoluteProject(getJastadd().getOutputDirOrDefault().getPath()));
args.add("--package=" + getJastadd().getPackageName());
if (getJastadd().getJastAddList() != null) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment