when creating default ivy.xml/POM files, only overwrite existing files if anything relevant has changed
git-svn-id: https://svn.apache.org/repos/asf/ant/antlibs/common/trunk@1064144 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ivy.xml b/ivy.xml
index 7a429be..b24b651 100644
--- a/ivy.xml
+++ b/ivy.xml
@@ -38,6 +38,23 @@
<!--look for a template Ivy file -->
<property name="project.ivy.xml" location="project-template.ivy.xml"/>
<available property="project.has-ivy.xml?" file="${project.ivy.xml}"/>
+ <condition property="generate-default-ivy.xml?">
+ <and>
+ <not>
+ <isset property="project.has-ivy.xml?"/>
+ </not>
+ <not>
+ <uptodate targetfile="${target.ivy.xml}">
+ <srcresources>
+ <file file="${common.basedir}/build.xml"/>
+ <file file="${common.basedir}/ivy.xml"/>
+ <file file="version.properties"/>
+ <file file="${target.jar}"/>
+ </srcresources>
+ </uptodate>
+ </not>
+ </and>
+ </condition>
</target>
@@ -54,7 +71,7 @@
<!-- inline creation of a zero dependency ivy.xml.
We don't even declare a dependency on ant!
-->
- <target name="make-ivy.xml" depends="ivy-init" unless="project.has-ivy.xml?">
+ <target name="make-ivy.xml" depends="ivy-init" if="generate-default-ivy.xml?">
<echo message="Creating ivy.xml ${target.ivy.xml}" level="verbose"/>
<echo file="${target.ivy.xml}"><![CDATA[
<ivy-module version="2.0">
diff --git a/m2.xml b/m2.xml
index 159db64..ec316be 100644
--- a/m2.xml
+++ b/m2.xml
@@ -35,6 +35,23 @@
<!--look for a template pom -->
<property name="project.pom" location="project-template.pom"/>
<available property="project.haspom?" file="${project.pom}"/>
+ <condition property="generate-default-pom?">
+ <and>
+ <not>
+ <isset property="project.haspom?"/>
+ </not>
+ <not>
+ <uptodate targetfile="${target.pom}">
+ <srcresources>
+ <file file="${common.basedir}/build.xml"/>
+ <file file="${common.basedir}/m2.xml"/>
+ <file file="version.properties"/>
+ <file file="${target.jar}"/>
+ </srcresources>
+ </uptodate>
+ </not>
+ </and>
+ </condition>
</target>
@@ -51,7 +68,7 @@
<!-- inline creation of a zero dependency pom.
We don't even declare a dependency on ant!
-->
- <target name="m2-make-pom" depends="m2-init" unless="project.haspom?">
+ <target name="m2-make-pom" depends="m2-init" if="generate-default-pom?">
<echo message="Creating Pom ${target.pom}" level="verbose"/>
<echoxml file="${target.pom}">
<project>