Repository: buildr
Updated Branches:
  refs/heads/master ac7a560ff -> 86f9c48a8


Support the project.root_project utility method to retrieve the top level 
project.


Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/86f9c48a
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/86f9c48a
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/86f9c48a

Branch: refs/heads/master
Commit: 86f9c48a8fa27c060b6eef8854c201541ee8bf23
Parents: ac7a560
Author: Peter Donald <[email protected]>
Authored: Mon Apr 4 10:41:16 2016 +1000
Committer: Peter Donald <[email protected]>
Committed: Mon Apr 4 10:41:16 2016 +1000

----------------------------------------------------------------------
 CHANGELOG                  |  1 +
 lib/buildr/core/project.rb | 14 ++++++++++++++
 lib/buildr/ide/idea.rb     | 10 +---------
 3 files changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/86f9c48a/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 605b4f7..0fee60c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,7 @@
 * Change: BUILDR-712 Update jruby-openssl dependency version or support a 
range of versions
 * Change: Update gwt addon to add the GWT artifacts to project dependencies as 
specs rather
           than files.
+* Change: Support the project.root_project utility method to retrieve the top 
level project.
 
 1.4.24 (2016-03-19)
 * Added:  Support the :no_invoke parameter being passed to Buildr.project() and

http://git-wip-us.apache.org/repos/asf/buildr/blob/86f9c48a/lib/buildr/core/project.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/core/project.rb b/lib/buildr/core/project.rb
index 9dc1953..1b34eb4 100644
--- a/lib/buildr/core/project.rb
+++ b/lib/buildr/core/project.rb
@@ -412,6 +412,20 @@ module Buildr #:nodoc:
       @callbacks = Project.global_callbacks.dup
     end
 
+    #
+    # Returns the root project for this project.
+    #
+    # If this project is a subproject it will find the top
+    # level project and return it, else it will return itself.
+    #
+    def root_project
+      p = project
+      while p.parent
+        p = p.parent
+      end
+      p
+    end
+
     # :call-seq:
     #   base_dir => path
     #

http://git-wip-us.apache.org/repos/asf/buildr/blob/86f9c48a/lib/buildr/ide/idea.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/ide/idea.rb b/lib/buildr/ide/idea.rb
index 2f06cdc..f1561c5 100644
--- a/lib/buildr/ide/idea.rb
+++ b/lib/buildr/ide/idea.rb
@@ -370,7 +370,7 @@ module Buildr #:nodoc:
           end
           default_enable_jsf = webroots.keys.any?{|webroot| 
File.exist?("#{webroot}/WEB-INF/faces-config.xml")}
           enable_jsf = options[:enable_jsf].nil? ? default_enable_jsf : 
options[:enable_jsf]
-          enable_jsf = false if root_project.ipr? && root_project.ipr.version 
>= '13'
+          enable_jsf = false if buildr_project.root_project.ipr? && 
buildr_project.root_project.ipr.version >= '13'
           f.facet(:type => 'jsf', :name => 'JSF') do |jsf|
             jsf.configuration
           end if enable_jsf
@@ -477,14 +477,6 @@ module Buildr #:nodoc:
 
       protected
 
-      def root_project
-        p = buildr_project
-        while p.parent
-          p = p.parent
-        end
-        p
-      end
-
       def main_dependency_details
         target_dir = buildr_project.compile.target.to_s
         main_dependencies.select { |d| d.to_s != target_dir }.collect do |d|

Reply via email to