--- Michael Slass <[EMAIL PROTECTED]> wrote:
> Thanks for the workaround; I agree that your solution will work, but
> it seems a bit cumbersome in terms of additional tags added to
> build.xml.
Well, much of Ant "seems a bit cumbersome in terms of additional tags" :)
But, really, in this case, it's not as bad as you think it might be -- eg:
<target name="copy">
<property name="src.dir" location="some/source/dir/foo"/>
<property name="files.list" value="README,LICENSE,GPL,INSTALL,COPYING"/>
<foreach list="${files.list}" param="file" target="chkFile"/>
<fileset dir="${src.dir}" id="fs1">
<patternset id="ps1">
<include name="**/*.class"/>
</patternset>
</fileset>
<pathconvert pathsep="" refid="fs1" property="fs1"/>
<fail unless="fs1">
Error: No class files found! Exiting...
</fail>
<copy todir="some/target/dir">
<fileset dir="${src.dir}" includes="${files.list}">
<patternset refid="ps1"/>
</fileset>
</copy>
</target>
<target name="chkFile">
<available file="${src.dir}/${file}" type="file" property="found"/>
<fail unless="found">
Error: File ${file} not found! Exiting...
</fail>
</target>
> The solution I envision would allow the failure to occur if any files
> or filesets in a copy task were not found, just by modifying the copy
> task:
[snip]
> In this instance, I'd like it to fail if any of the explicitly-named
> files are not found, or if there are no .class files found under the
> foo directory, just by setting the strictfind property to "true".
[snip]
> Again, I've posted to the dev list, because I'm quite willing to take
> a crack at hacking the ant code to do this. I do, however, need some
> pointers at where I should be looking.
It looks like you could just add an "else" to the "if" that starts out
doFileOperations() -- but that'd only give you an opportunity to say that
"some" file(s) was/were missing; whereas, the specific checks in my
approach will let you say exactly what's missing. To get Copy to check and
error out for specific files would take a lot more digging into the source
-- so if you want to go that way, good luck :) (Note: I suspect your added
functionality could well clash with the includeEmptyDirs attribute, though
-- but that's just a guess.)
Diane
=====
([EMAIL PROTECTED])
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>