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

0.2.13

- try to get configurations to work
parent aa50c7a8
No related branches found
No related tags found
No related merge requests found
Pipeline #12912 passed
......@@ -31,13 +31,6 @@ public abstract class RagConnectTest extends RelastTest {
RagConnectTest.ragconnectCompilerLocation = ragconnectCompilerLocation;
}
// @SuppressWarnings("unused")
// public void ragconnect(Closure<?> c) {
// c.setResolveStrategy(DELEGATE_FIRST);
// c.setDelegate(getRagconnect());
// c.call();
// }
@SuppressWarnings("unused")
public void ragconnect(Action<? super RagConnectConfiguration> action) {
action.execute(getRagconnect());
......@@ -98,16 +91,16 @@ public abstract class RagConnectTest extends RelastTest {
}
args.add("--o=" + getRagconnect().getOutputDir());
args.add("--rootNode=" + getRagconnect().getRootNode());
if (getRagconnect().isLogReads()) {
if (isTrue(getRagconnect().isLogReads())) {
args.add("--logReads");
}
if (getRagconnect().isLogWrites()) {
if (isTrue(getRagconnect().isLogWrites())) {
args.add("--logWrites");
}
if (getRagconnect().isLogIncremental()) {
if (isTrue(getRagconnect().isLogIncremental())) {
args.add("--logIncremental");
}
if (getRagconnect().isVerbose()) {
if (isTrue(getRagconnect().isVerbose())) {
args.add("--verbose");
}
if (getRagconnect().getProtocols() != null && !getRagconnect().getProtocols().isEmpty()) {
......
......@@ -47,25 +47,11 @@ public abstract class RelastTest extends DefaultTask {
return Paths.get(getProject().getProjectDir().getAbsolutePath(), filename);
}
// @SuppressWarnings("unused")
// public void relast(Closure<?> c) {
// c.setResolveStrategy(DELEGATE_FIRST);
// c.setDelegate(getRelast());
// c.call();
// }
@SuppressWarnings("unused")
public void relast(Action<? super RelastConfiguration> action) {
action.execute(getRelast());
}
// @SuppressWarnings("unused")
// public void jastadd(Closure<?> c) {
// c.setResolveStrategy(DELEGATE_FIRST);
// c.setDelegate(getJastadd());
// c.call();
// }
@SuppressWarnings("unused")
public void jastadd(Action<? super JastAddConfiguration> action) {
action.execute(getJastadd());
......@@ -76,9 +62,21 @@ public abstract class RelastTest extends DefaultTask {
runTest();
}
protected boolean isTrue(Boolean b) {
return b != null && b;
}
protected boolean isFalse(Boolean b) {
return b != null && !b;
}
boolean isVerbose() {
return getRelast().isVerbose() != null && getRelast().isVerbose();
}
protected void runTest() throws IOException {
Project project = getProject();
if (getRelast().isVerbose()) {
if (isVerbose()) {
System.out.println("Running relast test in " + project.getDisplayName());
System.out.println("relast files: " + getRelast().getInputFiles());
System.out.println("Deleting files");
......@@ -88,7 +86,7 @@ public abstract class RelastTest extends DefaultTask {
for (String suffix : genSuffixes) {
genFiles.add(pathToAbsoluteProject(getRelast().getGrammarName() + suffix));
}
if (getRelast().isVerbose()) {
if (isVerbose()) {
System.out.println("gen files: " + genFiles);
}
project.delete(deleteSpec -> {
......@@ -99,7 +97,7 @@ public abstract class RelastTest extends DefaultTask {
// create output directories, if not existing
createDirectory(pathToAbsoluteProject(getJastadd().getOutputDirOrDefault().getPath()));
createDirectory(pathToAbsoluteProject(getRelast().getGrammarName()).getParent());
if (getRelast().isVerbose()) {
if (isVerbose()) {
System.out.println("Pre processing, running relast");
}
// then, run relast pre-processing
......@@ -119,13 +117,13 @@ public abstract class RelastTest extends DefaultTask {
args.add(file.getAbsolutePath());
}
args.add("--quiet");
if (!getRelast().isNoWriteToFile()) {
if (isFalse(getRelast().isNoWriteToFile())) {
args.add("--file");
}
if (getRelast().isUseJastAddNames()) {
if (isTrue(getRelast().isUseJastAddNames())) {
args.add("--useJastAddNames");
}
if (!getRelast().isNoResolverHelper()) {
if (isFalse(getRelast().isNoResolverHelper())) {
args.add("--resolverHelper");
}
if (getJastadd().getJastAddList() != null) {
......@@ -139,18 +137,18 @@ public abstract class RelastTest extends DefaultTask {
}
args.add("--grammarName=" + pathToAbsoluteProject(getRelast().getGrammarName()));
args.addAll(getRelast().getExtraOptionsOrDefault());
if (getRelast().isVerbose()) {
if (isVerbose()) {
System.out.println("Start relast with args: " + args + " and main: " + javaExecSpec.getMainClass());
}
javaExecSpec.args(args);
}).assertNormalExitValue();
});
if (getJastadd().isSkipRun()) {
if (getRelast().isVerbose()) {
if (isTrue(getJastadd().isSkipRun())) {
if (isVerbose()) {
System.out.println("Skipping run of JastAdd");
}
} else {
if (getRelast().isVerbose()) {
if (isVerbose()) {
System.out.println("Compile with JastAdd");
}
// check which files were actually generated
......@@ -171,7 +169,7 @@ public abstract class RelastTest extends DefaultTask {
args.addAll(getJastadd().getExtraOptionsOrDefault());
args.addAll(genFiles);
args.addAll(getJastadd().getInputFiles());
if (getRelast().isVerbose()) {
if (isVerbose()) {
System.out.println("Start JastAdd with args: " + args);
}
javaExecSpec.args(args);
......@@ -182,7 +180,7 @@ public abstract class RelastTest extends DefaultTask {
private boolean verboseFileNotExists(Path path) {
boolean fileDoesNotExist = !Files.exists(path);
if (fileDoesNotExist && getRelast().isVerbose()) {
if (fileDoesNotExist && isVerbose()) {
System.out.println("Do not include " + path);
}
return fileDoesNotExist;
......@@ -192,7 +190,7 @@ public abstract class RelastTest extends DefaultTask {
if (Files.exists(path) && Files.isDirectory(path)) {
return;
}
if (getRelast().isVerbose()) {
if (isVerbose()) {
System.out.println("Creating " + path.toAbsolutePath());
}
try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment