1 # Copyright Pedro Ferreira 2005. Distributed under the Boost
2 # Software License, Version 1.0. (See accompanying
3 # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 # To simplify implementation of tools level, we'll
8 # have a global variable keeping the current manager.
14 """ This class is a facade to the Boost.Build system.
15 It serves as the root to access all data structures in use.
18 def __init__ (self, engine, global_build_dir):
20 engine: the build engine that will actually construct the targets.
22 from build.virtual_target import VirtualTargetRegistry
23 from build.targets import TargetRegistry
24 from build.project import ProjectRegistry
25 from build.scanner import ScannerRegistry
26 from build.errors import Errors
27 from b2.util.logger import NullLogger
28 from build import build_request, property_set, feature
31 self.virtual_targets_ = VirtualTargetRegistry (self)
32 self.projects_ = ProjectRegistry (self, global_build_dir)
33 self.targets_ = TargetRegistry ()
34 self.logger_ = NullLogger ()
35 self.scanners_ = ScannerRegistry (self)
36 self.argv_ = bjam.variable("ARGV")
37 self.boost_build_path_ = bjam.variable("BOOST_BUILD_PATH")
38 self.errors_ = Errors()
39 self.command_line_free_features_ = property_set.empty()
50 def virtual_targets (self):
51 return self.virtual_targets_
65 def set_logger (self, logger):
71 def getenv(self, name):
72 return bjam.variable(name)
74 def boost_build_path(self):
75 return self.boost_build_path_
77 def command_line_free_features(self):
78 return self.command_line_free_features_
80 def set_command_line_free_features(self, v):
81 self.command_line_free_features_ = v
83 def construct (self, properties = [], targets = []):
84 """ Constructs the dependency graph.
85 properties: the build properties.
86 targets: the targets to consider. If none is specified, uses all.
89 for name, project in self.projects ().projects ():
90 targets.append (project.target ())
92 property_groups = build_request.expand_no_defaults (properties)
96 for p in property_groups:
97 build_prop_sets.append (property_set.create (feature.split (p)))
99 if not build_prop_sets:
100 build_prop_sets = [property_set.empty ()]
102 for build_properties in build_prop_sets:
103 for target in targets:
104 result = target.generate (build_properties)
105 virtual_targets.extend (result.targets ())
108 for virtual_target in virtual_targets:
109 actual_targets.extend (virtual_target.actualize ())