diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-07-03 05:31:34 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-07-03 05:34:30 +0200 |
commit | cb7e4a9ef3f02d5a543f99d013b5034f50732293 (patch) | |
tree | f5a6f958666130b1104f91e6ddc217de0be34c5a /src/support/lombok | |
parent | 88918e9eb3e65645fddd0f5f850795ce3fec25df (diff) | |
download | lombok-cb7e4a9ef3f02d5a543f99d013b5034f50732293.tar.gz lombok-cb7e4a9ef3f02d5a543f99d013b5034f50732293.tar.bz2 lombok-cb7e4a9ef3f02d5a543f99d013b5034f50732293.zip |
[build] propagate chosen bootclasspath into eclipse test targets
Diffstat (limited to 'src/support/lombok')
-rw-r--r-- | src/support/lombok/eclipseCreate/CreateEclipseDebugTarget.java | 18 |
1 files changed, 16 insertions, 2 deletions
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<listEntry value=\"<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/lombok/bin" path="3" type="2"/> \"/>\n"); for (Map.Entry<String, String> entry : args.entrySet()) { if (!entry.getKey().startsWith("conf.")) continue; @@ -111,7 +113,7 @@ public class CreateEclipseDebugTarget { } } } - launchContent.append("\t\t<listEntry value=\"<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/lombok/lib/openjdk6_rt.jar" path="5" type="2"/> \"/>\n"); + if (bootpath != null) launchContent.append("\t\t<listEntry value=\"<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/lombok/" + bootpath + "" path="5" type="2"/> \"/>\n"); launchContent.append("\t</listAttribute>\n"); } @@ -120,6 +122,7 @@ public class CreateEclipseDebugTarget { launchContent.append("\t<booleanAttribute key=\"org.eclipse.jdt.launching.DEFAULT_CLASSPATH\" value=\"false\"/>\n"); String jvmTarget = getArgString("jvmTarget"); + String bootpath = getBootPath(); launchContent.append("\t<stringAttribute key=\"org.eclipse.jdt.launching.JRE_CONTAINER\" value=\"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-").append(jvmTarget).append("\"/>\n"); launchContent.append("\t<stringAttribute key=\"org.eclipse.jdt.launching.MAIN_TYPE\" value=\"").append(type).append("\"/>\n"); launchContent.append("\t<listAttribute key=\"org.eclipse.jdt.launching.MODULEPATH\"/>\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("</launchConfiguration>\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"); |