This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
Q Changing directories and list of directories in variable
posted 12 years ago
I have to replace a develpoment and deployment system using make with ant. I have a hirecrchical package structure of source files which contained a make file at each level and the rules I had defined would recursively traverse each level, use the makefile present there and make the given targets. Now I am trying to replace each makefile at each level with a build.xml file. These files defines some variables like package_dir, subpackages (a list of subdirs), or at inner levels a variable source_files (list of .java files to be compiled). What I want to do here is that When I run any target from top level I would like to get the list of directories in a variable and go into every directory recursively using cd command and execute the ant task using that level build.xml file. There are 2 things which i'm not able to do. 1- Get the list of directories or files exists in a particular directory into a variable. 2- Iterate the directories in the variable and go inside the directory and execte the ant task using that level build.xml file. Has anybody done a similar thing with ant? I will appreciate all feedback.