Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow path to ct.sym to be specified via a system property #296

Closed
wants to merge 1 commit into from
Closed
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
19 changes: 14 additions & 5 deletions java/com/google/turbine/binder/CtSymClassBinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,20 @@ public final class CtSymClassBinder {
private static final int FEATURE_VERSION = Runtime.version().feature();

public static @Nullable ClassPath bind(int version) throws IOException {
String javaHome = JAVA_HOME.value();
requireNonNull(javaHome, "attempted to use --release, but JAVA_HOME is not set");
Path ctSym = Paths.get(javaHome).resolve("lib/ct.sym");
if (!Files.exists(ctSym)) {
throw new IllegalStateException("lib/ct.sym does not exist in " + javaHome);
Path ctSym;
String explicitCtSymPath = System.getProperty("turbine.ctSymPath");
if (explicitCtSymPath == null) {
String javaHome = JAVA_HOME.value();
requireNonNull(javaHome, "attempted to use --release, but JAVA_HOME is not set");
ctSym = Paths.get(javaHome).resolve("lib/ct.sym");
if (!Files.exists(ctSym)) {
throw new IllegalStateException("lib/ct.sym does not exist in " + javaHome);
}
} else {
ctSym = Paths.get(explicitCtSymPath);
if (!Files.exists(ctSym)) {
throw new IllegalStateException("ct.sym does not exist at " + ctSym);
}
}
Map<ClassSymbol, BytecodeBoundClass> map = new HashMap<>();
Map<ModuleSymbol, ModuleInfo> modules = new HashMap<>();
Expand Down