ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From easyproglife <>
Subject Properties correct evaluation and resolve
Date Thu, 15 Mar 2007 10:04:14 GMT

I have properties resolve and evaluate problem:

I have 2 projects: "project" and "common".
"common" contains default properties, while "project" contains its own
properties plus some properties to override the default properties from

For example:
"project" set these properties: src.dir, build.dir
"common" set these properties: build.dir (the default one) and dist.dir (=

In my build.xml I first read "project" properties and then "common"
properties, allowing "project" properties to override "common" properties.

The problem arises when I use unresolved properties in "project" for
"project" contains: dist.dir (=${build.dir}/dist2). It overrides default
dist.dir of "common" but uses the unresolved (yet) "build.dir" defined in
"common" contains: as above: build.dir and dist.dir.

I end up with not-fully-resolved "dist.dir".

I tried a workaround - reread "project" properties using ant-contrib's var
task (that overrides existing properties) but I got another problem:
Usually "common" build.xml do mkdir on "dist.dir" but "dist.dir" has been
(incompletely) defined in "project" so mkdir here is meaningless.

I thought that the correct solution should be similar to variable evaluation
in a programming language when subclass overrides some of its superclass's
1. manage two lists: resolved properties and unresolved properties.
2. when you read a new property, if it is already in one of the above lists
- ignore it (property should be immutable)
3. if it could be *fully* resolved (ie. does not contain any unresolved
reference) put it in resolved list.
4. otherwise put it in unresolved list

Now try resolving all unresolved properties:
1. Keep size of unresolved properties list
2. try resolving based on the two lists (resolved and unresolved). Any
successful resolve - move to resolved list.
3. end task if no more unresolved properties
4. keep looping if unresolved size has changed (ie. there was successful
resolve in this iteration)

In this solution (that could be implemented at the end of "property" task)
it is possible to combine properties between many project in a hierarchy of
imports, while keeping the semantics and simplicity of properties

I don't want more complex solutions (eg. scripts) since it complicated the
build script.

What do you think?
Is there already a solution to my problem?
Are there JIRA issues / patches / bug fixes for this issue?

Thanks in advance.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message