Execute the target only if source files have changed

YuGiOhJCJ Mailing-List <[email protected]>
Newsgroups gmane.comp.jakarta.ant.user
Message-ID <[email protected]>
Hello,

I have a target that transforms files XCF into PNG by calling the "convert" command.
I would like that this target does not execute if source files (i.e., the XCF files ) have changed.
I have tried with the "uptodate" task but it does not work.
Each time I run ant, the "convert" command is called.

Any idea ?

Thank you.
Best regards.

This is my build.xml file:
<project name="xcf2png" default="png">
	<target name="png-check">
		<uptodate property="png-uptodate" targetfile="png/**.*.png">
			<srcfiles dir= "xcf" includes="**/*.xcf"/>
		</uptodate>
	</target>
	<target name="png" depends="png-check" unless="png-uptodate">
		<mkdir dir="png"/>
		<exec executable="convert">
			<arg value="-verbose"/>
			<arg value="-alpha"/>
			<arg value="on"/>
			<arg value="-background"/>
			<arg value="none"/>
			<arg value="-layers"/>
			<arg value="merge"/>
			<arg value="xcf/icon.xcf"/>
			<arg value="png/icon.png"/>
		</exec>
	</target>
	<target name="clean">
		<delete dir="png"/>
	</target>
</project>

This is the result in the console:
$ ant
Buildfile: /home/yugiohjcj/xcf2png/build.xml

png-check:

png:
     [exec] xcf/icon.xcf[0] XCF 32x32 32x32+0+0 8-bit sRGB 1.21KB 0.000u 0:00.000
     [exec] xcf/icon.xcf[0] XCF 6x21 6x21+13+6 8-bit sRGB 0.000u 0:00.000
     [exec] xcf/icon.xcf=>png/icon-0.png[0] XCF 32x32 32x32+0+0 8-bit sRGB 1c 255B 0.000u 0:00.089
     [exec] xcf/icon.xcf=>png/icon-1.png[1] XCF 6x21 6x21+13+6 8-bit sRGB 3c 299B 0.000u 0:00.160

BUILD SUCCESSFUL
Total time: 0 seconds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.