You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2018/04/23 11:46:08 UTC

[GitHub] coheigea closed pull request #410: [CXF-7711] add master's compile instance changes to JavaToWS to branc…

coheigea closed pull request #410: [CXF-7711] add master's compile instance changes to JavaToWS to branc…
URL: https://github.com/apache/cxf/pull/410
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWS.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWS.java
index 888e28f7e95..db3c6a06634 100644
--- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWS.java
+++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWS.java
@@ -24,6 +24,7 @@
 
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.tools.common.CommandInterfaceUtils;
+import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.toolspec.ToolRunner;
 
 public class JavaToWS {
@@ -83,7 +84,18 @@ public void run(OutputStream os) throws Exception {
         ToolRunner.runTool(JavaToWSContainer.class, JavaToWSContainer.class
                            .getResourceAsStream("java2ws.xml"), false, args, os);      
     }
-    
+
+    /**
+     * Pass user app's (compiler) information in the context.
+     * @param context
+     * @param os
+     * @throws Exception
+     */
+    public void run(ToolContext context, OutputStream os) throws Exception {
+        ToolRunner.runTool(JavaToWSContainer.class,
+                JavaToWSContainer.class.getResourceAsStream("java2ws.xml"),
+                false, args, isExitOnFinish(), context, os);
+    }
 
     private boolean isExitOnFinish() {
         String exit = System.getProperty("exitOnFinish");
@@ -92,7 +104,5 @@ private boolean isExitOnFinish() {
         }
         return "YES".equalsIgnoreCase(exit) || "TRUE".equalsIgnoreCase(exit);
     }
-    
-    
 
 }
diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
index 3e4d030692f..666d38dd87f 100644
--- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
+++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
@@ -52,6 +52,12 @@ public void execute(boolean exitOnFinish) throws ToolException {
             if (!hasInfoOption()) {
                 ToolContext env = new ToolContext();
                 env.setParameters(getParametersMap(new HashSet<String>()));
+
+                // check for custom compiler object to pass on
+                if (getContext() != null && getContext().get(ToolConstants.COMPILER) != null) {
+                    env.put(ToolConstants.COMPILER, getContext().get(ToolConstants.COMPILER));
+                }
+
                 if (env.get(ToolConstants.CFG_OUTPUTDIR) == null) {
                     env.put(ToolConstants.CFG_OUTPUTDIR, ".");
                 }
diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java
index ca5683fd710..3a03af5f8a1 100644
--- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java
+++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java
@@ -80,20 +80,18 @@ public void generateAndCompile(Collection<JavaClass> wrapperClasses, File dir) {
             
                 generator.clearAttributes();
             }
-        
-                //compile the classes
-            Compiler compiler = new Compiler();
+
+            //compile the classes
+            Compiler compiler = (Compiler)getToolContext().get(ToolConstants.COMPILER);
+            if (compiler == null) {
+                compiler = new Compiler();
+            }
             compiler.setOutputDir(compileToDir);
             List<String> files = new ArrayList<String>(generatedFiles.size());
             for (File file : generatedFiles) {
                 files.add(file.getAbsolutePath());
             }
-            if (!compiler.compileFiles(files.toArray(new String[files.size()]))) {
-                // TODO - compile issue
-            }
-
-            
-            
+            compiler.compileFiles(files.toArray(new String[files.size()]));
         } catch (Exception e) {
             e.printStackTrace();
         }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services