I'd like to echo Curt's words. There was a bug in our Ant build.xml
file due to the counter-intuitive way Ant handles dependencies and
their conditions.
http://ant.apache.org/faq.html#stop-dependency
Q: I have a target I want to skip if a property is set, so I have
unless="property" as an attribute of the target, but all the targets
this target depends on are still executed. Why?
A: The list of dependencies is generated by Ant before any of the targets
are run. This allows dependent targets, such as an init target, to set
properties that can control the execution of the targets higher in the
dependency graph. This is a good thing.
However, when your dependencies break down the higher-level task into
several smaller steps, this behavior becomes counter-intuitive. There
are a couple of solutions available:
- Put the same condition on each of the dependent targets.
- Execute the steps using <antcall>, instead of specifying them inside
the depends attribute.
The fix is in plain view for everyone to see: "Put the same condition
on each of the dependent targets."
Thus, the remedy consists of changing the line
<target name="chainsaw.jar" depends="build">
to
<target name="chainsaw.jar" depends="build" if="chainsaw-libraries-present">
In other words, simply repeating the condition for the
"build.chansaw" target would have sufficed.
Scott, may I propose to revert your changes to the RuleFactory class?
I think instanciation by introspection introduces unnecessary
complexity in this case.
At 04:37 AM 12/16/2004, Curt Arnold wrote:
On Dec 15, 2004, at 8:15 PM, Paul Smith wrote:
I just did an "ant clean" then an "ant jar" and the chainsaw jar DOES
contain LogUI.
So unless the local environment is missing something that is preventing
it from building all of Chainsaw (maybe regexp library not there?).
Curt, maybe you could email me or Scott the jar that gets built, along
with the output of whatever "ant jar" gives you.
The partial chainsaw jar only occurs when chainsaw-libraries-present is
not set. In that case, the body of the build.chainsaw task is skipped due
to the if condition not being set. However, chainsaw.jar doesn't have the
same if condition so its body will be executed regardless of the state of
chainsaw-libraries-present. The easiest way to reproduce it is to rename
your build.properties so jakarta-oro is not located (might need to make
sure it is off the classpath too).
I had not been trying to build chainsaw and had not set a build.properties
file since it is not necessary to build a functional log4j.
One approach would be to add the if condition to the chainsaw.jar task, so
that if the body of build.chainsaw is skipped the body of the chainsaw.jar
task is skipped. Adding that condition would result in only log4j.jar
being created under the conditions described.
The other would be to fail build.chainsaw if the libraries were
missing. To build just log4j.jar, you would need to build the log4j.jar
target.
p.s. Ant FAQ on if and unless not affecting dependent tasks:
http://ant.apache.org/faq.html#stop-dependency.
--
Ceki Gülcü
The complete log4j manual: http://qos.ch/log4j/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]