X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fant%2FAntRegistryUtil.java;fp=org.argeo.slc%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fant%2FAntRegistryUtil.java;h=872dd9cc1bd17432ff2b1ae076817810ce63e1d0;hb=1a85bfb58f79c5f85b86f8b77aeed8eb0bbe238e;hp=7b827935b02d94b558f7f7fafea230e190e985a6;hpb=a29c28266fef35c1620f6582ec182bad7f7f85ae;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/ant/AntRegistryUtil.java b/org.argeo.slc/src/main/java/org/argeo/slc/ant/AntRegistryUtil.java index 7b827935b..872dd9cc1 100644 --- a/org.argeo.slc/src/main/java/org/argeo/slc/ant/AntRegistryUtil.java +++ b/org.argeo.slc/src/main/java/org/argeo/slc/ant/AntRegistryUtil.java @@ -2,7 +2,6 @@ package org.argeo.slc.ant; import java.io.File; import java.util.List; -import java.util.Vector; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -16,9 +15,10 @@ import org.argeo.slc.core.structure.StructureRegistry; public class AntRegistryUtil { private static Log log = LogFactory.getLog(AntRegistryUtil.class); - /** Read a structure registry from an Ant file without executing it. */ + /** Reads a structure registry from an Ant file without executing it. */ public static StructureRegistry readRegistry(File antFile) { - + if (log.isDebugEnabled()) + log.debug("Reads registry for Ant file " + antFile); Project p = new Project(); p.setUserProperty("ant.file", antFile.getAbsolutePath()); p.setBaseDir(antFile.getParentFile()); @@ -35,9 +35,11 @@ public class AntRegistryUtil { return registry; } - /** Execute only the active paths of the Ant file. */ + /** Executes only the active paths of the Ant file. */ public static void runActive(File antFile, List activePaths) { - + if (log.isDebugEnabled()) + log.debug("Runs the " + activePaths.size() + + " provided active paths of Ant file " + antFile); Project p = new Project(); p.setUserProperty("ant.file", antFile.getAbsolutePath()); p.setBaseDir(antFile.getParentFile()); @@ -53,8 +55,10 @@ public class AntRegistryUtil { p.executeTarget(p.getDefaultTarget()); } - /** Execute all paths of the default target of the Ant file. */ + /** Executes all paths of the default target of the Ant file. */ public static void runAll(File antFile) { + if (log.isDebugEnabled()) + log.debug("Runs all paths of Ant file " + antFile); Project p = new Project(); p.setUserProperty("ant.file", antFile.getAbsolutePath()); p.setBaseDir(antFile.getParentFile()); @@ -64,30 +68,4 @@ public class AntRegistryUtil { helper.parse(p, antFile); p.executeTarget(p.getDefaultTarget()); } - - public static void main(String[] args) { - File antFile = new File( - "C:/dev/workspaces/default/org.argeo.slc/src/test/slc/root/Category1/SubCategory2/build.xml"); - StructureRegistry registry = AntRegistryUtil.readRegistry(antFile); - - StringBuffer buf = new StringBuffer(""); - - int count = 0; - List activePaths = new Vector(); - for (StructurePath path : registry.listPaths()) { - buf.append(path); - if (count != 0 && count % 3 == 0) { - // skip - } else { - activePaths.add(path); - buf.append(" <"); - } - buf.append('\n'); - count++; - } - log.info(buf); - - runActive(antFile, activePaths); - - } }