IDEA: Change the ordering of dependencies in the IDE module descriptor such that...
authorPeter Donald <peter@realityforge.org>
Tue, 21 Feb 2017 22:38:14 +0000 (09:38 +1100)
committerPeter Donald <peter@realityforge.org>
Tue, 21 Feb 2017 22:38:14 +0000 (09:38 +1100)
CHANGELOG
lib/buildr/ide/idea.rb

index 33d8582..ed24d97 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 1.5.1 (Pending)
+* Change: IDEA: Change the ordering of dependencies in the IDE module descriptor such that test dependencies are
+          first to allow test dependencies to override/shadow compile dependencies.
 * Fixed:  IDEA: Correctly configure the IDE module if the language level differs from the root project language level.
 * Change: Add css2gss task to gwt addon to support conveting from deprecated css syntax to modern gss syntax.
 * Change: Add support for gwt 2.8.0 to gwt addon.
index f6f372e..44811e6 100644 (file)
@@ -538,16 +538,29 @@ module Buildr #:nodoc:
           generate_initial_order_entries(xml)
           project_dependencies = []
 
+          # If a project dependency occurs as a main dependency then add it to the list
+          # that are excluded from list of test modules
           self.main_dependency_details.each do |dependency_path, export, source_path|
             next unless export
-            generate_lib(xml, dependency_path, export, source_path, project_dependencies)
+            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.
+                detect { |artifact| artifact.to_s == dependency_path }
+            end
+            project_dependencies << project_for_dependency if project_for_dependency
           end
 
+          main_project_dependencies = project_dependencies.dup
           self.test_dependency_details.each do |dependency_path, export, source_path|
             next if export
             generate_lib(xml, dependency_path, export, source_path, project_dependencies)
           end
 
+          test_project_dependencies = project_dependencies - main_project_dependencies
+          self.main_dependency_details.each do |dependency_path, export, source_path|
+            next unless export
+            generate_lib(xml, dependency_path, export, source_path, test_project_dependencies)
+          end
+
           xml.orderEntryProperties
         end
       end