From cb7e4a9ef3f02d5a543f99d013b5034f50732293 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Fri, 3 Jul 2020 05:31:34 +0200 Subject: [build] propagate chosen bootclasspath into eclipse test targets --- .../lombok/eclipseCreate/CreateEclipseDebugTarget.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/support/lombok/eclipseCreate/CreateEclipseDebugTarget.java b/src/support/lombok/eclipseCreate/CreateEclipseDebugTarget.java index d3b314cb..d00524f7 100644 --- a/src/support/lombok/eclipseCreate/CreateEclipseDebugTarget.java +++ b/src/support/lombok/eclipseCreate/CreateEclipseDebugTarget.java @@ -93,6 +93,8 @@ public class CreateEclipseDebugTarget { throw new InvalidCommandLineException("Cannot obtain canonical path to parent directory", e); } + String bootpath = getBootPath(); + launchContent.append("\t\t\n"); for (Map.Entry entry : args.entrySet()) { if (!entry.getKey().startsWith("conf.")) continue; @@ -111,7 +113,7 @@ public class CreateEclipseDebugTarget { } } } - launchContent.append("\t\t\n"); + if (bootpath != null) launchContent.append("\t\t\n"); launchContent.append("\t\n"); } @@ -120,6 +122,7 @@ public class CreateEclipseDebugTarget { launchContent.append("\t\n"); String jvmTarget = getArgString("jvmTarget"); + String bootpath = getBootPath(); launchContent.append("\t\n"); launchContent.append("\t\n"); launchContent.append("\t\n"); @@ -129,10 +132,21 @@ public class CreateEclipseDebugTarget { if (!entry.getKey().startsWith("conf.")) continue; launchContent.append(File.pathSeparator).append(entry.getValue()); } - launchContent.append(" -Ddelombok.bootclasspath=lib/openjdk6_rt.jar\"/>\n"); + if (bootpath != null) launchContent.append(" -Ddelombok.bootclasspath=" + bootpath + "\"/>\n"); launchContent.append("\n"); } + private String getBootPath() { + String bp = args.get("bootpath"); + if (bp == null) return null; + File f = new File(bp); + if (!f.isAbsolute()) return bp; + String r = new File(".").getAbsolutePath(); + if (r.endsWith(".")) r = r.substring(0, r.length() - 1); + if (bp.startsWith(r)) return bp.substring(r.length()); + throw new IllegalStateException("Cannot reconstruct relative path; base: " + r + " is not a parent of " + bp); + } + private String getArgString(String key) throws InvalidCommandLineException { String v = args.get(key); if (v == null) throw new InvalidCommandLineException("mandatory argument '" + key + "' missing"); -- cgit