Commit 4201f067 authored by René Schöne's avatar René Schöne
Browse files

Resolve problem with relative paths, second try.

- use absolute paths
parent ed680b38
Pipeline #6611 passed with stage
in 1 minute and 53 seconds
......@@ -13,6 +13,7 @@ import java.nio.file.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* RelAst Test Task
......@@ -165,6 +166,10 @@ public class RelastTest extends DefaultTask {
private final String[] genSuffixes = {".ast", ".jadd", "RefResolver.jadd", "ResolverStubs.jrag", "Serializer.jadd"};
private Path pathToAbsoluteProject(String filename) {
return Paths.get(getProject().getProjectDir().getAbsolutePath(), filename);
}
@TaskAction
void runTest() throws IOException {
setGroup("verification");
......@@ -179,7 +184,7 @@ public class RelastTest extends DefaultTask {
// first, delete generated files
List<Path> genFiles = new ArrayList<>();
for (String suffix : genSuffixes) {
genFiles.add(Paths.get(absoluteProjectPath, getGrammarName() + suffix));
genFiles.add(pathToAbsoluteProject(getGrammarName() + suffix));
}
if (isVerbose()) {
System.out.println("gen files: " + genFiles);
......@@ -191,8 +196,8 @@ public class RelastTest extends DefaultTask {
}
});
// create output directories, if not existing
createDirectory(Paths.get(getOutputDir()));
createDirectory(Paths.get(getGrammarName()).getParent());
createDirectory(pathToAbsoluteProject(getOutputDir()));
createDirectory(pathToAbsoluteProject(getGrammarName()).getParent());
if (isVerbose()) {
System.out.println("Pre processing, running relast");
}
......@@ -209,7 +214,7 @@ public class RelastTest extends DefaultTask {
} else {
javaExecSpec.setMain("org.jastadd.relast.compiler.Compiler");
}
args.addAll(getRelastFiles());
args.addAll(getRelastFiles().stream().map(this::pathToAbsoluteProject).collect(Collectors.toList()));
args.add("--quiet");
if (isWriteToFile()) {
args.add("--file");
......@@ -229,7 +234,7 @@ public class RelastTest extends DefaultTask {
if (isSet(getSerializer())) {
args.add("--serializer=" + getSerializer());
}
args.add("--grammarName=" + getGrammarName());
args.add("--grammarName=" + pathToAbsoluteProject(getGrammarName()));
if (isVerbose()) {
System.out.println("Start relast with args: " + args);
}
......@@ -250,13 +255,13 @@ public class RelastTest extends DefaultTask {
javaExecSpec.setClasspath(runtimeClasspath);
javaExecSpec.setMain("org.jastadd.JastAdd");
List<Object> args = new ArrayList<>();
args.add("--o=" + getOutputDir());
args.add("--o=" + pathToAbsoluteProject(getOutputDir()));
args.add("--package=" + getPackageName());
if (isSet(getJastAddList())) {
args.add("--List=" + getJastAddList());
}
args.addAll(genFiles);
args.addAll(getMoreInputFiles());
args.addAll(getMoreInputFiles().stream().map(this::pathToAbsoluteProject).collect(Collectors.toList()));
if (isVerbose()) {
System.out.println("Start JastAdd with args: " + args);
}
......
......@@ -87,6 +87,7 @@ task preprocessExampleTest(type: JavaExec, group: 'verification') {
//}
task compileExampleTest(type: RelastTest) {
verbose = true
useJastAddNames = true
relastFiles 'src/test/02-after-ros2rag/example/Grammar.relast'
grammarName = 'src/test/03-after-relast/example/example'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment