Support the project.root_project utility method to retrieve the top level project.
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
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 @@
@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
#
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 @@
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 @@
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|