Author: nbelaevski
Date: 2009-08-18 08:26:30 -0400 (Tue, 18 Aug 2009)
New Revision: 15197
Added:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CompileTemplatesMojo.java
Removed:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/BuildLibraryMojo.java
Modified:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AbstractCDKMojo.java
Log:
CDK: renamed "build" task into "compile-templates"
Modified:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AbstractCDKMojo.java
===================================================================
---
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AbstractCDKMojo.java 2009-08-18
11:22:48 UTC (rev 15196)
+++
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AbstractCDKMojo.java 2009-08-18
12:26:30 UTC (rev 15197)
@@ -361,22 +361,22 @@
}
protected String[] doScan(String[] includes, String[] excludes, File rootFolder)
- throws MojoExecutionException {
- try {
- DirectoryScanner directoryScanner = new DirectoryScanner();
- directoryScanner.setFollowSymlinks(true);
- directoryScanner.setBasedir(rootFolder);
- directoryScanner.setExcludes(excludes);
- directoryScanner.setIncludes(includes);
- directoryScanner.addDefaultExcludes();
-
- directoryScanner.scan();
-
- return directoryScanner.getIncludedFiles();
- } catch (IllegalStateException e) {
- throw new MojoExecutionException(
- "Error scanning source root: \'" + rootFolder +
"\'", e );
- }
- }
+ throws MojoExecutionException {
+ try {
+ DirectoryScanner directoryScanner = new DirectoryScanner();
+ directoryScanner.setFollowSymlinks(true);
+ directoryScanner.setBasedir(rootFolder);
+ directoryScanner.setExcludes(excludes);
+ directoryScanner.setIncludes(includes);
+ directoryScanner.addDefaultExcludes();
+ directoryScanner.scan();
+
+ return directoryScanner.getIncludedFiles();
+ } catch (IllegalStateException e) {
+ throw new MojoExecutionException(
+ "Error scanning source root: \'" + rootFolder + "\'", e
);
+ }
+ }
+
}
Deleted:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/BuildLibraryMojo.java
===================================================================
---
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/BuildLibraryMojo.java 2009-08-18
11:22:48 UTC (rev 15196)
+++
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/BuildLibraryMojo.java 2009-08-18
12:26:30 UTC (rev 15197)
@@ -1,129 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.builder.mojo;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.PrintWriter;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.richfaces.builder.model.JavaClass;
-import org.richfaces.builder.render.JavaClassRenderer;
-import org.richfaces.builder.templates.TemplateReader;
-
-/**
- * @author Nick Belaevski
- * @goal build
- */
-public class BuildLibraryMojo extends AbstractCDKMojo {
-
- /**
- * templatesDirectory
- * @parameter expression="${basedir}/src/main/templates"
- */
- private File templatesDirectory;
-
- /**
- * sourceFileIncludes
- * @parameter
- */
- private String[] templateFileIncludes = {"**/*.template.xml"};
-
- /**
- * sourceFileExcludes
- * @parameter
- */
- private String[] templatesFileExcludes = null;
-
- /**
- * @param templatesDirectory the templatesDirectory to set
- */
- public void setTemplatesDirectory(File templatesDirectory) {
- this.templatesDirectory = templatesDirectory;
- }
-
- /**
- * @param templateFileIncludes the templateFileIncludes to set
- */
- public void setTemplateFileIncludes(String[] templateFileIncludes) {
- this.templateFileIncludes = templateFileIncludes;
- }
-
- /**
- * @param templatesFileExcludes the templatesFileExcludes to set
- */
- public void setTemplatesFileExcludes(String[] templatesFileExcludes) {
- this.templatesFileExcludes = templatesFileExcludes;
- }
-
- private Iterable<File> findTemplateFiles() throws MojoExecutionException {
- Set<File> sourceFiles = new HashSet<File>();
- if (templatesDirectory.exists() && templatesDirectory.isDirectory()) {
- for (String fileName : doScan(templateFileIncludes, templatesFileExcludes,
templatesDirectory)) {
- sourceFiles.add(new File(templatesDirectory, fileName));
- }
- }
-
- return sourceFiles;
- }
-
- protected void compileTemplates() throws MojoExecutionException, MojoFailureException {
- try {
- Iterable<File> templates = findTemplateFiles();
- for (File file : templates) {
- JavaClass javaClass = TemplateReader.parse(new FileInputStream(file));
-
- String fullName = javaClass.getFullName();
-
- File outFile = new File(outputJavaDirectory,
- fullName.replace('.', '/') + ".java");
-
- if (outFile.exists()) {
- outFile.delete();
- }
-
- outFile.getParentFile().mkdirs();
-
- new JavaClassRenderer().render(javaClass, new PrintWriter(outFile));
- }
- } catch (Exception e) {
- throw new MojoExecutionException(e.getMessage(), e);
- }
- }
-
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
- outputJavaDirectory.mkdirs();
- outputResourcesDirectory.mkdirs();
- outputTestsDirectory.mkdirs();
-
- project.addCompileSourceRoot(outputJavaDirectory.getAbsolutePath());
- project.addCompileSourceRoot(outputResourcesDirectory.getAbsolutePath());
- project.addTestCompileSourceRoot(outputTestsDirectory.getAbsolutePath());
-
- compileTemplates();
- }
-
-}
Copied:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CompileTemplatesMojo.java
(from rev 15190,
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/BuildLibraryMojo.java)
===================================================================
---
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CompileTemplatesMojo.java
(rev 0)
+++
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CompileTemplatesMojo.java 2009-08-18
12:26:30 UTC (rev 15197)
@@ -0,0 +1,129 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.builder.mojo;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.PrintWriter;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.richfaces.builder.model.JavaClass;
+import org.richfaces.builder.render.JavaClassRenderer;
+import org.richfaces.builder.templates.TemplateReader;
+
+/**
+ * @author Nick Belaevski
+ * @goal compile-templates
+ */
+public class CompileTemplatesMojo extends AbstractCDKMojo {
+
+ /**
+ * templatesDirectory
+ * @parameter expression="${basedir}/src/main/templates"
+ */
+ private File templatesDirectory;
+
+ /**
+ * sourceFileIncludes
+ * @parameter
+ */
+ private String[] templateFileIncludes = {"**/*.template.xml"};
+
+ /**
+ * sourceFileExcludes
+ * @parameter
+ */
+ private String[] templatesFileExcludes = null;
+
+ /**
+ * @param templatesDirectory the templatesDirectory to set
+ */
+ public void setTemplatesDirectory(File templatesDirectory) {
+ this.templatesDirectory = templatesDirectory;
+ }
+
+ /**
+ * @param templateFileIncludes the templateFileIncludes to set
+ */
+ public void setTemplateFileIncludes(String[] templateFileIncludes) {
+ this.templateFileIncludes = templateFileIncludes;
+ }
+
+ /**
+ * @param templatesFileExcludes the templatesFileExcludes to set
+ */
+ public void setTemplatesFileExcludes(String[] templatesFileExcludes) {
+ this.templatesFileExcludes = templatesFileExcludes;
+ }
+
+ private Iterable<File> findTemplateFiles() throws MojoExecutionException {
+ Set<File> sourceFiles = new HashSet<File>();
+ if (templatesDirectory.exists() && templatesDirectory.isDirectory()) {
+ for (String fileName : doScan(templateFileIncludes, templatesFileExcludes,
templatesDirectory)) {
+ sourceFiles.add(new File(templatesDirectory, fileName));
+ }
+ }
+
+ return sourceFiles;
+ }
+
+ protected void compileTemplates() throws MojoExecutionException, MojoFailureException {
+ try {
+ Iterable<File> templates = findTemplateFiles();
+ for (File file : templates) {
+ JavaClass javaClass = TemplateReader.parse(new FileInputStream(file));
+
+ String fullName = javaClass.getFullName();
+
+ File outFile = new File(outputJavaDirectory,
+ fullName.replace('.', '/') + ".java");
+
+ if (outFile.exists()) {
+ outFile.delete();
+ }
+
+ outFile.getParentFile().mkdirs();
+
+ new JavaClassRenderer().render(javaClass, new PrintWriter(outFile));
+ }
+ } catch (Exception e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ outputJavaDirectory.mkdirs();
+ outputResourcesDirectory.mkdirs();
+ outputTestsDirectory.mkdirs();
+
+ project.addCompileSourceRoot(outputJavaDirectory.getAbsolutePath());
+ project.addCompileSourceRoot(outputResourcesDirectory.getAbsolutePath());
+ project.addTestCompileSourceRoot(outputTestsDirectory.getAbsolutePath());
+
+ compileTemplates();
+ }
+
+}