You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2012/07/13 07:18:46 UTC

svn commit: r1361051 - in /buildr/trunk: CHANGELOG lib/buildr/ide/idea.rb

Author: donaldp
Date: Fri Jul 13 05:18:46 2012
New Revision: 1361051

URL: http://svn.apache.org/viewvc?rev=1361051&view=rev
Log:
Add add_exploded_ear_artifact and add_exploded_ejb_artifact to the idea project extension.

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=1361051&r1=1361050&r2=1361051&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Fri Jul 13 05:18:46 2012
@@ -1,4 +1,5 @@
 1.4.8 (Pending)
+* Added:  Add add_exploded_ear_artifact and add_exploded_ejb_artifact to the idea project extension.
 * Change: Default to using Checkstyle 5.5 in the checkstyle addon.
 * Fixed:  Fix the add_exploded_war_artifact method on the idea project by adding in missing method
           `partition_dependencies`.

Modified: buildr/trunk/lib/buildr/ide/idea.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/ide/idea.rb?rev=1361051&r1=1361050&r2=1361051&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/ide/idea.rb (original)
+++ buildr/trunk/lib/buildr/ide/idea.rb Fri Jul 13 05:18:46 2012
@@ -612,6 +612,77 @@ module Buildr
         end
       end
 
+      def add_exploded_ear_artifact(project, options ={})
+
+        artifact_name = options[:name] || project.iml.id
+        build_on_make = options[:build_on_make].nil? ? true : options[:build_on_make]
+
+        add_artifact(artifact_name, "exploded-ear", build_on_make) do |xml|
+          dependencies = (options[:dependencies] || ([project] + project.compile.dependencies)).flatten
+          libraries, projects = partition_dependencies(dependencies)
+
+          ## The content here can not be indented
+          output_dir = options[:output_dir] || project._(:artifacts, artifact_name)
+          xml.tag!('output-path', output_dir)
+
+          xml.root :id => "root" do
+
+            xml.element :id => "module-output", :name => project.iml.id
+
+            projects.each do |p|
+              xml.element :id => "directory", :name => p.iml.id do
+                xml.element :id => "module-output", :name => p.iml.id
+              end
+            end
+
+            xml.element :id => "directory", :name => "lib" do
+              libraries.each(&:invoke).map(&:to_s).each do |dependency_path|
+                xml.element :id => "file-copy", :path => resolve_path(dependency_path)
+              end
+            end
+
+          end
+        end
+      end
+
+      def add_exploded_ejb_artifact(project, options = {})
+
+        artifact_name = options[:name] || project.iml.id
+        build_on_make = options[:build_on_make].nil? ? true : options[:build_on_make]
+
+        add_artifact(artifact_name, "exploded-ejb", build_on_make) do |xml|
+          dependencies = (options[:dependencies] || ([project] + project.compile.dependencies)).flatten
+          libraries, projects = partition_dependencies(dependencies)
+
+          ## The content here can not be indented
+          output_dir = options[:output_dir] || project._(:artifacts, artifact_name)
+          xml.tag!('output-path', output_dir)
+
+          xml.root :id => "root" do
+
+            xml.element :id => "module-output", :name => project.iml.id
+
+            if options[:enable_jpa]
+              module_names = options[:jpa_module_names] || [project.iml.id]
+              module_names.each do |module_name|
+                facet_name = options[:jpa_facet_name] || "JPA"
+                xml.element :id => "jpa-descriptors", :facet => "#{module_name}/jpa/#{facet_name}"
+              end
+            end
+
+            if options[:enable_ejb].nil? || options[:enable_ejb]
+              module_names = options[:ejb_module_names] || [project.iml.id]
+              module_names.each do |module_name|
+                facet_name = options[:ejb_facet_name] || "EJB"
+                xml.element :id => "javaee-facet-resources", :facet => "#{module_name}/ejb/#{facet_name}"
+              end
+            end
+
+          end
+        end
+      end
+
+
       def add_gwt_configuration(launch_page, project, options = {})
         name = options[:name] || "Run #{launch_page}"
         shell_parameters = options[:shell_parameters] || ""