Author: donaldp
Date: Thu Apr 18 01:51:47 2013
New Revision: 1469130

URL: http://svn.apache.org/r1469130
Log:
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/CHANGELOG
    buildr/trunk/lib/buildr/ide/idea.rb

Modified: buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1469130&r1=1469129&r2=1469130&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Thu Apr 18 01:51:47 2013
@@ -1,4 +1,7 @@
 1.4.12 (Pending)
+* 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.
 * Added:  Improved support for auto-detection of VCS dirs when creating
           IDEA projects.
 * Added:  Added support for SuperDevMode in gwt addon and upgraded to

Modified: buildr/trunk/lib/buildr/ide/idea.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/ide/idea.rb?rev=1469130&r1=1469129&r2=1469130&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/ide/idea.rb (original)
+++ buildr/trunk/lib/buildr/ide/idea.rb Thu Apr 18 01:51:47 2013
@@ -253,15 +253,30 @@ module Buildr #:nodoc:
 
       def add_gwt_facet(modules = {}, options = {})
         name = options[:name] || "GWT"
+        detected_gwt_version = options[:gwt_dev_artifact] ? 
artifact(options[:gwt_dev_artifact]) : nil
+
         settings =
           {
             :webFacet => "Web",
             :compilerMaxHeapSize => "512",
             :compilerParameters => "-draftCompile -localWorkers 2 -strict",
-            :gwtSdkUrl => "file://$GWT_TOOLS$",
             :gwtScriptOutputStyle => "PRETTY"
           }.merge(options[:settings] || {})
 
+        buildr_project.compile.dependencies.each do |d|
+          if d.to_s =~ /\/com\/google\/gwt\/gwt-dev\/(.*)\//
+            detected_gwt_version = resolve_path(d.to_s)
+            break
+          end
+        end unless detected_gwt_version
+
+        if detected_gwt_version
+          settings[:gwtSdkUrl] = detected_gwt_version
+          settings[:gwtSdkType] = "maven"
+        else
+          settings[:gwtSdkUrl] = "file://$GWT_TOOLS$"
+        end
+
         add_facet(name, "gwt") do |f|
           f.configuration do |c|
             settings.each_pair do |k, v|


Reply via email to