You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by to...@apache.org on 2010/05/21 07:25:25 UTC

svn commit: r946877 - in /buildr/trunk: CHANGELOG lib/buildr/core/project.rb

Author: toulmean
Date: Fri May 21 05:25:25 2010
New Revision: 946877

URL: http://svn.apache.org/viewvc?rev=946877&view=rev
Log:
fix for BUILDR-442 Errors while running the specs with jruby 1.5

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/core/project.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=946877&r1=946876&r2=946877&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Fri May 21 05:25:25 2010
@@ -115,6 +115,7 @@
           (Pepijn Van Eeckhoudt)
 * Fixed:  BUILDR-399 invoke_with_call_chain does not restore call chain
           correctly (Pepijn Van Eeckhoudt)
+* Fixed:  BUILDR-442 Errors while running the specs with jruby 1.5
 * Fixed:  buildr test=all didn't run all tests as expected
 * Fixed:  Fail-fast if package.with() or include() called with nil values
 * Fixed:  Failures not reported correctly for ScalaTest (Alex Eagle)

Modified: buildr/trunk/lib/buildr/core/project.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/project.rb?rev=946877&r1=946876&r2=946877&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/project.rb (original)
+++ buildr/trunk/lib/buildr/core/project.rb Fri May 21 05:25:25 2010
@@ -641,22 +641,10 @@ module Buildr
     def call_callbacks(phase) #:nodoc:
       remaining = @callbacks.select { |cb| cb.phase == phase }
       known_callbacks = remaining.map { |cb| cb.name }
-
-      # find first callback with satisfied dependencies
-      first_satisfied = lambda do
-        remaining_names = remaining.map { |cb| cb.name }
-        remaining.find do |cb|
-          cb.dependencies.each do |dep|
-            fail "Unknown #{phase.inspect} extension dependency: #{dep.inspect}" unless known_callbacks.index(dep)
-          end
-          satisfied = cb.dependencies.find { |dep| remaining_names.index(dep) } == nil
-          remaining.delete cb if satisfied
-        end
-      end
-
+      
       # call each extension in order
       until remaining.empty?
-        callback = first_satisfied.call
+        callback = first_satisfied(remaining, known_callbacks)
         if callback.nil?
           hash = remaining.map { |cb| { cb.name => cb.dependencies} }
           fail "Unsatisfied dependencies in extensions for #{phase}: #{hash.inspect}"
@@ -664,6 +652,21 @@ module Buildr
         callback.blocks.each { |b| b.call(self) }
       end
     end
+    
+    private
+    
+    # find first callback with satisfied dependencies
+    def first_satisfied(r, known_callbacks)
+      remaining_names = r.map { |cb| cb.name }
+      res = r.find do |cb|
+        cb.dependencies.each do |dep|
+          fail "Unknown #{phase.inspect} extension dependency: #{dep.inspect}" unless known_callbacks.index(dep)
+        end
+        satisfied = cb.dependencies.find { |dep| remaining_names.index(dep) } == nil
+        cb if satisfied
+      end
+      r.delete res
+    end
 
   end