Author: Alex.Kolonitsky
Date: 2010-05-05 05:47:34 -0400 (Wed, 05 May 2010)
New Revision: 16894
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/TaskFactoryImpl.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMakerModule.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibWriter.java
Log:
RF-7826 Migrate A1 components to new CDK
remove logs
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java 2010-05-05
06:23:05 UTC (rev 16893)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java 2010-05-05
09:47:34 UTC (rev 16894)
@@ -121,7 +121,15 @@
new TemplateModule(),
new XmlModule(),
new TaglibModule());
-
+
+ if (!log.isDebugEnabled()) {
+ try {
+
freemarker.log.Logger.selectLoggerLibrary(freemarker.log.Logger.LIBRARY_NONE);
+ } catch (ClassNotFoundException e) {
+ // Do nothing.
+ }
+ }
+
// Create builder instance.
this.libraryBuilder = injector.getInstance(LibraryBuilder.class);
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/TaskFactoryImpl.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/TaskFactoryImpl.java 2010-05-05
06:23:05 UTC (rev 16893)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/TaskFactoryImpl.java 2010-05-05
09:47:34 UTC (rev 16894)
@@ -23,8 +23,6 @@
package org.richfaces.cdk.apt;
-import com.google.common.collect.ImmutableCollection;
-import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
import org.richfaces.cdk.CdkClassLoader;
import org.richfaces.cdk.CdkException;
@@ -48,7 +46,10 @@
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.List;
import java.util.Locale;
/**
@@ -83,9 +84,9 @@
}
}
- private static final ImmutableCollection<String> COMPILER_OPTIONS =
- ImmutableList.of("-proc:only", "-implicit:class"/*,
"-verbose"*/);
-
+ private static List<String> compilerOptions =
+ new ArrayList<String>(Arrays.asList("-proc:only",
"-implicit:class"));
+
@Inject
private Logger log;
@@ -125,8 +126,13 @@
diagnosticListener = new DiagnosticListenerImplementation();
Iterable<? extends JavaFileObject> sourceObjects = getFileManager()
.getJavaFileObjectsFromFiles(sourceFolders.getFiles());
+
+ if (log.isDebugEnabled()) {
+ compilerOptions.add("-verbose");
+ }
+
CompilationTask task = getJavaCompiler()
- .getTask(null, getFileManager(), diagnosticListener, COMPILER_OPTIONS,
null, sourceObjects);
+ .getTask(null, getFileManager(), diagnosticListener, compilerOptions,
null, sourceObjects);
task.setLocale(locale);
task.setProcessors(Collections.singleton(cdkProcessor));
return task;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMakerModule.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMakerModule.java 2010-05-05
06:23:05 UTC (rev 16893)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMakerModule.java 2010-05-05
09:47:34 UTC (rev 16894)
@@ -24,7 +24,6 @@
package org.richfaces.cdk.generate.freemarker;
import com.google.inject.AbstractModule;
-
import freemarker.template.Configuration;
import freemarker.template.ObjectWrapper;
@@ -35,9 +34,6 @@
*/
public class FreeMakerModule extends AbstractModule {
- /* (non-Javadoc)
- * @see com.google.inject.AbstractModule#configure()
- */
@Override
protected void configure() {
bind(Configuration.class).to(CdkConfiguration.class);
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibWriter.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibWriter.java 2010-05-05
06:23:05 UTC (rev 16893)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibWriter.java 2010-05-05
09:47:34 UTC (rev 16894)
@@ -23,6 +23,7 @@
package org.richfaces.cdk.generate.taglib;
import com.google.inject.Inject;
+import org.dom4j.Document;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import org.richfaces.cdk.CdkException;
@@ -57,12 +58,17 @@
TaglibGeneratorVisitor visitor = new
TaglibGeneratorVisitor(generator.getNamespace());
library.accept(visitor);
+ Document document = visitor.getDocument();
+ if (document.getRootElement().elements().isEmpty()) {
+ return;
+ }
+
try {
OutputFormat format1 = OutputFormat.createPrettyPrint();
format1.setIndentSize(4);
XMLWriter writer = new XMLWriter(getOutput(), format1);
- writer.write(visitor.getDocument());
+ writer.write(document);
writer.close();
} catch (IOException e) {
e.printStackTrace(); // TODO
Show replies by date