You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/07/10 04:03:39 UTC

svn commit: r675411 - in /incubator/buildr/trunk: CHANGELOG lib/buildr/core/application.rb lib/buildr/core/application_cli.rb lib/buildr/core/compile.rb

Author: assaf
Date: Wed Jul  9 19:03:39 2008
New Revision: 675411

URL: http://svn.apache.org/viewvc?rev=675411&view=rev
Log:
Added: --prereqs command line argument to show all tasks and their
dependencies. You can also follow with regular expression to narrow down the
list of tasks.

Modified:
    incubator/buildr/trunk/CHANGELOG
    incubator/buildr/trunk/lib/buildr/core/application.rb
    incubator/buildr/trunk/lib/buildr/core/application_cli.rb
    incubator/buildr/trunk/lib/buildr/core/compile.rb

Modified: incubator/buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/CHANGELOG?rev=675411&r1=675410&r2=675411&view=diff
==============================================================================
--- incubator/buildr/trunk/CHANGELOG (original)
+++ incubator/buildr/trunk/CHANGELOG Wed Jul  9 19:03:39 2008
@@ -1,4 +1,7 @@
 1.3.2 (Pending)
+* Added: --prereqs command line argument to show all tasks and their
+dependencies. You can also follow with regular expression to narrow down the
+list of tasks.
 * Changed: Upgraded to Rubyforge 1.0.0.
 * Changed: BUILDR-86 Use newest versions of net-ssh and net-sftp gems.
 * Changed: BUILDR-88 Test classes/resources should come before compile

Modified: incubator/buildr/trunk/lib/buildr/core/application.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/application.rb?rev=675411&r1=675410&r2=675411&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/application.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/application.rb Wed Jul  9 19:03:39 2008
@@ -273,6 +273,16 @@
     end
     private :load_tasks
 
+    def display_prerequisites
+      invoke_task('buildr:initialize')
+      tasks.each do |task|
+        if task.name =~ options.show_task_pattern
+          puts "buildr #{task.name}"
+          task.prerequisites.each { |prereq| puts "    #{prereq}" }
+        end
+      end
+    end
+
     # :call-seq:
     #   deprecated(message)
     #

Modified: incubator/buildr/trunk/lib/buildr/core/application_cli.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/application_cli.rb?rev=675411&r1=675410&r2=675411&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/application_cli.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/application_cli.rb Wed Jul  9 19:03:39 2008
@@ -54,6 +54,8 @@
           'Require MODULE before executing buildfile.'],
         ['--trace',    '-t', GetoptLong::NO_ARGUMENT,
           'Turn on invoke/execute tracing, enable full backtrace.'],
+        ['--prereqs',  '-P', GetoptLong::OPTIONAL_ARGUMENT,
+          'Display tasks and dependencies, then exit.'],
         ['--version',  '-v', GetoptLong::NO_ARGUMENT,
           'Display the program version.'],
         ['--environment', '-e', GetoptLong::REQUIRED_ARGUMENT,
@@ -92,6 +94,9 @@
         ENV['BUILDR_ENV'] = value
       when '--require'
         requires << value
+      when '--prereqs'
+        options.show_prereqs = true
+        options.show_task_pattern = Regexp.new(value || '.')
       when '--nosearch', '--quiet', '--trace'
         super
       end
@@ -105,6 +110,8 @@
       "Buildr #{Buildr::VERSION} #{RUBY_PLATFORM[/java/] && '(JRuby '+JRUBY_VERSION+')'}"
     end
 
+  private
+
     def usage
       puts version
       puts
@@ -129,6 +136,6 @@
       puts 'For help with your buildfile:'
       puts '  buildr help'
     end
-    
+   
   end
 end

Modified: incubator/buildr/trunk/lib/buildr/core/compile.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/compile.rb?rev=675411&r1=675410&r2=675411&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/compile.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/compile.rb Wed Jul  9 19:03:39 2008
@@ -451,12 +451,12 @@
       filter.target
     end
 
-  protected
-
     def prerequisites #:nodoc:
       super + filter.sources.flatten
     end
 
+  protected
+
     # Associates this task with project and particular usage (:main, :test).
     def associate_with(project, usage) #:nodoc:
       @project, @usage = project, usage