Author: tchemit Date: 2008-07-22 16:40:01 +0000 (Tue, 22 Jul 2008) New Revision: 753 Modified: trunk/lutinjaxx/core/pom.xml trunk/lutinjaxx/core/src/main/java/jaxx/compiler/JAXXCompiler.java trunk/lutinjaxx/maven/src/main/resources/log4j.properties trunk/lutinjaxx/pom.xml Log: des logs dans jaxx :) Modified: trunk/lutinjaxx/core/pom.xml =================================================================== --- trunk/lutinjaxx/core/pom.xml 2008-07-22 15:39:01 UTC (rev 752) +++ trunk/lutinjaxx/core/pom.xml 2008-07-22 16:40:01 UTC (rev 753) @@ -26,6 +26,11 @@ <dependencies> <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + + <dependency> <groupId>org.codelutin.jaxx</groupId> <artifactId>util</artifactId> </dependency> Modified: trunk/lutinjaxx/core/src/main/java/jaxx/compiler/JAXXCompiler.java =================================================================== --- trunk/lutinjaxx/core/src/main/java/jaxx/compiler/JAXXCompiler.java 2008-07-22 15:39:01 UTC (rev 752) +++ trunk/lutinjaxx/core/src/main/java/jaxx/compiler/JAXXCompiler.java 2008-07-22 16:40:01 UTC (rev 753) @@ -23,6 +23,8 @@ import jaxx.tags.TagHandler; import jaxx.tags.TagManager; import jaxx.types.TypeManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.Attributes; @@ -65,15 +67,18 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.ServiceLoader; import java.util.Set; import java.util.Stack; -import java.util.ServiceLoader; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.zip.GZIPOutputStream; /** Compiles JAXX files into Java classes. */ public class JAXXCompiler { + /** log */ + protected static final Log log = LogFactory.getLog(JAXXCompiler.class); + /** * True to throw exceptions when we encounter unresolvable classes, false to ignore. * This is currently set to false until JAXX has full support for inner classes @@ -253,7 +258,9 @@ public static void loadLibraries() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException { ServiceLoader<Initializer> loader = ServiceLoader.load(Initializer.class); for (Initializer initializer : loader) { - System.out.println("load initializer "+initializer); + if (log.isDebugEnabled()) { + log.debug("load initializer " + initializer); + } initializer.initialize(); } } @@ -787,8 +794,7 @@ CompiledObject parent = components[i].getParent(); while (parent != null) { boolean found = false; - for (int j = i + 1; j < components.length; j++) - { // found parent after component, swap them + for (int j = i + 1; j < components.length; j++) { // found parent after component, swap them if (components[j] == parent) { components[j] = components[i]; components[i] = parent; @@ -1411,7 +1417,7 @@ } script = script.trim(); if (!"".equals(script) && !script.endsWith("}") && !script.endsWith(";")) { - script +=";"; + script += ";"; } scriptManager.registerScript(script); @@ -1432,8 +1438,7 @@ public void registerStylesheet(Stylesheet stylesheet) { if (this.stylesheet == null) { this.stylesheet = stylesheet; - } - else { + } else { this.stylesheet.add(stylesheet.getRules()); } } @@ -1515,8 +1520,7 @@ int lineOffset; if (ex instanceof ParseException) { lineOffset = Math.max(0, ((ParseException) ex).getLine() - 1); - } - else { + } else { lineOffset = 0; } Element currentTag = null; @@ -1784,6 +1788,9 @@ while (filesIterator.hasNext()) { File file = filesIterator.next(); String className = classNamesIterator.next(); + if (log.isDebugEnabled()) { + log.debug("compile first pass for " + className); + } if (symbolTables.get(file) == null) { compiled = true; if (compilers.containsKey(className)) { @@ -1811,8 +1818,7 @@ } } - } - while (compiled); + } while (compiled); // pass 2 currentPass = PASS_2; @@ -1823,9 +1829,15 @@ JAXXCompiler compiler = compilers.get(className); if (compiler == null) throw new CompilerException("Internal error: could not find compiler for " + className + " during second pass"); + if (log.isDebugEnabled()) { + log.debug("compile second pass for " + className); + } if (!compiler.failed) { compiler.runInitializers(); } + if (log.isDebugEnabled()) { + log.debug("compile first pass for " + className); + } compiler.compileSecondPass(); if (!compiler.failed) { } else { @@ -1941,15 +1953,13 @@ } else if (arg[i].equals("-cp") || arg[i].equals("-classpath")) { if (++i < arg.length) { options.setClassPath(arg[i]); - } - else { + } else { success = false; } } else if (arg[i].equals("-javac_opts")) { if (++i < arg.length) { options.setJavacOpts(arg[i]); - } - else { + } else { success = false; } } else if (arg[i].equals("-k") || arg[i].equals("-keep")) @@ -1962,8 +1972,7 @@ System.err.println("jaxxc version " + getVersion() + " by Ethan Nicholas"); System.err.println("http://www.jaxxframework.org/"); System.exit(0); - } else - if (arg[i].equals("-internalDumpVersion")) { // used by ant to extract the version info + } else if (arg[i].equals("-internalDumpVersion")) { // used by ant to extract the version info System.out.println("jaxx.version=" + getVersion()); return; } else { @@ -1975,8 +1984,7 @@ if (success) { success = compile(new File("."), files.toArray(new String[files.size()]), options); - } - else { + } else { showUsage(); System.exit(1); } Modified: trunk/lutinjaxx/maven/src/main/resources/log4j.properties =================================================================== --- trunk/lutinjaxx/maven/src/main/resources/log4j.properties 2008-07-22 15:39:01 UTC (rev 752) +++ trunk/lutinjaxx/maven/src/main/resources/log4j.properties 2008-07-22 16:40:01 UTC (rev 753) @@ -4,4 +4,6 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n -file:///home/tony/.m2/repository/lutinlib/lutinproject/2.2/lutinproject-2.2.pom + +log4j.logger.org.codelutin.jaxx=DEBUG +log4j.logger.jaxx=DEBUG Modified: trunk/lutinjaxx/pom.xml =================================================================== --- trunk/lutinjaxx/pom.xml 2008-07-22 15:39:01 UTC (rev 752) +++ trunk/lutinjaxx/pom.xml 2008-07-22 16:40:01 UTC (rev 753) @@ -182,37 +182,45 @@ <dependency> <groupId>org.codelutin.jaxx</groupId> <artifactId>util</artifactId> - <version>0.2-SNAPSHOT</version> + <version>${current.version}</version> </dependency> <dependency> <groupId>org.codelutin.jaxx</groupId> <artifactId>core</artifactId> - <version>0.2-SNAPSHOT</version> + <version>${current.version}</version> </dependency> <dependency> <groupId>org.codelutin.jaxx</groupId> <artifactId>runtime</artifactId> - <version>0.2-SNAPSHOT</version> + <version>${current.version}</version> </dependency> <dependency> <groupId>org.codelutin.jaxx</groupId> <artifactId>jaxx-swing</artifactId> - <version>0.2-SNAPSHOT</version> + <version>${current.version}</version> </dependency> <dependency> <groupId>org.codelutin.jaxx</groupId> <artifactId>jaxx-swing-action</artifactId> - <version>0.2-SNAPSHOT</version> + <version>${current.version}</version> </dependency> <dependency> <groupId>org.codelutin.jaxx</groupId> <artifactId>jaxx-swing-tab</artifactId> - <version>0.2-SNAPSHOT</version> + <version>${current.version}</version> </dependency> <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>1.1</version> + <scope>compile</scope> + </dependency> + + + <dependency> <groupId>com.sun</groupId> <artifactId>dt</artifactId> <version>${java.version}</version>