aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2014-02-07 03:16:55 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2014-02-07 03:16:55 +0100
commit6b0acc9a19cce1c13496d132ce695415780ab52b (patch)
tree252fc251f51ce0b42a24bb9cf982a3f1eef7722b
parentd77bd114a83795b56f67122e7422137f94fe2629 (diff)
downloadlombok-6b0acc9a19cce1c13496d132ce695415780ab52b.tar.gz
lombok-6b0acc9a19cce1c13496d132ce695415780ab52b.tar.bz2
lombok-6b0acc9a19cce1c13496d132ce695415780ab52b.zip
[eclipse debugging] a new target, 'eclipseForDebugging', which imports deps from your eclipse so that line numbers etc line up with your eclipse.
-rw-r--r--.gitignore1
-rw-r--r--build.xml98
-rw-r--r--buildScripts/ivy.xml24
3 files changed, 109 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
index 7fb9cc6b..4b584638 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@
/.idea
*.markdown.html
/junit*.properties
+/eclipse.location
diff --git a/build.xml b/build.xml
index b44d6673..05e36913 100644
--- a/build.xml
+++ b/build.xml
@@ -255,7 +255,15 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
</ivy:intellijgen>
</target>
- <target name="eclipse" depends="deps, contrib" description="Creates eclipse project files and downloads all dependencies. Open this directory as project in eclipse after running this target.">
+ <target name="-skipEclipseDeps">
+ <property name="eclipse.build.configname" value="buildWithoutEclipse" />
+ </target>
+
+ <target name="-addEclipseDeps">
+ <property name="eclipse.build.configname" value="build" />
+ </target>
+
+ <target name="eclipse" depends="-addEclipseDeps, deps, contrib" description="Creates eclipse project files and downloads all dependencies. Open this directory as project in eclipse after running this target. This will NOT let you start a debug session for eclipse; use target 'eclipseForDebugging' instead to do that.">
<ivy:eclipsegen source="1.6">
<srcdir dir="src/core" />
<srcdir dir="src/utils" />
@@ -267,20 +275,104 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<srcdir dir="test/transform/src" />
<srcdir dir="test/core/src" />
<srcdir dir="test/bytecode/src" />
- <conf name="build" sources="contrib" />
+ <conf name="${eclipse.build.configname}" sources="contrib" />
<conf name="test" sources="contrib" />
<settings>
<url url="http://projectlombok.org/downloads/lombok.eclipse.settings" />
</settings>
<apt location="lib/build/projectlombok.org-spi.jar" />
</ivy:eclipsegen>
-
+ </target>
+
+ <target name="ensureEcjDebugDeps" depends="config-ivy">
+ <ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="buildWithoutEclipse" />
+ <ivy:retrieve />
+ </target>
+
+ <target name="loadEclipseLocation">
+ <loadfile property="eclipse.location" srcFile="eclipse.location" encoding="UTF-8" quiet="true" />
+ </target>
+
+ <target name="setupEclipseLocation" depends="loadEclipseLocation" unless="eclipse.location">
+ <echo>To add your eclipse installation's own plugins as dependencies, the build script needs to know where your eclipse is installed. Please enter this now (it's saved for future executions of this task). For example:
+
+ /Applications/eclipse
+ C:\Program Files\eclipse
+</echo>
+ <input message="Path to eclipse: " addproperty="eclipse.location" />
+ <available property="eclipse.found" file="${eclipse.location}/plugins" />
+ <fail unless="eclipse.found">Eclipse can't be found in this location; I expect that directory to contain a subdirectory called 'plugins'.</fail>
+ <echo file="eclipse.location" message="${eclipse.location}" />
+ </target>
+
+ <target name="eclipseForDebugging" depends="-skipEclipseDeps, ensureEcjDebugDeps, eclipse, setupEclipseLocation" description="Creates eclipse project files and downloads all dependencies, but borrows all eclipse dependencies (and more) from your existing eclipse installation. This is very useful if you wish to start a debugging eclipse from inside eclipse, and then breakpoint eclipse code itself. Because the deps are inherited, line numbers will line up and such.">
<copy
file="buildScripts/eclipse-debug-target.template"
tofile="LombokizedEclipse.launch"
preservelastmodified="true"
overwrite="true">
</copy>
+
+ <!-- These are dependencies -->
+ <antcall target="-augmentClasspath"><param name="pluginName" value="org.eclipse.core.runtime" /></antcall>
+ <antcall target="-augmentClasspath"><param name="pluginName" value="org.eclipse.equinox.common" /></antcall>
+ <antcall target="-augmentClasspath"><param name="pluginName" value="org.eclipse.osgi" /></antcall>
+ <antcall target="-augmentClasspath"><param name="pluginName" value="org.eclipse.jdt.core" /></antcall>
+ <antcall target="-augmentClasspath"><param name="pluginName" value="org.eclipse.jdt.ui" /></antcall>
+
+ <!-- These are merely useful -->
+ <antcall target="-augmentClasspath"><param name="pluginName" value="org.eclipse.text" /></antcall>
+ <antcall target="-augmentClasspath"><param name="pluginName" value="org.eclipse.ltk.core.refactoring" /></antcall>
+ </target>
+
+ <target name="-augmentClasspath">
+ <pathconvert property="augment.bin" setonempty="false" pathsep=" :: ">
+ <fileset dir="${eclipse.location}/plugins" includes="${pluginName}_*" />
+ </pathconvert>
+
+ <pathconvert property="augment.src" setonempty="false" pathsep=" :: ">
+ <fileset dir="${eclipse.location}/plugins" includes="${pluginName}.source_*" />
+ </pathconvert>
+
+ <condition property="noSourceAvailable">
+ <and>
+ <isset property="augment.bin" />
+ <not><isset property="augment.src" /></not>
+ </and>
+ </condition>
+
+ <condition property="multiples">
+ <or>
+ <contains string="${augment.bin}" substring=" :: " />
+ <contains string="${augment.src}" substring=" :: " />
+ </or>
+ </condition>
+
+ <fail if="noSourceAvailable">
+ You do not have sources for ${augment.bin}. I expect the sources to be in the same directory, but starting with '${prefix}.source_'.
+ </fail>
+
+ <fail unless="augment.bin">
+ You do not have the eclipse plugin '${pluginName}'. I expected it to be in your eclipse plugins directory (followed by an underscore and a version number).
+ </fail>
+
+ <fail if="multiples">
+ You have multiple versions of the same plugin. You should probably delete everything except the one your eclipse actually uses.
+
+ Binaries: ${augment.bin}
+
+ Sources: ${augment.src}
+ </fail>
+
+ <condition property="intentionallyBreakTheRegexp" value="" else="thisWontBeInClasspathFile">
+ <isset property="augment.bin" />
+ </condition>
+
+ <replaceregexp file=".classpath" flags="is" encoding="UTF-8">
+ <regexp pattern="^(.*?)(.)${intentionallyBreakTheRegexp}(&lt;classpathentry kind=.lib. path=)(.*)$" />
+ <substitution expression="\1\2&lt;classpathentry kind=&quot;lib&quot; path=&quot;${augment.bin}&quot; sourcepath=&quot;${augment.src}&quot;/&gt;\${line.separator}\2\3\4" />
+ </replaceregexp>
+ <echo>Added to project classpath from your eclipse installation: ${pluginName}.</echo>
</target>
<target name="-test-compile" depends="ensureTestDeps, compile" unless="skipTests">
diff --git a/buildScripts/ivy.xml b/buildScripts/ivy.xml
index bd9fb1a1..bcf5ecd1 100644
--- a/buildScripts/ivy.xml
+++ b/buildScripts/ivy.xml
@@ -3,7 +3,9 @@
<configurations>
<conf name="eclipseBuild" />
<conf name="netbeansBuild" />
- <conf name="build" extends="eclipseBuild, netbeansBuild, javac6" />
+ <conf name="buildBase" extends="netbeansBuild, javac6" />
+ <conf name="build" extends="buildBase, eclipseBuild" />
+ <conf name="buildWithoutEclipse" extends="buildBase" />
<conf name="runtime" />
<conf name="test" extends="runtime" />
<conf name="contrib" />
@@ -12,8 +14,8 @@
<conf name="javac7" />
</configurations>
<dependencies>
- <dependency org="org.projectlombok" name="lombok.patcher" rev="0.7" conf="build->default; runtime->default" />
- <dependency org="zwitserloot.com" name="cmdreader" rev="1.2" conf="build->runtime; runtime" />
+ <dependency org="org.projectlombok" name="lombok.patcher" rev="0.7" conf="buildBase->default; runtime->default" />
+ <dependency org="zwitserloot.com" name="cmdreader" rev="1.2" conf="buildBase->runtime; runtime" />
<dependency org="junit" name="junit" rev="4.8.2" conf="test->default; contrib->sources" />
<dependency org="log4j" name="log4j" rev="1.2.16" conf="test->default; contrib->sources" />
@@ -21,15 +23,15 @@
<dependency org="commons-logging" name="commons-logging" rev="1.1.1" conf="test->default; contrib->sources"/>
<dependency org="org.slf4j" name="slf4j-api" rev="1.6.1" conf="test->default; contrib->sources"/>
<dependency org="org.slf4j" name="slf4j-ext" rev="1.6.1" conf="test->default; contrib->sources"/>
- <dependency org="com.googlecode.jarjar" name="jarjar" rev="1.1" conf="build->default" />
+ <dependency org="com.googlecode.jarjar" name="jarjar" rev="1.1" conf="buildBase->default" />
- <dependency org="org.apache.ant" name="ant" rev="1.8.1" conf="build->default; contrib->sources" />
- <dependency org="projectlombok.org" name="spi" rev="0.2.7" conf="build" />
- <dependency org="projectlombok.org" name="ant-googlecode" rev="0.0.2" conf="build" />
- <dependency org="com.jcraft" name="jsch" rev="0.1.42" conf="build->default" />
- <dependency org="projectlombok.org" name="jsch-ant-fixed" rev="0.1.42" conf="build" />
- <dependency org="projectlombok.org" name="markdownj" rev="1.02b4" conf="build" />
- <dependency org="de.java2html" name="java2html" rev="5.0" conf="build->default" />
+ <dependency org="org.apache.ant" name="ant" rev="1.8.1" conf="buildBase->default; contrib->sources" />
+ <dependency org="projectlombok.org" name="spi" rev="0.2.7" conf="buildBase->build" />
+ <dependency org="projectlombok.org" name="ant-googlecode" rev="0.0.2" conf="buildBase->build" />
+ <dependency org="com.jcraft" name="jsch" rev="0.1.42" conf="buildBase->default" />
+ <dependency org="projectlombok.org" name="jsch-ant-fixed" rev="0.1.42" conf="buildBase->build" />
+ <dependency org="projectlombok.org" name="markdownj" rev="1.02b4" conf="buildBase->build" />
+ <dependency org="de.java2html" name="java2html" rev="5.0" conf="buildBase->default" />
<dependency org="net.java.openjdk.custom" name="javac6" rev="1.6.0.18" conf="javac6->runtime; contrib->sources" />
<dependency org="net.java.openjdk.custom" name="javac7" rev="1.7.0" conf="javac7->runtime; contrib->sources" />