Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java diff -u maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java:1.1 maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java:1.2 --- maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java:1.1 Sat Jan 5 13:06:51 2008 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java Fri Jan 11 22:57:43 2008 @@ -22,11 +22,13 @@ import org.apache.maven.plugin.MojoFailureException; import org.codelutin.i18n.plugin.ui.KeysModifier; import org.codelutin.util.FileUtil; -import org.codelutin.util.StringUtil; import java.io.File; import java.io.FileInputStream; import java.util.Properties; +import java.util.List; +import java.util.ArrayList; +import java.util.Arrays; /** * Abstract implementation for parsing goal. @@ -51,24 +53,22 @@ protected abstract File getDefaultBasedir(); /** + * @description treate default entry + * @parameter expression="${i18n.treateDefault}" default-value="true" + */ + protected boolean treateDefaultEntry; + + /** * @description Source entries (src+includes+excludes) . * @parameter expression="${i18n.entries}" */ protected SourceEntry[] entries; - /** - * @description verbose - * @parameter expression="${maven.verbose}" - * @readonly - */ - protected boolean verbose; - protected Properties result; protected Properties oldParser; protected Properties oldLanguage; protected int fileTreated = 0; - protected long t0; public void init() { @@ -90,7 +90,10 @@ public void execute() throws MojoExecutionException, MojoFailureException { init(); - + if (entries == null || entries.length == 0 && !treateDefaultEntry) { + // nothing to do + return; + } try { // Reprise sur un ancien parsing File oldParserFile = new File(out.getAbsolutePath() + File.separatorChar + getOutGetter()); @@ -120,12 +123,17 @@ } public void parse() { - if (entries == null || entries.length == 0) { - // add the default sourceEntry - entries = new SourceEntry[]{new SourceEntry()}; + if (treateDefaultEntry) { + addDefaultEntry(); } long t00 = System.nanoTime(); for (SourceEntry entry : entries) { + if (!entry.useForGoal(getClass().getSimpleName())) { + if (verbose) { + log.debug("skip entry "+entry.toString()); + } + continue; + } // get found files String[] foundFiles = entry.getIncludedFiles(getDefaultBasedir(), getDefaultIncludes()); long t000 = System.nanoTime(); @@ -141,6 +149,18 @@ } } + protected void addDefaultEntry() { + List list; + + if (entries==null|| entries.length==0) { + list = new ArrayList(); + } else { + list = new ArrayList(Arrays.asList(entries)); + } + list.add(new SourceEntry()); + entries = list.toArray(new SourceEntry[list.size()]); + } + protected void parseEntry(File basedir, String[] files) { long t00 = System.nanoTime(); for (int i = 0; i < files.length; i++) { @@ -160,17 +180,4 @@ } } } - - protected String getLogEntry(String msg, int nbFiles, long time, long all) { - long now = System.nanoTime(); - long delta = now - time; - String s = getClass().getSimpleName() + " : " + msg; - if (time > 0) { - s += " (" + StringUtil.convertTime(delta) + ")"; - } - if (all > 0 && nbFiles>-1) { - s += "(total time:" + StringUtil.convertTime(now - all) + ") ( ~ " + StringUtil.convertTime(((now - all) / (nbFiles + 1))) + " /file)"; - } - return s; - } }