Verified Commit 695f4e40 authored by Lukas Wiest's avatar Lukas Wiest 🚂
Browse files

fix(app): buildClasspath: build classpath differently for compile and runtime

parent a6f72b00
...@@ -72,7 +72,6 @@ public class Testrunner ...@@ -72,7 +72,6 @@ public class Testrunner
libraryFolders = args[1].split(":"); libraryFolders = args[1].split(":");
resultFolder = args[2]; resultFolder = args[2];
classFolder = Files.createTempDirectory("modocot-testrunner").toAbsolutePath().toString(); classFolder = Files.createTempDirectory("modocot-testrunner").toAbsolutePath().toString();
classPathItems = buildClassPathItems();
// finding all source files // finding all source files
Set<File> sourceFiles = new HashSet<>(); Set<File> sourceFiles = new HashSet<>();
...@@ -94,10 +93,14 @@ public class Testrunner ...@@ -94,10 +93,14 @@ public class Testrunner
writeResult(resultSummary); writeResult(resultSummary);
} }
public static String[] buildClassPathItems() public static String[] buildClassPathItems(boolean runtime)
{ {
Set<String> classPathItemsBuild = new HashSet<>(Arrays.asList(libraryFolders)); Set<String> classPathItemsBuild = new HashSet<>(Arrays.asList(libraryFolders));
classPathItemsBuild.add(classFolder); classPathItemsBuild.add(classFolder);
if (runtime)
{
classPathItemsBuild.addAll(Arrays.stream(sourceFolders).collect(Collectors.toSet()));
}
return classPathItemsBuild.toArray(new String[0]); return classPathItemsBuild.toArray(new String[0]);
} }
...@@ -140,6 +143,7 @@ public class Testrunner ...@@ -140,6 +143,7 @@ public class Testrunner
public static List<Diagnostic> compile(Set<File> files, File outputDir) public static List<Diagnostic> compile(Set<File> files, File outputDir)
{ {
classPathItems = buildClassPathItems(false);
LOG.info("compilation started"); LOG.info("compilation started");
List<Diagnostic> compilationErrors = new LinkedList<>(); List<Diagnostic> compilationErrors = new LinkedList<>();
...@@ -311,6 +315,7 @@ public class Testrunner ...@@ -311,6 +315,7 @@ public class Testrunner
public static ModocotResultSummary runTests() throws MalformedURLException public static ModocotResultSummary runTests() throws MalformedURLException
{ {
classPathItems = buildClassPathItems(true);
LOG.info("saving original class loader"); LOG.info("saving original class loader");
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
// get custom one // get custom one
......
Markdown is supported
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