You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Raja Nagendra Kumar <Na...@tejasoft.com> on 2009/12/08 05:51:35 UTC

Ant properties access based Object notation rather than script based

Hi,

My thoughts are still vague.. thought to share this with ant dev and making
it better based on all your reply..

Currently I see the toughest thing in managing the huge ant scripts is
remembering property names and referencing to them.

The issues I see are 
1. properties can be declared though <property> tag which are global and
readonly nature. Global nature has huge impact on choosing the names. To an
extent we could control to this though names such as compile.classpath etc..
i.e using the . as seperator
2. Many properties could also be declared though  custom tasks
Many new properties may be declared through java interfaces constants..
however one has to remember their names when referred with in ant script.
Many chances are there that the name may get changed in interface value but
not in script.

In this context was thinking is there a way/or think of a new feature to
declare ant properties as interface constants/enums in java and refer them
through the interface only.. many be though class import and referring them
directly (not using the <script> tag or <groovy>).

e.g

I have a java interface

package custom.task.consts;
public interface PathConsts
{
    String JME_CP = "jme.cp";

}

in the ant script build.xml

import com.task.consts. PathConsts;
<javac
    classpath="%%JME_CP">...to refer the property value of ant property
jme.cp

or 
<classpath id="%JME_CP"> to refer to the value of const which is jme.cp

The same logic could be applied to all the properties which are declared
though <property> task. i.e give a interface constant notation to every
property which is declared so that errors can be caught more easily

This approach can make scripting based on properties lot better though
keeping their global nature intact.

This is just an idea hope some smart guy takes it forward..:) to make the
ant compiler better and for sure would enable debugging lot easier.

I am not a language design expert, those who are, can decide on a better
syntax.. once the forum sees a need for redefining the way properties be
accessible within ant script. 


Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com
-Single Source Mobile Applications Experts
-- 
View this message in context: http://old.nabble.com/Ant-properties-access-based-Object-notation-rather-than-script-based-tp26688713p26688713.html
Sent from the Ant - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant properties access based Object notation rather than script based

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
true, project.setProperty() does allow overides and setNewProperty() is read
only/set only once method.

Regards,
Nagendra
-- 
View this message in context: http://old.nabble.com/Ant-properties-access-based-Object-notation-rather-than-script-based-tp26688713p26722475.html
Sent from the Ant - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant properties access based Object notation rather than script based

Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-12-09, Raja Nagendra Kumar <Na...@tejasoft.com> wrote:

> Is there a replacement for Variable task of ant contrib as Variable
> task is not adopted to ant 1.8 Property helpers and hence the
> interface methods are not called yet.

It should be possible to write a PropertyHelper implementation that acts
like the variable task.  See what the implementation for local
properties does, this is way more complex than making properties
mutable.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant properties access based Object notation rather than script based

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
Tried to use this feature of nightly build of ant 1.8 and understand that
still there is a issue in custom tasks.

Is there a replacement for  Variable task of ant contrib as Variable task is
not adopted to ant 1.8 Property helpers and hence the interface methods are
not called yet.

Regards,
Nagendra
-- 
View this message in context: http://old.nabble.com/Ant-properties-access-based-Object-notation-rather-than-script-based-tp26688713p26708490.html
Sent from the Ant - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant properties access based Object notation rather than script based

Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-12-08, Raja Nagendra Kumar <Na...@tejasoft.com> wrote:

> Stefan, are there any time line for 1.8.. I see many people asking the
> same thing but no clear answer we see.

Like in most open source projects, the answer to any such question is
"when it's done".  In the case of Ant 1.8.0 it looks as if we have one
remaining feature to agree on - so we get it right before it is out in
the wild and needs to be supported in the future.

This shouldnt take too long so I hope we'll be able to start the whole
release procedure which involves quite a bit more than just saying "here
it is" before christmas.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant properties access based Object notation rather than script based

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
Wow.. good to know about adding of Custom property definition and resolution
features in the 1.8.x..

Stefan, are there any time line for 1.8.. I see many people asking the same
thing but no clear answer we see.

Regards,
Nagendra
-- 
View this message in context: http://old.nabble.com/Ant-properties-access-based-Object-notation-rather-than-script-based-tp26688713p26689170.html
Sent from the Ant - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant properties access based Object notation rather than script based

Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-12-08, Raja Nagendra Kumar <Na...@tejasoft.com> wrote:

> In this context was thinking is there a way/or think of a new feature to
> declare ant properties as interface constants/enums in java and refer them
> through the interface only.. many be though class import and referring them
> directly (not using the <script> tag or <groovy>).

You will find that the infrastructure for such a change is already in
place with PropertyHelpers in trunk (they are quite different from Ant
1.7.x PropertyHelpers).

"All it takes" is to write a property helper implementation that
provided your intended semantics and register it at the top of the build
file.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org