[macruby-changes] [3339] MacRuby/trunk/rakelib

source_changes at macosforge.org source_changes at macosforge.org
Tue Jan 26 11:48:54 PST 2010


Revision: 3339
          http://trac.macosforge.org/projects/ruby/changeset/3339
Author:   eloy.de.enige at gmail.com
Date:     2010-01-26 11:48:49 -0800 (Tue, 26 Jan 2010)
Log Message:
-----------
Moved the parallel_execute method to Builder and make it accept arrays of command arrays for dep. management.

Modified Paths:
--------------
    MacRuby/trunk/rakelib/builder.rake
    MacRuby/trunk/rakelib/builder.rb

Modified: MacRuby/trunk/rakelib/builder.rake
===================================================================
--- MacRuby/trunk/rakelib/builder.rake	2010-01-26 14:18:47 UTC (rev 3338)
+++ MacRuby/trunk/rakelib/builder.rake	2010-01-26 19:48:49 UTC (rev 3339)
@@ -399,21 +399,6 @@
   'lib/yaml/rubytypes.rb',
 ]
 namespace :stdlib do
-  # Runs the given array of +commands+ in parallel. The amount of spawned
-  # simultaneous jobs is determined by the `j' env variable and defaults to 1.
-  def parallel_execute(commands)
-    @jobs ||= ENV['j'] ? ENV['j'].to_i : 1
-    commands = commands.dup
-    
-    Array.new(@jobs) do
-      Thread.new do
-        while command = commands.shift
-          sh command
-        end
-      end
-    end.each { |t| t.join }
-  end
-  
   desc "AOT compile the stdlib"
   task :build => [:miniruby, 'macruby:dylib'] do
     archf = ARCHS.map { |x| "--arch #{x}" }.join(' ')
@@ -425,7 +410,7 @@
         end
       end
     end.flatten.compact
-    parallel_execute(commands)
+    Builder.parallel_execute(commands)
   end
 
   desc "Touch .rbo files to ignore their build"

Modified: MacRuby/trunk/rakelib/builder.rb
===================================================================
--- MacRuby/trunk/rakelib/builder.rb	2010-01-26 14:18:47 UTC (rev 3338)
+++ MacRuby/trunk/rakelib/builder.rb	2010-01-26 19:48:49 UTC (rev 3339)
@@ -124,6 +124,24 @@
 }
 
 class Builder
+  # Runs the given array of +commands+ in parallel. The amount of spawned
+  # simultaneous jobs is determined by the `j' env variable and defaults to 1.
+  #
+  # When the members of the +commands+ array are in turn arrays of strings,
+  # then those commands will be executed in consecutive order.
+  def self.parallel_execute(commands)
+    @jobs ||= ENV['j'] ? ENV['j'].to_i : 1
+    commands = commands.dup
+
+    Array.new(@jobs) do |i|
+      Thread.new do
+        while c = commands.shift
+          Array(c).each { |command| sh(command) }
+        end
+      end
+    end.each { |t| t.join }
+  end
+
   attr_reader :objs, :cflags, :cxxflags
   attr_accessor :objc_cflags, :ldflags, :dldflags
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100126/4f6937fa/attachment.html>


More information about the macruby-changes mailing list