Author: dkulp
Date: Thu Jun 12 10:26:49 2008
New Revision: 667169
URL: http://svn.apache.org/viewvc?rev=667169&view=rev
Log:
Merged revisions 667164 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r667164 | dkulp | 2008-06-12 13:10:46 -0400 (Thu, 12 Jun 2008) | 3 lines
[CXF-1646] Update xsd plugin to put .DONE files in separate directory so not
included in the jar
Update both plugins to use mangled full paths to wsdl/schema for the .DONE
marker.
........
Modified:
cxf/branches/2.0.x-fixes/ (props changed)
cxf/branches/2.0.x-fixes/common/xsd/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaMojo.java
cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.0.x-fixes/common/xsd/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaMojo.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/common/xsd/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaMojo.java?rev=667169&r1=667168&r2=667169&view=diff
==============================================================================
---
cxf/branches/2.0.x-fixes/common/xsd/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaMojo.java
(original)
+++
cxf/branches/2.0.x-fixes/common/xsd/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaMojo.java
Thu Jun 12 10:26:49 2008
@@ -20,6 +20,7 @@
package org.apache.cxf.maven_plugin;
import java.io.File;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -59,11 +60,20 @@
*/
XsdOption xsdOptions[];
+ /**
+ * Directory in which the "DONE" markers are saved that
+ * @parameter expression="${cxf.markerDirectory}"
+ *
default-value="${project.build.directory}/cxf-xsd-plugin-markers"
+ */
+ File markerDirectory;
+
+
public void execute() throws MojoExecutionException {
String outputDir = testSourceRoot == null ? sourceRoot :
testSourceRoot;
File outputDirFile = new File(outputDir);
outputDirFile.mkdirs();
-
+ markerDirectory.mkdirs();
+
long timestamp = CodegenUtils.getCodegenTimestamp();
boolean result = true;
@@ -74,12 +84,37 @@
for (int x = 0; x < xsdOptions.length; x++) {
String[] args = getArguments(xsdOptions[x], outputDir);
- File file = new File(xsdOptions[x].getXsd());
- File doneFile = new File(outputDirFile, "." + file.getName() +
".DONE");
+ String xsdLocation = xsdOptions[x].getXsd();
+ URI basedir = project.getBasedir().toURI();
+ URI xsdURI = basedir.resolve(xsdLocation);
+
+ String doneFileName = xsdURI.toString();
+ if (doneFileName.startsWith(basedir.toString())) {
+ doneFileName =
doneFileName.substring(basedir.toString().length());
+ }
+
+ doneFileName = doneFileName.replace('?', '_')
+ .replace('&', '_').replace('/', '_').replace('\\', '_');
+
+ // If URL to WSDL, replace ? and & since they're invalid chars for
file names
+ File doneFile =
+ new File(markerDirectory, "." + doneFileName + ".DONE");
+
+ long srctimestamp = 0;
+ if ("file".equals(xsdURI.getScheme())) {
+ srctimestamp = new File(xsdURI).lastModified();
+ } else {
+ try {
+ srctimestamp = xsdURI.toURL().openConnection().getDate();
+ } catch (Exception e) {
+ //ignore
+ }
+ }
+
boolean doWork = timestamp > doneFile.lastModified();
if (!doneFile.exists()) {
doWork = true;
- } else if (file.lastModified() > doneFile.lastModified()) {
+ } else if (srctimestamp > doneFile.lastModified()) {
doWork = true;
} else {
File files[] = xsdOptions[x].getDependencies();
Modified:
cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java?rev=667169&r1=667168&r2=667169&view=diff
==============================================================================
---
cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
(original)
+++
cxf/branches/2.0.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
Thu Jun 12 10:26:49 2008
@@ -21,6 +21,7 @@
import java.io.File;
import java.net.MalformedURLException;
+import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
@@ -111,7 +112,6 @@
*/
String excludes[];
-
private List<WsdlOption> getWsdlOptionsFromDir(final File root,
final File output)
throws MojoExecutionException {
@@ -262,14 +262,39 @@
File outputDirFile = wsdlOption.getOutputDir();
outputDirFile.mkdirs();
- File file = new File(wsdlOption.getWsdl());
+
+ String wsdlLocation = wsdlOption.getWsdl();
+ URI basedir = project.getBasedir().toURI();
+ URI wsdlURI = basedir.resolve(wsdlLocation);
+
+ String doneFileName = wsdlURI.toString();
+ if (doneFileName.startsWith(basedir.toString())) {
+ doneFileName = doneFileName.substring(basedir.toString().length());
+ }
+
+ doneFileName = doneFileName.replace('?', '_')
+ .replace('&', '_').replace('/', '_').replace('\\', '_');
+
// If URL to WSDL, replace ? and & since they're invalid chars for
file names
File doneFile =
- new File(markerDirectory, "." + file.getName().replace('?',
'_').replace('&', '_') + ".DONE");
+ new File(markerDirectory, "." + doneFileName + ".DONE");
+
+ long timestamp = 0;
+ if ("file".equals(wsdlURI.getScheme())) {
+ timestamp = new File(wsdlURI).lastModified();
+ } else {
+ try {
+ timestamp = wsdlURI.toURL().openConnection().getDate();
+ } catch (Exception e) {
+ //ignore
+ }
+ }
+
+
boolean doWork = cgtimestamp > doneFile.lastModified();
if (!doneFile.exists()) {
doWork = true;
- } else if (file.lastModified() > doneFile.lastModified()) {
+ } else if (timestamp > doneFile.lastModified()) {
doWork = true;
} else if (isDefServiceName(wsdlOption)) {
doWork = true;
@@ -306,7 +331,7 @@
list.add(it.next().toString());
}
}
- list.add(wsdlOption.getWsdl());
+ list.add(wsdlURI.toString());
getLog().debug("Calling wsdl2java with args: " + list);
try {