Permalink
Browse files

Refuse to package the GATK from a non-clean working directory

Packaging from a non-clean working directory can result in an incorrect
jar. Now that we have external collaborators packaging and distributing
the GATK, not enforcing the clean requirement has become far too dangerous.
At the same time, invoking "clean" automatically through a direct
dependency would also be dangerous -- instead, it's better to error out
if a packaging target is invoked from a non-clean working dir.
  • Loading branch information...
1 parent d3f5a5e commit 63dddfbd97ed94f174b0cb8099aec4f28e197a1d @droazen droazen committed Nov 2, 2012
Showing with 19 additions and 1 deletion.
  1. +19 −1 build.xml
View
@@ -891,7 +891,7 @@
<!-- Build a package consisting of all supporting files. Don't call this target directly. Call one of the specific packaging targets below -->
- <target name="package" depends="dist,stage,require.executable" description="bundle up an executable for distribution">
+ <target name="package" depends="require.clean,dist,stage,require.executable" description="bundle up an executable for distribution">
<mkdir dir="${package.output.dir}" />
<xslt destdir="${package.output.dir}" style="${package.xml.dir}/CreatePackager.xsl" useImplicitFileset="false">
<flattenmapper/>
@@ -1011,6 +1011,24 @@
<delete dir="${pipelinetest.dir}"/>
</target>
+ <!-- Depend on this target if your target requires a clean working directory but you don't want to depend on clean directly -->
+ <target name="require.clean">
+ <condition property="not.clean">
+ <or>
+ <available file="${build.dir}" />
+ <available file="${lib.dir}" />
+ <available file="${contract.dump.dir}" />
+ <available file="${staging.dir}" />
+ <available file="${dist.dir}" />
+ <available file="${pipelinetest.dir}" />
+ <available file="${javadoc.dir}" />
+ <available file="${scaladoc.dir}" />
+ <available file="${gatkdocs.dir}" />
+ </or>
+ </condition>
+ <fail message="Selected build target requires a clean working directory. Run ant clean and then try again." if="not.clean" />
+ </target>
+
<!-- ******************************************************************************** -->
<!-- gsalib -->

0 comments on commit 63dddfb

Please sign in to comment.