buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject svn commit: r1096656 - in /buildr/trunk: lib/buildr/ide/idea.rb spec/ide/idea_spec.rb
Date Tue, 26 Apr 2011 04:42:56 GMT
Author: donaldp
Date: Tue Apr 26 04:42:56 2011
New Revision: 1096656

URL: http://svn.apache.org/viewvc?rev=1096656&view=rev
Log:
BUILDR-574 - Enhance idea task to generate test resources with test scope

Modified:
    buildr/trunk/lib/buildr/ide/idea.rb
    buildr/trunk/spec/ide/idea_spec.rb

Modified: buildr/trunk/lib/buildr/ide/idea.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/ide/idea.rb?rev=1096656&r1=1096655&r2=1096656&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/ide/idea.rb (original)
+++ buildr/trunk/lib/buildr/ide/idea.rb Tue Apr 26 04:42:56 2011
@@ -192,6 +192,7 @@ module Buildr
 
       protected
 
+      # Note: Use the test classpath since IDEA compiles both "main" and "test" classes using
the same classpath
       def test_dependency_details
         main_dependencies_paths = main_dependencies.map(&:to_s)
         target_dir = buildr_project.compile.target.to_s
@@ -206,7 +207,6 @@ module Buildr
           end
           [dependency_path, export, source_path]
         end
-
       end
 
       def base_directory
@@ -246,7 +246,6 @@ module Buildr
           generate_initial_order_entries(xml)
           project_dependencies = []
 
-          # Note: Use the test classpath since IDEA compiles both "main" and "test" classes
using the same classpath
           self.test_dependency_details.each do |dependency_path, export, source_path|
             project_for_dependency = Buildr.projects.detect do |project|
               [project.packages, project.compile.target, project.resources.target, project.test.compile.target,
project.test.resources.target].flatten.
@@ -254,12 +253,12 @@ module Buildr
             end
             if project_for_dependency
               if project_for_dependency.iml? && !project_dependencies.include?(project_for_dependency)
-                generate_project_dependency(xml, project_for_dependency.iml.name, export)
+                generate_project_dependency(xml, project_for_dependency.iml.name, export,
!export)
               end
               project_dependencies << project_for_dependency
               next
             else
-              generate_module_lib(xml, url_for_path(dependency_path), export, (source_path
? url_for_path(source_path) : nil))
+              generate_module_lib(xml, url_for_path(dependency_path), export, (source_path
? url_for_path(source_path) : nil), !export)
             end
           end
 
@@ -338,15 +337,17 @@ module Buildr
         xml.orderEntry :type => "inheritedJdk"
       end
 
-      def generate_project_dependency(xml, other_project, export = true)
+      def generate_project_dependency(xml, other_project, export, test = false)
         attribs = {:type => 'module', "module-name" => other_project}
         attribs[:exported] = '' if export
+        attribs[:scope] = 'TEST' if test
         xml.orderEntry attribs
       end
 
-      def generate_module_lib(xml, path, export, source_path)
+      def generate_module_lib(xml, path, export, source_path, test = false)
         attribs = {:type => 'module-library'}
         attribs[:exported] = '' if export
+        attribs[:scope] = 'TEST' if test
         xml.orderEntry attribs do
           xml.library do
             xml.CLASSES do

Modified: buildr/trunk/spec/ide/idea_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/ide/idea_spec.rb?rev=1096656&r1=1096655&r2=1096656&view=diff
==============================================================================
--- buildr/trunk/spec/ide/idea_spec.rb (original)
+++ buildr/trunk/spec/ide/idea_spec.rb Tue Apr 26 04:42:56 2011
@@ -141,9 +141,9 @@ describe Buildr::IntellijIdea do
           invoke_generate_task
         end
 
-        it "generates one non-exported 'module-library' orderEntry in IML" do
+        it "generates one non-exported  test scope 'module-library' orderEntry in IML" do
           root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library'
and @exported]/library/CLASSES/root", 0)
-          root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library']/library/CLASSES/root",
1)
+          root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library'
and @scope='TEST']/library/CLASSES/root", 1)
         end
       end
 
@@ -1142,4 +1142,4 @@ PROJECT_XML
     end
   end
 
-end
\ No newline at end of file
+end



Mime
View raw message