Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/org/rascalmpl/shell/ShellEvaluatorFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.io.PrintWriter;
import java.io.Reader;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

import org.rascalmpl.debug.IRascalMonitor;
import org.rascalmpl.ideservices.IDEServices;
Expand Down Expand Up @@ -64,14 +66,11 @@ private static Evaluator getDefaultEvaluatorForPathConfig(ISourceLocation projec
evaluator.addRascalSearchPath((ISourceLocation) srcPath);
}

var isRascal = projectRoot != null && new RascalManifest().getProjectName(projectRoot).equals("rascal");

for (var lib : pcfg.getLibs()) {
evaluator.addRascalSearchPath((ISourceLocation) lib);
}

var libs = isRascal ? pcfg.getLibs() : pcfg.getLibsAndTarget();
evaluator.addClassLoader(new SourceLocationClassLoader(libs, ClassLoader.getSystemClassLoader()));
evaluator.addClassLoader(new SourceLocationClassLoader(getClasspath(pcfg), ClassLoader.getSystemClassLoader()));

return evaluator;
}
Expand Down Expand Up @@ -119,4 +118,13 @@ private static void registerProjectAndTargetResolver(Function<ISourceLocation,IS
reg.registerLogical(new IDETargetURIResolver(resolver));
}

public static List<ISourceLocation> getClasspath(PathConfig pcfg) {
var projectRoot = pcfg.getProjectRoot();
var isRascal = projectRoot != null && new RascalManifest().getProjectName(projectRoot).equals("rascal");
var libs = isRascal ? pcfg.getLibs() : pcfg.getLibsAndTarget();
return libs.stream()
.map(ISourceLocation.class::cast)
.collect(Collectors.toList());
}

}
Loading