\r
import java.io.File;\r
import java.util.List;\r
-import java.util.Vector;\r
\r
import org.apache.commons.logging.Log;\r
import org.apache.commons.logging.LogFactory;\r
public class AntRegistryUtil {\r
private static Log log = LogFactory.getLog(AntRegistryUtil.class);\r
\r
- /** Read a structure registry from an Ant file without executing it. */\r
+ /** Reads a structure registry from an Ant file without executing it. */\r
public static StructureRegistry readRegistry(File antFile) {\r
-\r
+ if (log.isDebugEnabled())\r
+ log.debug("Reads registry for Ant file " + antFile);\r
Project p = new Project();\r
p.setUserProperty("ant.file", antFile.getAbsolutePath());\r
p.setBaseDir(antFile.getParentFile());\r
return registry;\r
}\r
\r
- /** Execute only the active paths of the Ant file. */\r
+ /** Executes only the active paths of the Ant file. */\r
public static void runActive(File antFile, List<StructurePath> activePaths) {\r
-\r
+ if (log.isDebugEnabled())\r
+ log.debug("Runs the " + activePaths.size()\r
+ + " provided active paths of Ant file " + antFile);\r
Project p = new Project();\r
p.setUserProperty("ant.file", antFile.getAbsolutePath());\r
p.setBaseDir(antFile.getParentFile());\r
p.executeTarget(p.getDefaultTarget());\r
}\r
\r
- /** Execute all paths of the default target of the Ant file. */\r
+ /** Executes all paths of the default target of the Ant file. */\r
public static void runAll(File antFile) {\r
+ if (log.isDebugEnabled())\r
+ log.debug("Runs all paths of Ant file " + antFile);\r
Project p = new Project();\r
p.setUserProperty("ant.file", antFile.getAbsolutePath());\r
p.setBaseDir(antFile.getParentFile());\r
helper.parse(p, antFile);\r
p.executeTarget(p.getDefaultTarget());\r
}\r
-\r
- public static void main(String[] args) {\r
- File antFile = new File(\r
- "C:/dev/workspaces/default/org.argeo.slc/src/test/slc/root/Category1/SubCategory2/build.xml");\r
- StructureRegistry registry = AntRegistryUtil.readRegistry(antFile);\r
-\r
- StringBuffer buf = new StringBuffer("");\r
-\r
- int count = 0;\r
- List<StructurePath> activePaths = new Vector<StructurePath>();\r
- for (StructurePath path : registry.listPaths()) {\r
- buf.append(path);\r
- if (count != 0 && count % 3 == 0) {\r
- // skip\r
- } else {\r
- activePaths.add(path);\r
- buf.append(" <");\r
- }\r
- buf.append('\n');\r
- count++;\r
- }\r
- log.info(buf);\r
-\r
- runActive(antFile, activePaths);\r
-\r
- }\r
}\r