Anonymous avatar Anonymous committed c4b5ea3

Delay scanning a node from when we ask for its children to just before we're going to descend to its dependencies.

Comments (0)

Files changed (3)

src/engine/SCons/Node/__init__.py

         if parent not in self.parents: self.parents.append(parent)
 
     def children(self):
-        if not self.scanned:
-            self.scan()
 	return self.sources + self.depends
 
     def get_parents(self):

src/engine/SCons/Taskmaster.py

     def __init__(self, targets=[], tasker=Task, calc=Calc()):
         
         def out_of_date(node):
+            # Scan the file before fetching its children().
+            node.scan()
             return filter(lambda x: x.get_state() != SCons.Node.up_to_date,
                           node.children())
 

src/engine/SCons/TaskmasterTests.py

 executed = None
 
 class Node:
-    def __init__(self, name, kids = []):
+    def __init__(self, name, kids = [], scans = []):
         self.name = name
         self.kids = kids
+        self.scans = scans
         self.builder = Node.build
         self.bsig = None
         self.csig = None
 
     def children(self):
 	return self.kids
+
+    def scan(self):
+        self.kids = self.kids + self.scans
+        for scan in self.scans:
+            scan.parents.append(self)
+        self.scans = []
   
     def get_parents(self):
         return self.parents
         t.executed()
         assert not tm.is_blocked()
         t = tm.next_task()
-        assert tm. next_task() == None
+        assert tm.next_task() == None
+
+
+        n1 = Node("n1")
+        n2 = Node("n2")
+        n3 = Node("n3", [n1], [n2])
+        tm = SCons.Taskmaster.Taskmaster([n3])
+        t = tm.next_task()
+        assert t.get_target() == n1
+        t.executed()
+        t = tm.next_task()
+        assert t.get_target() == n2
+        t.executed()
+        t = tm.next_task()
+        assert t.get_target() == n3
+        t.executed()
+        assert tm.next_task() == None
     
     def test_cycle_detection(self):
         n1 = Node("n1")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.