Author: dkulp
Date: Thu Nov 8 15:21:16 2012
New Revision: 1407121
URL: http://svn.apache.org/viewvc?rev=1407121&view=rev
Log:
Merged revisions 1406332 via git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1406332 | dkulp | 2012-11-06 16:08:15 -0500 (Tue, 06 Nov 2012) | 2 lines
Record the options used for the wsdl into the .DONE file and compare them on
next run to allow changes to the pom to trigger regeneration of code.
........
Modified:
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
Modified:
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java?rev=1407121&r1=1407120&r2=1407121&view=diff
==============================================================================
---
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
(original)
+++
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
Thu Nov 8 15:21:16 2012
@@ -434,7 +434,7 @@ public abstract class AbstractCodegenMoh
URI wsdlURI = getWsdlURI(wsdlOption, basedir);
File doneFile = getDoneFile(basedir, wsdlURI, getMarkerSuffix());
try {
- doneFile.createNewFile();
+ createMarkerFile(wsdlOption, doneFile, wsdlURI);
} catch (Throwable e) {
getLog().warn("Could not create marker file " +
doneFile.getAbsolutePath());
getLog().debug(e);
@@ -570,6 +570,9 @@ public abstract class AbstractCodegenMoh
*/
protected abstract boolean shouldRun(GenericWsdlOption wsdlOption, File
doneFile, URI wsdlURI);
+ protected void createMarkerFile(GenericWsdlOption wsdlOption, File
doneFile, URI wsdlURI) throws IOException {
+ doneFile.createNewFile();
+ }
private String[] createForkOnceArgs(List<List<String>> wargs) throws
MojoExecutionException {
try {
Modified:
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java?rev=1407121&r1=1407120&r2=1407121&view=diff
==============================================================================
---
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java
(original)
+++
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2java/WSDL2JavaMojo.java
Thu Nov 8 15:21:16 2012
@@ -19,7 +19,11 @@
package org.apache.cxf.maven_plugin.wsdl2java;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
@@ -238,8 +242,41 @@ public class WSDL2JavaMojo extends Abstr
}
}
}
+ if (!doWork) {
+ URI basedir = project.getBasedir().toURI();
+ String options = wsdlOption.generateCommandLine(null, basedir,
wsdlURI, false).toString();
+ DataInputStream reader = null;
+ try {
+ reader = new DataInputStream(new FileInputStream(doneFile));
+ String s = reader.readUTF();
+ if (!options.equals(s)) {
+ doWork = true;
+ }
+ } catch (Exception ex) {
+ //ignore
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ //ignore
+ }
+ }
+ }
+ }
return doWork;
}
+
+ protected void createMarkerFile(GenericWsdlOption wsdlOption, File
doneFile, URI wsdlURI) throws IOException {
+ doneFile.createNewFile();
+ URI basedir = project.getBasedir().toURI();
+ String options = wsdlOption.generateCommandLine(null, basedir,
wsdlURI, false).toString();
+ DataOutputStream writer = new DataOutputStream(new
FileOutputStream(doneFile));
+ writer.writeUTF(options);
+ writer.flush();
+ writer.close();
+ }
+
/**
* Finds the timestamp for a given URI. Calls {@link #getBaseFileURI(URI)}
prior to the timestamp
@@ -407,7 +444,7 @@ public class WSDL2JavaMojo extends Abstr
try {
- doneFile.createNewFile();
+ createMarkerFile(wsdlOption, doneFile, wsdlURI);
buildContext.refresh(doneFile);
} catch (Throwable e) {
getLog().warn("Could not create marker file " +
doneFile.getAbsolutePath());
Modified:
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java?rev=1407121&r1=1407120&r2=1407121&view=diff
==============================================================================
---
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
(original)
+++
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/wsdl2js/WSDL2JavaScriptMojo.java
Thu Nov 8 15:21:16 2012
@@ -136,7 +136,7 @@ public class WSDL2JavaScriptMojo extends
}
try {
- doneFile.createNewFile();
+ createMarkerFile(wsdlOption, doneFile, wsdlURI);
} catch (Throwable e) {
getLog().warn("Could not create marker file " +
doneFile.getAbsolutePath());
getLog().debug(e);