diff options
Diffstat (limited to 'build.xml')
-rw-r--r-- | build.xml | 105 |
1 files changed, 101 insertions, 4 deletions
@@ -1,5 +1,5 @@ <!-- - Copyright (C) 2010-2011 The Project Lombok Authors. + Copyright (C) 2010-2014 The Project Lombok Authors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -256,7 +256,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" /> @@ -269,20 +277,109 @@ the common tasks and can be called on to run the main aspects of all the sub-scr <srcdir dir="test/core/src" /> <srcdir dir="test/bytecode/src" /> <srcdir dir="test/configuration/src" /> - <conf name="build" sources="contrib" /> + <conf name="${eclipse.build.configname}" sources="contrib" /> <conf name="test" sources="contrib" /> + <local org="org.projectlombok" name="lombok.patcher" dir="../lombok.patcher" /> <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> + <antcall target="-augmentClasspath"><param name="pluginName" value="org.eclipse.core.resources" /></antcall> + <antcall target="-augmentClasspath"><param name="pluginName" value="org.eclipse.core.jobs" /></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> + + <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> + + <condition property="multiples"> + <contains string="${augment.bin}" substring=" :: " /> + </condition> + + <condition property="augment.jar" value="${augment.bin}"> + <not><isset property="multiples" /></not> + </condition> + + <input message="You have multiple versions of the same plugin. These are: ${augment.bin}. Please copy/paste the complete path to the one you want to use, press enter to abort:" addproperty="augment.jar" /> + + <condition property="emptyTarget"> + <equals arg1="${augment.jar}" arg2="" /> + </condition> + + <fail> + <condition> + <equals arg1="${augment.jar}" arg2="" /> + </condition> + </fail> + + <pathconvert property="augment.src"> + <map from="${eclipse.location}/plugins/${pluginName}_" to="${eclipse.location}/plugins/${pluginName}.source_" /> + <fileset file="${augment.jar}" /> + </pathconvert> + + <available property="sourceAddition" file="${augment.src}" value=" sourcepath="${augment.src}"" /> + <property name="sourceAddition" value="" /> + + <condition property="sourceWarning" value="WARNING: No source available for this plugin!"> + <equals arg1="${sourceAddition}" arg2="" /> + </condition> + <property name="sourceWarning" value="" /> + + <replaceregexp file=".classpath" flags="is" encoding="UTF-8"> + <regexp pattern="^(.*?)(.)(<classpathentry kind=.lib. path=)(.*)$" /> + <substitution expression="\1\2<classpathentry kind="lib" path="____AUGMENT_BIN____"____AUGMENT_SRC____/>\${line.separator}\2\3\4" /> + </replaceregexp> + <replace file=".classpath" token="____AUGMENT_BIN____" value="${augment.jar}" /> + <replace file=".classpath" token="____AUGMENT_SRC____" value="${sourceAddition}" /> + <echo>Added to project classpath from your eclipse installation: ${pluginName}. +${sourceWarning}</echo> </target> <target name="-test-compile" depends="ensureTestDeps, compile" unless="skipTests"> |