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 | link | 0 comments |  

Nested datatypes in Virtual Ant and How we screwed up the Beta

Wednesday, October 03, 2007

As it turns out , I just recently noticed that a minor mistake on our part greatly screwed up the beta experience for all the users. If you did try the beta then don’t worry, it doesn’t affect your system in any way but it does affect the experience you had with Virtual Ant, meaning you didn’t get to see everything we had put in there.

So what was the problem? Well as it turns out when they tell you to avoid hardcoding absolute paths in your code they are absolutely right. But as it turns out, in the heat of coding someone got a little tempted and the path to one of the images in the beta version of Virtual Ant had an absolute path to the directory containing it.

That images was for one of the buttons in Virtual Ant. Since the button is custom drawn on the GUI, without the image you wont be able to see it at all. The problem went unnoticed for so long because all the machines we tried it on had the image in the right place. The mistake was finally noticed when just last week we went to update that portion of the code.

So by now, you are probably wondering what does the button actually do and where should it have been found. Well as it turns out when you select one of the running tasks in Virtual Ant, you see all its attributes on the right. Below the attributes are bars which allow you to add datatypes like 'fileset', 'filelist', etc to the task right from the gui. The image in question refers to the button which allow you to add datatypes to the task.

No buttons to add datatypes!

Since you cannot see the button, you cannot add datatypes to the task, rendering Virtual Ant almost useless. Thus you can imagine my horror when I noticed this error so late in the game and realized how we royally screwed up the beta release.

But now since we are past that, its time to show you how the attributes view in the final release will look like.

The new attributes view

Clicking on the 'green' plus button next to each datatype allows you to add datatypes to that task. Many datatypes have a special dialog associated with them which gives you a special gui to define that datatype easily. If the datatype has a dialog associated with it, it will pop up when you click on the 'plus' button. Here is the dialog for adding selectors to a task which supports them.

Selector dialog

Special gui dialogs like this are defined for many ant datatypes like fileset, filelist etc.

That said we are now extremely close to the final release. We have added an insane amount of functionality since the beta. I will be talking about some of the major new features for the final release in my next few posts.

Labels: , ,

posted by Prashant Deva, 12:14 PM | link | 0 comments |