Author: bimargulies
Date: Mon Mar 24 21:36:12 2008
New Revision: 640696
URL: http://svn.apache.org/viewvc?rev=640696&view=rev
Log:
Start generating fastinfoset XML files for all of the CXF spring files.
Nothing reads them, yet.
Modified:
incubator/cxf/trunk/maven-plugins/pom.xml
incubator/cxf/trunk/maven-plugins/xml2fastinfoset-plugin/ (props changed)
incubator/cxf/trunk/maven-plugins/xml2fastinfoset-plugin/pom.xml
incubator/cxf/trunk/maven-plugins/xml2fastinfoset-plugin/src/main/java/org/apache/cxf/maven_plugin/xml2fastinfoset/XML2FastInfosetCompilerMojo.java
incubator/cxf/trunk/parent/pom.xml
incubator/cxf/trunk/pom.xml
Modified: incubator/cxf/trunk/maven-plugins/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/maven-plugins/pom.xml?rev=640696&r1=640695&r2=640696&view=diff
==============================================================================
--- incubator/cxf/trunk/maven-plugins/pom.xml (original)
+++ incubator/cxf/trunk/maven-plugins/pom.xml Mon Mar 24 21:36:12 2008
@@ -37,7 +37,6 @@
<module>corba</module>
<module>archetypes</module>
<module>eclipse-plugin-generator</module>
- <module>xml2fastinfoset-plugin</module>
</modules>
</project>
Propchange: incubator/cxf/trunk/maven-plugins/xml2fastinfoset-plugin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar 24 21:36:12 2008
@@ -0,0 +1 @@
+target
Modified: incubator/cxf/trunk/maven-plugins/xml2fastinfoset-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/maven-plugins/xml2fastinfoset-plugin/pom.xml?rev=640696&r1=640695&r2=640696&view=diff
==============================================================================
--- incubator/cxf/trunk/maven-plugins/xml2fastinfoset-plugin/pom.xml (original)
+++ incubator/cxf/trunk/maven-plugins/xml2fastinfoset-plugin/pom.xml Mon Mar 24
21:36:12 2008
@@ -29,44 +29,35 @@
<maven>2.0</maven>
</prerequisites>
- <parent>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-parent</artifactId>
- <version>2.1-incubator-SNAPSHOT</version>
- <relativePath>../../parent/pom.xml</relativePath>
- </parent>
-
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
+ <version>4.4</version>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
+ <version>2.0.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
+ <version>2.0.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
+ <version>2.0.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.0.4</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-compiler-api</artifactId>
- <version>1.5.3</version>
</dependency>
<dependency>
<groupId>com.sun.xml.fastinfoset</groupId>
Modified:
incubator/cxf/trunk/maven-plugins/xml2fastinfoset-plugin/src/main/java/org/apache/cxf/maven_plugin/xml2fastinfoset/XML2FastInfosetCompilerMojo.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/maven-plugins/xml2fastinfoset-plugin/src/main/java/org/apache/cxf/maven_plugin/xml2fastinfoset/XML2FastInfosetCompilerMojo.java?rev=640696&r1=640695&r2=640696&view=diff
==============================================================================
---
incubator/cxf/trunk/maven-plugins/xml2fastinfoset-plugin/src/main/java/org/apache/cxf/maven_plugin/xml2fastinfoset/XML2FastInfosetCompilerMojo.java
(original)
+++
incubator/cxf/trunk/maven-plugins/xml2fastinfoset-plugin/src/main/java/org/apache/cxf/maven_plugin/xml2fastinfoset/XML2FastInfosetCompilerMojo.java
Mon Mar 24 21:36:12 2008
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -42,11 +43,7 @@
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
-import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
-import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
-import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
-import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
+import org.codehaus.plexus.util.DirectoryScanner;
/**
* Compile XML resources to FastInfoset XML resources.
@@ -55,6 +52,8 @@
* @phase process-resources
*/
public class XML2FastInfosetCompilerMojo extends AbstractMojo {
+ private static final String[] EMPTY_STRING_ARRAY = {};
+ private static final String[] DEFAULT_INCLUDES = {"**/*.xml"};
/**
* @parameter expression="${project}"
@@ -91,30 +90,12 @@
*
* @parameter expression="${project.build.outputDirectory}"
* @required
- * @readonly
*/
private File outputDirectory;
@SuppressWarnings("unchecked")
public void execute() throws MojoExecutionException {
- SourceInclusionScanner scanner = null;
-
- if (includes.isEmpty() && excludes.isEmpty()) {
- scanner = new StaleSourceScanner(0);
- } else {
- if (includes.isEmpty()) {
- includes.add("**/*.xml");
- }
- scanner = new StaleSourceScanner(0, includes, excludes);
- }
-
- SourceMapping mapping;
- mapping = new SuffixMapping(".xml", ".fixml");
- scanner.addSourceMapping(mapping);
-
- Set staleSources = new HashSet();
-
for (Iterator it = resources.iterator(); it.hasNext();) {
Resource resource = (Resource)it.next();
String targetPath = resource.getTargetPath();
@@ -132,33 +113,44 @@
// this part is required in case the user specified "../something"
// as destination
// see MNG-1345
- if (!outputDirectory.exists()
- && !outputDirectory.mkdirs()) {
+ if (!outputDirectory.exists() && !outputDirectory.mkdirs()) {
throw new MojoExecutionException("Cannot create resource
output directory: "
- + outputDirectory);
+ + outputDirectory);
}
- try {
-
staleSources.addAll(scanner.getIncludedSources(resourceDirectory,
outputDirectory));
- } catch (InclusionScanException e) {
- throw new MojoExecutionException("Error scanning source root:
\'" + resourceDirectory + "\' "
- + "for stale files to
recompile.", e);
+ DirectoryScanner scanner = new DirectoryScanner();
+
+ scanner.setBasedir(resourceDirectory);
+ if (includes != null && !includes.isEmpty()) {
+
scanner.setIncludes((String[])includes.toArray(EMPTY_STRING_ARRAY));
+ } else {
+ scanner.setIncludes(DEFAULT_INCLUDES);
}
- for (Iterator j = staleSources.iterator(); j.hasNext();) {
- File source = (File)j.next();
-
- // the source pathname has to be in common with the
- // source directory.
-
- String name =
source.getPath().substring(resourceDirectory.getPath().length() + 1);
- String destination = name;
+ if (excludes != null && !excludes.isEmpty()) {
+
scanner.setExcludes((String[])excludes.toArray(EMPTY_STRING_ARRAY));
+ }
+
+ scanner.addDefaultExcludes();
+ scanner.scan();
+
+ List includedFiles = Arrays.asList(scanner.getIncludedFiles());
+
+ getLog().info(
+ "FastInfosetting " + includedFiles.size() + "
resource"
+ + (includedFiles.size() > 1 ? "s" : "")
+ + (targetPath == null ? "" : " to " +
targetPath));
+
+ for (Iterator j = includedFiles.iterator(); j.hasNext();) {
+ String name = (String)j.next();
+
+ String destination = name.replaceFirst("\\.xml$", ".fixml");
if (targetPath != null) {
destination = targetPath + "/" + name;
}
- destination = destination.replaceFirst("\\.xml$", ".fixml");
+ File source = new File(resourceDirectory, name);
File destinationFile = new File(outputDirectory, destination);
Modified: incubator/cxf/trunk/parent/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/parent/pom.xml?rev=640696&r1=640695&r2=640696&view=diff
==============================================================================
--- incubator/cxf/trunk/parent/pom.xml (original)
+++ incubator/cxf/trunk/parent/pom.xml Mon Mar 24 21:36:12 2008
@@ -283,6 +283,24 @@
</plugins>
</pluginManagement>
<plugins>
+ <plugin>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-xml2fastinfoset-plugin</artifactId>
+ <version>${project.version}</version>
+ <configuration>
+
<includes><include>META-INF/cxf/cxf*.xml</include></includes>
+
<outputDirectory>target/generated/src/main/resources</outputDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>xml2fastinfoset</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>xml2fastinfoset</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.0</version>
@@ -961,6 +979,14 @@
<maven.test.skip>true</maven.test.skip>
</properties>
</profile>
+
+ <profile>
+ <id>nospringvalidation</id>
+ <properties>
+ <spring.validation.mode>VALIDATION_NONE</spring.validation.mode>
+ </properties>
+ </profile>
+
<profile>
<id>nochecks</id>
</profile>
Modified: incubator/cxf/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/pom.xml?rev=640696&r1=640695&r2=640696&view=diff
==============================================================================
--- incubator/cxf/trunk/pom.xml (original)
+++ incubator/cxf/trunk/pom.xml Mon Mar 24 21:36:12 2008
@@ -127,6 +127,7 @@
<modules>
<module>buildtools</module>
+ <module>maven-plugins/xml2fastinfoset-plugin</module>
<module>parent</module>
<module>common</module>
<module>api</module>