View Demo
Download

How it Works

The Virtual File System (VFS)
The core functionality of Virtual Ant revolves around the Virtual File System. The Virtual File System virtualizes your real file system 'on the fly' , which means as you use more and more of the file system in Virtual Ant, it is virtualized at that very instant. The virtual file system also allows you to go back and forth in time.

Characteristics of the VFS

  • The VFS is essentially content less. It does not read the content of a file until really required, eg - reading a zip file from a disk.
  • The VFS does not keep track of modification time or access rights for a file.

Virtual Tasks
Virtual Tasks are virtual counterparts of real Ant Tasks. They are especially meant to be run on the VFS. For example, the mkdir ant task has a virtual task, which runs inside the VFS.

If you try to run a task inside Virtual Ant which does not have a virtual counterpart, it will be highlighted in the play area in yellow color. Virtual Ant will not play any tasks that are not virtual and which can modify your real file system.

How it all works
Since while creating a build script, one really needs to see the structure of the file system rather than its contents, the content less nature of the VFS lends to extreme speed and also overcomes some of the problems creating a build script in a system like Virtual Ant might lend to.

As an example, the javac virtual task just takes all the .java files and creates corresponding .class files. In pretty much every case, this is sufficient information for the person creating the builld script and he does not need to be bothered about the actual content of the .class files. This also solves the problem of what to do in case there are compile errors in the java files, since we cannot tell the person creating the build script to hold it off until all the java errors are fixed.

As you will see throughout the design of virtual ant we have taken steps to ensure that the build script developer be able to continue with creating the script and be able to handle the worst case situation, even though the content of the real file system may not allow it. As another example, VFS also does not contain the modification date of a file but in situations when the time of file need to be compared, eg, when using a DateSelector, Virtual Ant takes the worst case and returns every file. We believe this is the right thing to do, since at the time of writing the build script the developer might not have the modification times accurate, thus he needs to take the worst case into account for the script.

But note that we mentioned that the vfs is essentially contentless. What this means is that if a task really, really needs to read the contents of a file it can do so. Thus for example, fileset elements have an attribute 'excludesfile' which takes a file which contains the patterns of file which are to be excluded from the fileset. In such a case the vfs will actually read the contents of the file from the disk.

Currently not all the tasks that come with Ant have virtual counterparts to them. We hope to improve this by the final release. We will soon be releasing more details on the vfs to allow developers to provide virtual tasks for their own ant tasks.