Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Expand properties specified on the command line into multiple property
# sets consisting of all legal property combinations. Each expanded property
# set will be used for a single build run. E.g. if multiple toolsets are
# specified then requested targets will be built with each of them.
# The expansion is being performed as late as possible so that the feature
# validation is performed after all necessary modules (including project targets
# on the command line) have been loaded.
if properties:
expanded = []
for p in properties:
expanded.extend(build_request.convert_command_line_element(p))
expanded = build_request.expand_no_defaults(expanded)
else:
expanded = [property_set.empty()]
# Now that we have a set of targets to build and a set of property sets to
# build the targets with, we can start the main build process by using each
# property set to generate virtual targets from all of our listed targets
# and any of their dependants.
for p in expanded:
manager.set_command_line_free_features(property_set.create(p.free()))
for t in targets:
try:
g = t.generate(p)
if not isinstance(t, ProjectTarget):
results_of_main_targets.extend(g.targets())
virtual_targets.extend(g.targets())
except ExceptionWithUserContext, e:
e.report()
get_manager().errors()("In 'install': property specified with target that requires relinking.")
else:
(r, targets) = generators.construct(self.project(), name, "INSTALLED_" + t,
new_ps, [i])
assert isinstance(r, property_set.PropertySet)
staged_targets.extend(targets)
else:
staged_targets.append(copy_file(self.project(), ename, i, new_ps))
if not staged_targets:
get_manager().errors()("Unable to generate staged version of " + i)
result.extend(get_manager().virtual_targets().register(t) for t in staged_targets)
return (property_set.empty(), result)
self.module2attributes[module_name] = attributes
python_standalone = False
if location:
attributes.set("source-location", [location], exact=1)
elif not module_name in ["test-config", "site-config", "user-config", "project-config"]:
# This is a standalone project with known location. Set source location
# so that it can declare targets. This is intended so that you can put
# a .jam file in your sources and use it via 'using'. Standard modules
# (in 'tools' subdir) may not assume source dir is set.
attributes.set("source-location", self.loaded_tool_module_path_[module_name], exact=1)
python_standalone = True
attributes.set("requirements", property_set.empty(), exact=True)
attributes.set("usage-requirements", property_set.empty(), exact=True)
attributes.set("default-build", property_set.empty(), exact=True)
attributes.set("projects-to-build", [], exact=True)
attributes.set("project-root", None, exact=True)
attributes.set("build-dir", None, exact=True)
self.project_rules_.init_project(module_name, python_standalone)
jamroot = False
parent_module = None;
if module_name == "test-config":
# No parent
pass
elif module_name == "site-config":
parent_module = "test-config"
elif module_name == "user-config":
parent_module = "site-config"
# This is a standalone project with known location. Set source location
# so that it can declare targets. This is intended so that you can put
# a .jam file in your sources and use it via 'using'. Standard modules
# (in 'tools' subdir) may not assume source dir is set.
source_location = standalone_path
if not source_location:
source_location = self.loaded_tool_module_path_.get(module_name)
if not source_location:
self.manager.errors()('Standalone module path not found for "{}"'
.format(module_name))
attributes.set("source-location", [source_location], exact=1)
python_standalone = True
attributes.set("requirements", property_set.empty(), exact=True)
attributes.set("usage-requirements", property_set.empty(), exact=True)
attributes.set("default-build", property_set.empty(), exact=True)
attributes.set("projects-to-build", [], exact=True)
attributes.set("project-root", None, exact=True)
attributes.set("build-dir", None, exact=True)
self.project_rules_.init_project(module_name, python_standalone)
if parent_module:
self.inherit_attributes(module_name, parent_module)
attributes.set("parent-module", parent_module, exact=1)
if jamroot:
attributes.set("project-root", location, exact=1)
parent = None
if parent_module:
parent = self.target(parent_module)
get_manager().errors()("In 'install': property specified with target that requires relinking.")
else:
(r, targets) = generators.construct(self.project(), name, "INSTALLED_" + t,
new_ps, [i])
assert isinstance(r, property_set.PropertySet)
staged_targets.extend(targets)
else:
staged_targets.append(copy_file(self.project(), ename, i, new_ps))
if not staged_targets:
get_manager().errors()("Unable to generate staged version of " + i)
result.extend(get_manager().virtual_targets().register(t) for t in staged_targets)
return (property_set.empty(), result)
def __init__ (self, manager, sources, action_name, prop_set):
assert(isinstance(prop_set, property_set.PropertySet))
assert type(sources) == types.ListType
self.sources_ = sources
self.action_name_ = action_name
if not prop_set:
prop_set = property_set.empty()
self.properties_ = prop_set
if not all(isinstance(v, VirtualTarget) for v in prop_set.get('implicit-dependency')):
import pdb
pdb.set_trace()
self.manager_ = manager
self.engine_ = self.manager_.engine ()
self.targets_ = []
# Indicates whether this has been actualized or not.
self.actualized_ = False
self.dependency_only_sources_ = []
self.actual_sources_ = []
# Expand properties specified on the command line into multiple property
# sets consisting of all legal property combinations. Each expanded property
# set will be used for a single build run. E.g. if multiple toolsets are
# specified then requested targets will be built with each of them.
# The expansion is being performed as late as possible so that the feature
# validation is performed after all necessary modules (including project targets
# on the command line) have been loaded.
if properties:
expanded = []
for p in properties:
expanded.extend(build_request.convert_command_line_element(p))
expanded = build_request.expand_no_defaults(expanded)
else:
expanded = [property_set.empty()]
# Now that we have a set of targets to build and a set of property sets to
# build the targets with, we can start the main build process by using each
# property set to generate virtual targets from all of our listed targets
# and any of their dependants.
for p in expanded:
manager.set_command_line_free_features(property_set.create(p.free()))
for t in targets:
try:
g = t.generate(p)
if not isinstance(t, ProjectTarget):
results_of_main_targets.extend(g.targets())
virtual_targets.extend(g.targets())
except ExceptionWithUserContext, e:
e.report()
elif not module_name in ["test-config", "site-config", "user-config", "project-config"]:
# This is a standalone project with known location. Set source location
# so that it can declare targets. This is intended so that you can put
# a .jam file in your sources and use it via 'using'. Standard modules
# (in 'tools' subdir) may not assume source dir is set.
source_location = standalone_path
if not source_location:
source_location = self.loaded_tool_module_path_.get(module_name)
if not source_location:
self.manager.errors()('Standalone module path not found for "{}"'
.format(module_name))
attributes.set("source-location", [source_location], exact=1)
python_standalone = True
attributes.set("requirements", property_set.empty(), exact=True)
attributes.set("usage-requirements", property_set.empty(), exact=True)
attributes.set("default-build", property_set.empty(), exact=True)
attributes.set("projects-to-build", [], exact=True)
attributes.set("project-root", None, exact=True)
attributes.set("build-dir", None, exact=True)
self.project_rules_.init_project(module_name, python_standalone)
if parent_module:
self.inherit_attributes(module_name, parent_module)
attributes.set("parent-module", parent_module, exact=1)
if jamroot:
attributes.set("project-root", location, exact=1)
parent = None
if parent_module:
def run (self, project, name, prop_set, sources):
return (property_set.empty(), [])
"""Given the target name specified in constructor, returns the
name which should be really used, by looking at the properties.
The tag properties come in two flavour:
- value,
- @rule-name
In the first case, value is just added to name
In the second case, the specified rule is called with specified name,
target type and properties and should return the new name.
If not property is specified, or the rule specified by
returns nothing, returns the result of calling
virtual-target.add-suffix"""
assert isinstance(specified_name, basestring)
if self.action_:
ps = self.action_.properties()
else:
ps = property_set.empty()
# FIXME: I'm not sure how this is used, need to check with
# Rene to figure out how to implement
#~ We add ourselves to the properties so that any tag rule can get
#~ more direct information about the target than just that available
#~ through the properties. This is useful in implementing
#~ name changes based on the sources of the target. For example to
#~ make unique names of object files based on the source file.
#~ --grafik
#ps = property_set.create(ps.raw() + ["%s" % "XXXX"])
#ps = [ property-set.create [ $(ps).raw ] $(__name__) ] ;
tag = ps.get("")
if tag: