<body>

Prashant Deva's blog

Talks on technology and the latest developments in Placid Systems.

Working with Properties

Saturday, October 13, 2007

So here is the first of my posts describing some of the new features coming up in the final release of Virtual Ant. Today we will talk about Ant properties.

For the curious ones, you can skip the rest of this post and go straight to the 2 min video demonstrating the features in Virtual Ant to work with Ant Properties.

As anybody who has created an ant build script will tell you, properties are a very fundamental concept in Ant. They are akin to variables in a programming language and are usually used to hold pathnames to relevant dir. Thus instead of saying '.product/1.0/src' , you usually assign that value to a property like ${src.dir} and use that everywhere the path is needed. This way when it comes to release 2.0 of your software, you can just change one line and your script will continue to run perfectly.

Thus since properties are so important, we just had to put in some special features in Virtual Ant to make it easy to work with them. The basic theory here is that you perform operations on what you see and Virtual Ant can take care of putting in the appropriate properties for you in the task. Here is an example to clear things up -

Lets say you have a property ${build.dir} which has a value of './1.0/build'. Now lets say you browse to './1.0/build' in Virtual Ant and you select the 'build' directory and you hit the delete button. Virtual Ant will recognize that you have a property declared for that folder's path and in the resulting 'delete' task it generates, it will use the property name instead of the path itself.

Virtual Ant is pretty smart in that even if you deleted something inside the 'build' directory, say you deleted './1.0/build/asdf', but you dont have any property defined for it, Virtual Ant will put in '${build.dir}/asdf' instead of the entire path.

This way you only deal with what you see visually and let virtual ant take care of handling the details. Just in case you dont want Virtual Ant guessing the properties, you can turn this off so it will put the entire path in the generated task.

Labels: , ,

posted by Prashant Deva, 12:33 PM

0 Comments:

Add a comment