Hi All,
I have a target called "viz.release-up2date?" that uses <uptodate> to figure
out whether a DLL needs recompiling (done by another target based upon the
viz.release-up2date property being set or not). This task worked fine most
of the time, but not all of the time (not to ANT fault, but due to CVS I'm
afraid). Consider the following scenario:
1) DLL was compiled successfully, so it's up-to-date
2) Remove one source file of the DLL
3) CVS update to get that file back.
In 3) the file now has the date at which the cvs update command was run,
which is more recent that the DLL's date. The DLL is thus considered
out-of-date when it's logically perfectly up-to-date compared to the source
code.
Consider this other scenario:
1) New user checks out new sandbox using CVS checkout. This get him the
bin\ directory containing the DLL in question (yes, it's committed to CVS
since not all users have C++ compilation environment, so they need the DLL
for running the application. It's a mixed Java / C++ project) before the
src\ directory.
The DLL in the repository is up-to-date compared to its source, but since it
was created in the local sandbox before its sources, it appears to be
out-of-date!!!
What's one to do in this situation?
I can envision a scheme where a custom ANT task was written to compute a
checksum (CRC32 or Adler for non-secure checksum, or more secure but slower
hashes) of all the source files, somehow being able to associate that
checksum to the target DLL in a persistent manner (how? I don't know, but
saving it in a committed file next to the DLL???), and only when the
checksum of the source files changes from the one recorded would the target
be considered out-of-date....
Is this too far fetched?
As anyone faced the same problem, and solved it?
I'd appreciate any input in this matter. Thanks, --DD
<!-- Find out if VIZ DLL needs compilation.
Note that because CVS puts the modification date of files it creates
to the date the command is run, this target may mistakenly thinks the
target DLL is up-to-date or out-of-date.
-->
<target name="viz.release-up2date?">
<condition property="viz.release-up2date">
<uptodate targetfile="bin/com_lgc_mowi_viz.dll">
<srcfiles dir="src/com/lgc/mowi/viz"
includes="*.h, *.cpp, *.dsp" />
</uptodate>
</condition>
<!-- All this to print "true" or "false" for the property value -->
<condition property="viz.release-up2date.value"
value="false">
<equals arg1="${viz.release-up2date}"
arg2="$${viz.release-up2date}" />
</condition>
<property name="viz.release-up2date.value"
value="true" />
<echo message="viz.release-up2date = ${viz.release-up2date.value}" />
</target><!-- viz.release-up2date? -->
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>