Anonymous avatar Anonymous committed c71105e

Add --debug=dtree option (Anthony Roach)

Comments (0)

Files changed (3)

 .TP
 .RI --debug=tree
 Print the dependency tree
-after each top-level target is built.
+after each top-level target is built. This prints out the complete
+dependency tree including implicit dependencies and ignored
+dependencies.
+
+.TP
+.RI --debug=dtree
+Print the dependency tree
+after each top-level target is built. This prints out only derived files.
 
 .TP
 -e, --environment-overrides

src/engine/SCons/Script/__init__.py

         # this method is serialized, but execute isn't:
         if print_tree and self.top:
             print
-            print SCons.Util.render_tree(self.targets[0], get_children)
+            print SCons.Util.render_tree(self.targets[0], get_all_children)
+	if print_dtree and self.top:
+	    print
+	    print SCons.Util.render_tree(self.targets[0], get_derived_children)
 
     def failed(self):
         global exit_status
 keep_going_on_error = 0
 help_option = None
 print_tree = 0
+print_dtree = 0
 climb_up = 0
 target_top = None
 exit_status = 0 # exit status, assume success by default
 
 # utility functions
 
-def get_children(node): return node.all_children(None)
+def get_all_children(node): return node.all_children(None)
+
+def get_derived_children(node): 
+    children = node.all_children(None)
+    return filter(lambda x: x.builder, children)
 
 def _scons_syntax_error(e):
     """Handle syntax errors. Print out a message and show where the error
 
     def opt_debug(opt, arg):
         global print_tree
+        global print_dtree
         if arg == "pdb":
             args = [ sys.executable, "pdb.py" ] + \
                      filter(lambda x: x != "--debug=pdb", sys.argv)
                 os.execvpe(args[0], args, os.environ)
         elif arg == "tree":
             print_tree = 1
+        elif arg == "dtree":
+            print_dtree = 1
         else:
             sys.stderr.write("Warning:  %s is not a valid debug type\n"
                              % arg)

test/option--debug.py

 test.run(arguments = "--debug=tree " + foo)
 test.fail_test(string.find(test.stdout(), tree) == -1)
 
+
+tree = """
++-%s
+  +-foo%s
+  +-bar%s
+""" % (foo, obj,obj)
+
+test.run(arguments = "--debug=dtree " + foo)
+test.fail_test(string.find(test.stdout(), tree) == -1)
+
 tree = """scons: \".\" is up to date.
 
 +-.
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.