fun times ant hacking to make the ant eclipseForDebugging task ask which alternative you want in the face of multiple plugin versions.

This commit is contained in:
Reinier Zwitserloot committed 2014-02-27 16:04:40 +01:00
1 parent 7d10aad6a6
commit 99784282b9
1 file changed
+37 -37
+37 -37
View File
@@ -330,51 +330,51 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<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 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=&quot;${augment.src}&quot;" />
<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="^(.*?)(.)${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" />
<regexp pattern="^(.*?)(.)(&lt;classpathentry kind=.lib. path=)(.*)$" />
<substitution expression="\1\2&lt;classpathentry kind=&quot;lib&quot; path=&quot;____AUGMENT_BIN____&quot;____AUGMENT_SRC____/&gt;\${line.separator}\2\3\4" />
</replaceregexp>
<replace file=".classpath" token="____AUGMENT_BIN____" value="${augment.bin}" />
<replace file=".classpath" token="____AUGMENT_SRC____" value="${augment.src}" />
<echo>Added to project classpath from your eclipse installation: ${pluginName}.</echo>
<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">