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

Merge branch '2-make-swp1-compatible'

closes #2
parents 73d5a990 da4322fc
from openjdk:11-jdk-slim
env MODOCOT_BASEDIR /modocot
env MODOCOT_TESTDIR /$MODOCOT_BASEDIR/test
env MODOCOT_SOURCEDIR /$MODOCOT_BASEDIR/src
env MODOCOT_RESULTDIR /$MODOCOT_BASEDIR/result
env MODOCOT_LIBSDIR /$MODOCOT_BASEDIR/libs
env MODOCOT_TESTDIR $MODOCOT_BASEDIR/test
env MODOCOT_SOURCEDIR $MODOCOT_BASEDIR/src
env MODOCOT_RESULTDIR $MODOCOT_BASEDIR/result
env MODOCOT_LIBSDIR $MODOCOT_BASEDIR/libs
run mkdir -p $MODOCOT_TESTDIR \
&& mkdir $MODOCOT_SOURCEDIR \
......@@ -14,7 +14,9 @@ run mkdir -p $MODOCOT_TESTDIR \
add target/modocot-openjdk11-junit5-runner-jar-with-dependencies.jar /$MODOCOT_BASEDIR/app.jar
add https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar /$MODOCOT_LIBSDIR/
add https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-engine/5.7.0/junit-jupiter-engine-5.7.0.jar /$MODOCOT_LIBSDIR/
add https://repo1.maven.org/maven2/org/apiguardian/apiguardian-api/1.1.1/apiguardian-api-1.1.1.jar /$MODOCOT_LIBSDIR/
add https://repo1.maven.org/maven2/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar /$MODOCOT_LIBSDIR/
workdir /modocot
entrypoint java -Djava.security.egd=file:/dev/./urandom -jar /modocot/app.jar "$MODOCOT_SOURCEDIR:$MODOCOT_TESTDIR" "$MODOCOT_LIBSDIR/*" $MODOCOT_RESULTDIR
entrypoint java -Djava.security.egd=file:/dev/./urandom -jar /modocot/app.jar "$MODOCOT_SOURCEDIR/src:$MODOCOT_TESTDIR/test" "$MODOCOT_LIBSDIR/*:$MODOCOT_TESTDIR/libs/*" $MODOCOT_RESULTDIR
......@@ -72,7 +72,6 @@ public class Testrunner
libraryFolders = args[1].split(":");
resultFolder = args[2];
classFolder = Files.createTempDirectory("modocot-testrunner").toAbsolutePath().toString();
classPathItems = buildClassPathItems();
// finding all source files
Set<File> sourceFiles = new HashSet<>();
......@@ -94,10 +93,14 @@ public class Testrunner
writeResult(resultSummary);
}
public static String[] buildClassPathItems()
public static String[] buildClassPathItems(boolean runtime)
{
Set<String> classPathItemsBuild = new HashSet<>(Arrays.asList(libraryFolders));
classPathItemsBuild.add(classFolder);
if (runtime)
{
classPathItemsBuild.addAll(Arrays.stream(sourceFolders).collect(Collectors.toSet()));
}
return classPathItemsBuild.toArray(new String[0]);
}
......@@ -111,6 +114,11 @@ public class Testrunner
{
path = path.substring(0, path.length() - 1);
File pathFile = new File(path);
if (!pathFile.exists() || !pathFile.isDirectory())
{
continue;
}
for (File file : Objects.requireNonNull(pathFile.listFiles()))
{
if (file.isFile() && file.getName().endsWith(".jar"))
......@@ -123,7 +131,11 @@ public class Testrunner
}
} else
{
files.add(new File(path));
File file = new File(path);
if (file.exists())
{
files.add(file);
}
}
}
return files;
......@@ -131,6 +143,7 @@ public class Testrunner
public static List<Diagnostic> compile(Set<File> files, File outputDir)
{
classPathItems = buildClassPathItems(false);
LOG.info("compilation started");
List<Diagnostic> compilationErrors = new LinkedList<>();
......@@ -302,6 +315,7 @@ public class Testrunner
public static ModocotResultSummary runTests() throws MalformedURLException
{
classPathItems = buildClassPathItems(true);
LOG.info("saving original class loader");
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
// 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