forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gav..." <ga...@16degrees.com.au>
Subject RE: svn commit: r951719 - /forrest/trunk/plugins/build.xml
Date Sun, 06 Jun 2010 00:17:33 GMT


> -----Original Message-----
> From: Gav... [mailto:gavin@16degrees.com.au]
> Sent: Sunday, 6 June 2010 9:36 AM
> To: dev@forrest.apache.org
> Subject: RE: svn commit: r951719 - /forrest/trunk/plugins/build.xml
> 
> 
> 
> > -----Original Message-----
> > From: Tim Williams [mailto:williamstw@gmail.com]
> > Sent: Sunday, 6 June 2010 9:00 AM
> > To: dev@forrest.apache.org
> > Subject: Re: svn commit: r951719 - /forrest/trunk/plugins/build.xml
> >
> > On Sat, Jun 5, 2010 at 6:42 PM, Gav... <gavin@16degrees.com.au>
> wrote:
> 
> 
> <snip>
> 
> > >
> > > So, going back to the original form and altering it slightly:
> > >
> > > <available file="${plugin.java.dir}/**/*.java"
> > property="java_exists"/>
> > >
> > > seems to work fine, though I haven't seen wildcards in any
> examples,
> > I'm
> > > assuming this will work and set the property accordingly.
> >
> > Thanks Gav, you gonna commit this one or you want me to do it?
> >
> > --tim
> 
> Well, I've done it now.
> 
> However it won't have the desired effect David was after.
> 
> It will set the property "java_exists" to either true or false, that
> parts
> works, however just by setting the property at all is enough for later
> targets to use if="java_exists" to always be true (i.e. the property
> does
> exist, doesn't matter if it's true or not.
> 
> Ant 1.8 cures this by checking whether true or false.
> There is a workaround I've done before elsewhere, which means setting a
> variable
> in an extra target and having the other targets depend on the variable.
> 
> I won't apply that though, but try and find where I've done that before
> and
> post
> it here for review first. David may have been on the right path also as
> that
> at
> least will not set the property at all. Will look closer.
> 

Ok, I found where I've done it before.

See: https://issues.apache.org/jira/browse/FOR-1055

It is the same circumstances, see commit r774176 in
/forrest/trunk/main/forrest.build.xml
That will certainly do what we want, something like:

<available file="${plugin.java.dir}/**/*.java" property="java_exists"/>
...
<target name="java-exists-condition" if="java_exists">
  <property name="java_exists.istrue" value="${java_exists}"/>
    <condition property="java_exists.true">
      <istrue value="${java_exists.istrue}"/>
    </condition>
</target>
...
<target name="compile" depends="init, java-exists-condition"
if="java_exists.true">
...
<target name="jar" depends="init, compile, java-exists-condition"
if="java_exists.true">
...

Will work, but I won't apply, other comments and other avenues to fix
welcome.

Gav...




Mime
View raw message