ConfiguredTargetSet
A set-like object for managing buck2 target nodes. It can be either ConfiguredTargetSet
or UnConfiguredTargetSet
where contains either ConfiguredTargetNode
or UnconfiguredTargetNode
respectively.
It provides common set operations for target nodes. It supports iteration, indexing, addition (union), subtraction (difference), equality comparison, and intersection operations.
Operations:
+
: Union of two TargetSets-
: Difference between two TargetSets==
: Equality comparison&
: Intersection of two TargetSets[]
: Index accesslen()
: Number of targets in setiter()
: Iteration over targets- constructor:
bxl.ctarget_set()
forConfiguredTargetSet
andbxl.utarget_set()
forUnconfiguredTargetSet
Example:
# Combine sets
all_targets = targets1 + targets2 # Union
# Remove targets
remaining = targets1 - targets2 # Difference
# Check if sets are equal
if targets1 == targets2:
print("Sets contain same targets")
# Iterate through targets
for target in targets1:
print(target)
# Get target by index
first_target = targets1[0]
# Get number of targets
count = len(targets1)
# Intersection of sets
common = targets1 & targets2