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

Ensure in RelastTest, that output directories are created.

parent 1542e409
Pipeline #6552 failed with stage
in 1 minute and 49 seconds
...@@ -8,6 +8,9 @@ import org.gradle.api.tasks.SourceSet; ...@@ -8,6 +8,9 @@ import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.SourceSetContainer; import org.gradle.api.tasks.SourceSetContainer;
import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.TaskAction;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -165,7 +168,7 @@ public class RelastTest extends DefaultTask { ...@@ -165,7 +168,7 @@ public class RelastTest extends DefaultTask {
private String[] genSuffixes = {".ast", ".jadd", "RefResolver.jadd", "ResolverStubs.jrag", "Serializer.jadd"}; private String[] genSuffixes = {".ast", ".jadd", "RefResolver.jadd", "ResolverStubs.jrag", "Serializer.jadd"};
@TaskAction @TaskAction
void runTest() { void runTest() throws IOException {
setGroup("verification"); setGroup("verification");
setDescription("Runs a relast test"); setDescription("Runs a relast test");
Project project = getProject(); Project project = getProject();
...@@ -188,6 +191,9 @@ public class RelastTest extends DefaultTask { ...@@ -188,6 +191,9 @@ public class RelastTest extends DefaultTask {
deleteSpec.delete(Paths.get(getOutputDir(), getPackageName())); deleteSpec.delete(Paths.get(getOutputDir(), getPackageName()));
} }
}); });
// create output directories, if not existing
createDirectory(Paths.get(getOutputDir()));
createDirectory(Paths.get(getGrammarName()).getParent());
if (isVerbose()) { if (isVerbose()) {
System.out.println("Pre processing, running relast"); System.out.println("Pre processing, running relast");
} }
...@@ -261,4 +267,13 @@ public class RelastTest extends DefaultTask { ...@@ -261,4 +267,13 @@ public class RelastTest extends DefaultTask {
} }
} }
private void createDirectory(Path path) throws IOException {
try {
Files.createDirectories(path);
} catch (IOException e) {
System.err.println("Could not create output directory " + path);
throw e;
}
}
} }
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