Author: donaldp
Date: Tue Apr 30 05:48:53 2013
New Revision: 1477480

URL: http://svn.apache.org/r1477480
Log:
Make the location of the wsdl in generated source configurable in the wsgen 
addon.

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/addon/buildr/wsgen.rb

Modified: buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1477480&r1=1477479&r2=1477480&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Tue Apr 30 05:48:53 2013
@@ -2,6 +2,8 @@
 * Fixed:  BUILDR-666 ZipFile.open modifies file regardless of usage.
           Reported by Pepijn Van Eeckhoudt, fix by Alex Boisvert.
 * Change: Moved to using TravisCI to test the Linux variants.
+* Added:  Make the location of the wsdl in generated source configurable
+          in the wsgen addon.
 * Added:  When generating the GWT facet for Intellij IDEA modules, use
           the gwt-dev maven artifact dependency if present as the SDK,
           falling back to the existing behaviour if not possible.

Modified: buildr/trunk/addon/buildr/wsgen.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/addon/buildr/wsgen.rb?rev=1477480&r1=1477479&r2=1477480&view=diff
==============================================================================
--- buildr/trunk/addon/buildr/wsgen.rb (original)
+++ buildr/trunk/addon/buildr/wsgen.rb Tue Apr 30 05:48:53 2013
@@ -126,6 +126,7 @@ module Buildr
       #  Buildr::Wsgen.wsdl2java(project, {_('src/main/wsdl/MyService.wsdl') 
=> {:package => 'com.example'}})
       #  Buildr::Wsgen.wsdl2java(project, {_('src/main/wsdl/MyService.wsdl') 
=> {:output_dir => _(:target, :wsdl, :java)}})
       #  Buildr::Wsgen.wsdl2java(project, {_('src/main/wsdl/MyService.wsdl') 
=> {}}, :package => 'com.example' )
+      #  Buildr::Wsgen.wsdl2java(project, {_('src/main/wsdl/MyService.wsdl') 
=> {}}, :wsdl_location => 'file:META-INF/wsdl/SpecificTaskService.wsdl' )
       def wsdl2java(project, wsdls, options = {})
         desc "Generate java from wsdl"
         project.task("wsdl2java")
@@ -139,10 +140,27 @@ module Buildr
         wsdls.each_pair do |wsdl_file, config|
           pkg = config[:package] || options[:package]
           service = config[:service] || File.basename(wsdl_file, '.wsdl')
+          wsdl_location = config[:wsdl_location]
           java_file = "#{ws_dir}/#{pkg.gsub('.', '/')}/#{service}.java"
           project.file(java_file) do
             mkdir_p ws_dir
-            `wsimport -keep -Xnocompile -target #{target} -s #{ws_dir} -p 
#{pkg} -wsdllocation META-INF/wsdl/#{service}.wsdl #{wsdl_file}`
+            command = []
+            command << "wsimport"
+            command << "-keep"
+            command << "-Xnocompile"
+            command << "-target"
+            command << target
+            command << "-s"
+            command << ws_dir
+            command << "-p"
+            command << pkg
+            if wsdl_location
+              command << "-wsdllocation"
+              command << wsdl_location
+            end
+            command << wsdl_file
+
+            `#{command.join(' ')}`
             if $? != 0 || !File.exist?(java_file)
               rm_rf java_file
               raise "Problem building webservices"


Reply via email to