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