One more stop to fixing --enable-modules
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Mon, 25 Oct 2010 22:21:50 +0100
changeset 6641 cfd3533cc1ef
parent 6640 8285fbb8b04d
child 6642 072bfb97e87c
One more stop to fixing --enable-modules
wscript
--- a/wscript	Mon Oct 25 21:43:38 2010 +0100
+++ b/wscript	Mon Oct 25 22:21:50 2010 +0100
@@ -549,24 +549,44 @@
         env['NS3_ENABLED_MODULES'] = modules
         print "Modules to build:", modules
 
+        def exclude_task(bld, task):
+            # ok, so WAF does not provide an API to prevent an
+            # arbitrary task from running; we have to muck around with
+            # WAF internal state, something that might stop working if
+            # WAF is upgraded...
+            bld.all_task_gen.remove(task)
+            for group in bld.task_manager.groups:
+                try:
+                    group.tasks_gen.remove(task)
+                except ValueError:
+                    pass
+                else:
+                    break
+
         # Exclude the programs other misc task gens that depend on disabled modules
         for obj in list(bld.all_task_gen):
 
             # check for ns3moduleheader_taskgen
             if type(obj).__name__ == 'ns3moduleheader_taskgen':
                 if ("ns3-%s" % obj.module) not in modules:
-                    bld.all_task_gen.remove(obj)
+                    exclude_task(bld, obj)
 
             # check for programs
             if hasattr(obj, 'ns3_module_dependencies'):
                 # this is an NS-3 program (bld.create_ns3_program)
                 for dep in obj.ns3_module_dependencies:
                     if dep not in modules: # prog. depends on a module that isn't enabled?
-                        bld.all_task_gen.remove(obj)
+                        exclude_task(bld, obj)
                         break
 
+            # disable the modules themselves
             if hasattr(obj, "is_ns3_module") and obj.name not in modules:
-                bld.all_task_gen.remove(obj)
+                exclude_task(bld, obj)
+
+            # disable the ns3header_taskgen
+            if type(obj).__name__ == 'ns3header_taskgen':
+                if ("ns3-%s" % obj.module) not in modules:
+                    exclude_task(bld, obj)
 
     ## Create a single ns3 library containing all enabled modules
     if env['ENABLE_STATIC_NS3']: