Fix -j with multiple targets. (Anthony Roach)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 7 Sep 2002 12:34:45 +0000 (12:34 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 7 Sep 2002 12:34:45 +0000 (12:34 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@459 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Taskmaster.py
test/option-j.py

index 799582bd3759e37f1db2ddcfc15a6d1cd37ddaf7..bf2d918c63bae22df1809e71c9491de33a626e6b 100644 (file)
@@ -231,12 +231,13 @@ class Taskmaster:
         if node is None:
             return None
 
-        self.executing.append(node)
-        self.executing.extend(node.side_effects)
         try:
             tlist = node.builder.targets(node)
         except AttributeError:
             tlist = [node]
+        self.executing.extend(tlist)
+        self.executing.extend(node.side_effects)
+        
         task = self.tasker(self, tlist, node in self.targets, node)
         task.make_ready()
         self.ready = None
@@ -255,7 +256,12 @@ class Taskmaster:
         self.pending = []
 
     def executed(self, node):
-        self.executing.remove(node)
+        try:
+            tlist = node.builder.targets(node)
+        except AttributeError:
+            tlist = [node]
+        for t in tlist:
+            self.executing.remove(t)
         for side_effect in node.side_effects:
             self.executing.remove(side_effect)
 
index e67d3b404d19b489c0a926783ab1482e2a2f4506..b886afb1d9af47c94bbc2a5d697a75a6d73ed499 100644 (file)
@@ -51,11 +51,27 @@ file.write(str(time.time()))
 file.close()
 """)
 
+test.subdir('foo')
+
+test.write(['foo','foo.in'], r"""
+foo you
+""")
+
 test.write('SConstruct', """
 MyBuild = Builder(action = r'%s build.py $TARGETS')
 env = Environment(BUILDERS = { 'MyBuild' : MyBuild })
 env.MyBuild(target = 'f1', source = 'f1.in')
 env.MyBuild(target = 'f2', source = 'f2.in')
+
+def copyn(env, target, source):
+    import shutil
+    import time
+    time.sleep(1)
+    for t in target:
+        shutil.copy(str(source[0]), str(t))
+
+t = env.Command(target=['foo/foo1.out', 'foo/foo2.out'], source='foo/foo.in', action=copyn)
+env.Install('out', t)
 """ % python)
 
 def RunTest(args, extra):
@@ -93,5 +109,7 @@ start2, finish1 = RunTest('f1 f2', "second")
 # before the first one was finished
 test.fail_test(start2 < finish1)
 
+test.run(arguments='-j 2 out')
+
 test.pass_test()