aboutsummaryrefslogtreecommitdiff
path: root/src/support/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-07-03 05:31:34 +0200
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-07-03 05:34:30 +0200
commitcb7e4a9ef3f02d5a543f99d013b5034f50732293 (patch)
treef5a6f958666130b1104f91e6ddc217de0be34c5a /src/support/lombok
parent88918e9eb3e65645fddd0f5f850795ce3fec25df (diff)
downloadlombok-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.java18
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=\"&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/lombok/bin&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;\"/>\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=\"&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/lombok/lib/openjdk6_rt.jar&quot; path=&quot;5&quot; type=&quot;2&quot;/&gt;&#10;\"/>\n");
+ if (bootpath != null) launchContent.append("\t\t<listEntry value=\"&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/lombok/" + bootpath + "&quot; path=&quot;5&quot; type=&quot;2&quot;/&gt;&#10;\"/>\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");