Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Add targets of right type to 'consumed'. Add others to
# 'bypassed'. The 'generators.construct' rule has done
# its best to convert everything to the required type.
# There's no need to rerun it on targets of different types.
# NOTE: ignoring usage requirements
for t in transformed[1]:
if t.type() in missing_types:
consumed.append(t)
else:
bypassed.append(t)
consumed = unique(consumed)
bypassed = unique(bypassed)
# remove elements of 'bypassed' that are in 'consumed'
# Suppose the target type of current generator, X is produced from
# X_1 and X_2, which are produced from Y by one generator.
# When creating X_1 from Y, X_2 will be added to 'bypassed'
# Likewise, when creating X_2 from Y, X_1 will be added to 'bypassed'
# But they are also in 'consumed'. We have to remove them from
# bypassed, so that generators up the call stack don't try to convert
# them.
# In this particular case, X_1 instance in 'consumed' and X_1 instance
# in 'bypassed' will be the same: because they have the same source and
# action name, and 'virtual-target.register' won't allow two different
# instances. Therefore, it's OK to use 'set.difference'.
def set_library_order (manager, sources, prop_set, result):
used_libraries = []
deps = prop_set.dependency ()
sources.extend(d.value for d in deps)
sources = sequence.unique(sources)
for l in sources:
if l.type () and type.is_derived (l.type (), 'LIB'):
used_libraries.append (l)
created_libraries = []
for l in result:
if l.type () and type.is_derived (l.type (), 'LIB'):
created_libraries.append (l)
created_libraries = set.difference (created_libraries, used_libraries)
set_library_order_aux (created_libraries, used_libraries)
# it might be special generator like builtin.lib-generator
# which just relays to other generators. Return '*' to
# indicate that any source type is possibly OK, since we don't
# know for sure.
return ['*']
else:
result = []
for s in source_types:
viable_sources = viable_source_types(s)
if viable_sources == "*":
result = ["*"]
break
else:
result.extend(type.all_derived(s) + viable_sources)
return unique(result)
required[r.feature] = r
for p in properties:
# Skip conditional properties
if p.condition:
result.add(p)
# No processing for free properties
elif p.feature.free:
result.add(p)
else:
if p.feature in required:
result.add(required[p.feature])
else:
result.add(p)
return sequence.unique(list(result) + requirements)
transformed = construct_types (project, name, missing_types, prop_set, sources)
# Add targets of right type to 'consumed'. Add others to
# 'bypassed'. The 'generators.construct' rule has done
# its best to convert everything to the required type.
# There's no need to rerun it on targets of different types.
# NOTE: ignoring usage requirements
for t in transformed[1]:
if t.type() in missing_types:
consumed.append(t)
else:
bypassed.append(t)
consumed = unique(consumed)
bypassed = unique(bypassed)
# remove elements of 'bypassed' that are in 'consumed'
# Suppose the target type of current generator, X is produced from
# X_1 and X_2, which are produced from Y by one generator.
# When creating X_1 from Y, X_2 will be added to 'bypassed'
# Likewise, when creating X_2 from Y, X_1 will be added to 'bypassed'
# But they are also in 'consumed'. We have to remove them from
# bypassed, so that generators up the call stack don't try to convert
# them.
# In this particular case, X_1 instance in 'consumed' and X_1 instance
# in 'bypassed' will be the same: because they have the same source and
# action name, and 'virtual-target.register' won't allow two different
# instances. Therefore, it's OK to use 'set.difference'.
and subvariants referred by properties.
For all targets which are of type 'target-type' (or for all targets,
if 'target_type' is not specified), the result will contain
<$(feature)>path-to-that-target.
"""
if not target_type:
key = feature
else:
key = feature + "-" + target_type
result = self.implicit_includes_cache_.get(key)
if not result:
target_paths = self.all_target_directories(target_type)
target_paths = unique(target_paths)
result = ["<%s>%s" % (feature, p) for p in target_paths]
self.implicit_includes_cache_[key] = result
return result
transformed = construct_types (project, name, missing_types, prop_set, sources)
# Add targets of right type to 'consumed'. Add others to
# 'bypassed'. The 'generators.construct' rule has done
# its best to convert everything to the required type.
# There's no need to rerun it on targets of different types.
# NOTE: ignoring usage requirements
for t in transformed[1]:
if t.type() in missing_types:
consumed.append(t)
else:
bypassed.append(t)
consumed = unique(consumed)
bypassed = unique(bypassed)
# remove elements of 'bypassed' that are in 'consumed'
# Suppose the target type of current generator, X is produced from
# X_1 and X_2, which are produced from Y by one generator.
# When creating X_1 from Y, X_2 will be added to 'bypassed'
# Likewise, when creating X_2 from Y, X_1 will be added to 'bypassed'
# But they are also in 'consumed'. We have to remove them from
# bypassed, so that generators up the call stack don't try to convert
# them.
# In this particular case, X_1 instance in 'consumed' and X_1 instance
# in 'bypassed' will be the same: because they have the same source and
# action name, and 'virtual-target.register' won't allow two different
# instances. Therefore, it's OK to use 'set.difference'.
s = [t.creating_subvariant() for t in targets]
s = unique(s)
result = set(targets)
for i in s:
i.all_referenced_targets(result)
result2 = []
for r in result:
if isinstance(r, property.Property):
if r.feature().name() != 'use':
result2.append(r.value())
else:
result2.append(r)
result2 = unique(result2)
return result2
def register (g):
""" Registers new generator instance 'g'.
"""
assert isinstance(g, Generator)
id = g.id()
__generators [id] = g
# A generator can produce several targets of the
# same type. We want unique occurence of that generator
# in .generators.$(t) in that case, otherwise, it will
# be tried twice and we'll get false ambiguity.
for t in sequence.unique(g.target_types()):
__type_to_generators.setdefault(t, []).append(g)
# Update the set of generators for toolset
# TODO: should we check that generator with this id
# is not already registered. For example, the fop.jam
# module intentionally declared two generators with the
# same id, so such check will break it.
# Some generators have multiple periods in their name, so the
# normal $(id:S=) won't generate the right toolset name.
# e.g. if id = gcc.compile.c++, then
# .generators-for-toolset.$(id:S=) will append to
# .generators-for-toolset.gcc.compile, which is a separate
# value from .generators-for-toolset.gcc. Correcting this
# makes generator inheritance work properly.