${project.basedir}/src/org/rascalmpl/library/Prelude.rsc
diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc
index f4dc90debb..8cc4760dbd 100644
--- a/src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc
+++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc
@@ -596,8 +596,18 @@ int main(
bool warnUnusedPatternFormals = true,
bool infoModuleChecked = false,
bool errorsAsWarnings = false,
- bool warningsAsErrors = false
+ bool warningsAsErrors = false,
+ bool readModulesFromFile = false // if this is true, `modules` points to file(s) that we should read the module locations to compile from
) {
+
+ if (readModulesFromFile) {
+ list[loc] actualModules = [];
+ for (m <- modules) {
+ actualModules += readBinaryValueFile(#list[loc], m);
+ }
+ modules = actualModules;
+ }
+
if (verbose) {
println("PathConfig:");
iprintln(pcfg);
diff --git a/src/org/rascalmpl/shell/RascalCompile.java b/src/org/rascalmpl/shell/RascalCompile.java
index ed09a52f5e..414446f99d 100644
--- a/src/org/rascalmpl/shell/RascalCompile.java
+++ b/src/org/rascalmpl/shell/RascalCompile.java
@@ -125,7 +125,27 @@ private static int parallelMain(Map parsedArgs, IList preChecks,
final var chunk = chunks.get(index);
final var chunkBin = bins.get(index);
final Map chunkArgs = new HashMap<>(parsedArgs);
- chunkArgs.put("modules", chunk);
+ if (modulesArgFromFile) {
+ try {
+ var modulesFile = File.createTempFile("rascal-modules-" + i, ".txt");
+ modulesFile.deleteOnExit();
+
+ // Write all module paths to a file
+ try (IValueOutputStream w = new IValueOutputStream(new FileOutputStream(modulesFile), vf)) {
+ w.write(chunk);
+ }
+
+ var modulesFileLoc = URIUtil.assumeCorrectLocation(modulesFile.toURI().toString());
+ chunkArgs.remove("modules");
+ chunkArgs.put("modulesFileLoc", modulesFileLoc);
+ chunkArgs.put("readModulesFromFile", vf.bool(true));
+ } catch (IOException e) {
+ err.println("Could not write module locations to file; passing as arguments instead.");
+ chunkArgs.put("modules", chunk);
+ }
+ } else {
+ chunkArgs.put("modules", chunk);
+ }
chunkArgs.put("bin", chunkBin);
workers.add(exec.submit(() -> {