You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2012/08/15 09:32:50 UTC
[Bug 53723] New: [Patch] Local task: local by prefix, all local,
New: global task
https://issues.apache.org/bugzilla/show_bug.cgi?id=53723
Priority: P2
Bug ID: 53723
Assignee: notifications@ant.apache.org
Summary: [Patch] Local task: local by prefix, all local, New:
global task
Severity: enhancement
Classification: Unclassified
OS: Linux
Reporter: rks-ant@gmx.de
Hardware: PC
Status: NEW
Version: unspecified
Component: Core tasks
Product: Ant
Created attachment 29236
--> https://issues.apache.org/bugzilla/attachment.cgi?id=29236&action=edit
Patch with improved local taskm the new global task and antunit test
Recently I had the need to better control local properties within
a macrodef.
1) All properties with a given prefix should be local.
Needed for:
<xmlproperty file="@{src}" prefix="prefix" />
2) All properties in the current scope should be local.
3) Create a way to exclude a certain property from the
extensive local restriction defined by the previous points.
Examples:
<sequential>
<!-- all properties with the prefix "local." are local -->
<local prefix="local" />
</sequential>
<sequential>
<!-- all properties in this sequential are local -->
<local/>
</sequential>
<sequential>
<!-- all properties in this sequential are local ... -->
<local/>
<!-- ... except the property gFoo -->
<global name="gFoo" />
</sequential>
Updated task "local":
1) New attribut "prefix": All properties with the given prefix are handled as
local properties.
- If the prefix is empty a BuildException is thrown.
- If the prefix does not end with a "." one is appended.
2) Without any attribute, all properties are local.
Usage:
<!-- foo is a local property - like today -->
<local name="foo" />
<!-- All properties with the prefix "local." are local -->
<local prefix="local" />
<!-- all properties are local -->
<local/>
New task "global":
Well, if I can restrict scope like that, it might be that I need a way to
declare all but a special property as local. So I introduced the task global.
The global task is only useful with a accompanied local task. Otherwise it
has no effect.
Attributes:
name: The name of the global property
prefix: All properties with the given prefix are handled as
global properties.
- If the prefix is empty a BuildException is thrown.
- If the prefix does not end with a "." one is appended.
Usage:
<!-- all properties are local, except "global.foo" -->
<local/>
<global name="global.foo" />
<!-- all properties are local, except those prefixed with "global." -->
<local/>
<global prefix="global" />
Note: "global" does not really mean global. In the following example
"foo" is global for the inner sequential but is marked local in the
outer sequential. So it is not visible outside the outer sequential.
>From this point of view the name "global" is not 100% correct.
<target ...
<sequential>
<local name="foo" />
<sequential>
<!-- all but foo are local -->
<local all="true"/>
<global name="foo" />
<property name="foo" value="isset" />
</sequential>
<!-- property foo is set -->
</sequential>
<!-- property foo is NOT set -->
</target>
Some strange usage:
The global task always overrules a local task. Independant of the order.
Should this be changed? How?
<target name="strange">
<sequential>
<!-- Property 'strange' is local -->
<local name="strange" />
<property name="strange" value="bar" />
<echo message="inner local strange: ${strange}" />
<!-- Now property 'strange' is global -->
<global name="strange" />
<echo message="1. inner global strange: ${strange}" />
<property name="strange" value="bar2" />
<echo message="2. inner global strange: ${strange}" />
<!-- declaring it local again has no effect -->
<local name="strange" />
<echo message="3. inner global strange: ${strange}" />
</sequential>
<echo message="global strange: ${strange}" />
</target>
Output:
strange:
inner local strange: bar
1. inner global strange: ${strange}
2. inner global strange: bar2
3. inner global strange: bar2
global strange: bar2
The attached patch contains:
- Updated local task, LocalProperties and LocalPropertyStack
- New task global
- Updated antunit tests (src/tests/antunit/taskdefs/local-test.xml)
I would further refine this if needed and also update documentation if this is
considered for inclusion in ant.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 53723] [Patch] Local task: local by prefix, all local, New:
global task
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53723
Ralf <rk...@gmx.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #29236|Patch with improved local |Patch with improved local
description|taskm the new global task |task, the new global task
|and antunit test |and antunit test
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 53723] [Patch] Local task: local by prefix, all local, New:
global task
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53723
Ralf <rk...@gmx.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS|Linux |All
--
You are receiving this mail because:
You are the assignee for the bug.