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.
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/88f32b3d Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/88f32b3d Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/88f32b3d Branch: refs/heads/master Commit: 88f32b3d26b680e53e809690546a370b8d7bc5a0 Parents: 1f8f167 Author: Peter Donald <[email protected]> Authored: Wed Feb 22 09:38:14 2017 +1100 Committer: Peter Donald <[email protected]> Committed: Wed Feb 22 09:38:14 2017 +1100 ---------------------------------------------------------------------- CHANGELOG | 2 ++ lib/buildr/ide/idea.rb | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/buildr/blob/88f32b3d/CHANGELOG ---------------------------------------------------------------------- diff --git a/CHANGELOG b/CHANGELOG index 33d8582..ed24d97 100644 --- 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. http://git-wip-us.apache.org/repos/asf/buildr/blob/88f32b3d/lib/buildr/ide/idea.rb ---------------------------------------------------------------------- diff --git a/lib/buildr/ide/idea.rb b/lib/buildr/ide/idea.rb index f6f372e..44811e6 100644 --- a/lib/buildr/ide/idea.rb +++ b/lib/buildr/ide/idea.rb @@ -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
