Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MobileNativeFoundation/rules_xcodeproj/llms.txt
Use this file to discover all available pages before exploring further.
top_level_target and top_level_targets are helper macros for specifying which Bazel targets to include as top-level entries in the generated Xcode project. Top-level targets appear as runnable/testable schemes in Xcode and drive the build graph that rules_xcodeproj models. Load them alongside xcodeproj in your BUILD file:
top_level_target
Constructs a single top-level target descriptor for use in xcodeproj.top_level_targets.
Signature
struct containing the provided label and target_environments fields.
Parameters
A
Label or label-like string identifying the Bazel target to include as a top-level entry in the project.A list of target environment strings that controls which environments the target is configured for. Valid values are:Default:
"device"— physical hardware (e.g. iPhone, iPad, Apple Watch)"simulator"— Xcode Simulator
"device" and "simulator" are listed, rules_xcodeproj creates a single combined Xcode target if the two configured variants are meaningfully different (e.g. different architectures). If the configurations are identical for both environments (e.g. a macOS target), separate but similar Xcode targets are created instead. Passing an empty list is treated the same as ["simulator"]."catalyst" is not currently supported as a target_environment value.["simulator"]Example
top_level_targets
Constructs a list of top-level target descriptors that all share the same target_environments. This is a convenience shorthand for calling top_level_target repeatedly with the same environments.
Signature
list of struct values, equivalent to calling top_level_target(label, target_environments = target_environments) for every label in labels.
Parameters
A list of
Label or label-like strings for the targets to include as top-level entries.A list of target environment strings applied to every label in
labels. See top_level_target.target_environments for valid values and behavior.Default: ["simulator"]Example
Mixing target specifications
The
xcodeproj.top_level_targets attribute accepts a flat mix of plain label strings, top_level_target() return values, and top_level_targets() return values in the same list. Use whichever form is clearest for each target.