rules_xcodeproj exposes two Starlark providers that rules can return to control how theDocumentation 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.
xcodeproj aspect processes their targets. These are the primary extension points for integrating custom Bazel rules with the Xcode project generator.
XcodeProjAutomaticTargetProcessingInfo
XcodeProjAutomaticTargetProcessingInfo is returned by a target to control how the xcodeproj aspect’s automatic target processing discovers source files, resources, headers, and nested Xcode targets. This is the primary extension point for adapting custom rules to work with rules_xcodeproj.
When a target returns this provider, the aspect uses it instead of its built-in heuristics to determine how the target should appear in the generated Xcode project.
Fields
A sequence of attribute names to collect
Files from for srcs-like attributes. The files found under these attributes are treated as source files in the Xcode target.A sequence of attribute names to collect
Files from for non_arc_srcs-like attributes. Used for Objective-C source files that should be compiled without Automatic Reference Counting (ARC).A sequence of attribute names to collect
Files from to include in the project that don’t fall under other categorized attributes. Use this for headers, module maps, plists, and other non-compiled inputs you want visible in Xcode.A sequence of attribute names to collect
Targets from for deps-like attributes. The aspect traverses these attributes to discover transitive dependencies.A sequence of attribute names to collect
Targets from for implementation_deps-like attributes. These are treated as private dependencies that are not exposed to dependents.A
dict mapping attribute names to a list of target type strings (e.g. "compile" or None). Only Xcode targets from the specified attributes with a matching target type are allowed to propagate into the generated project. Use this to control which nested targets become their own Xcode targets.Categorizes the type of target. Use
"compile" for targets that produce compiled output (libraries, binaries, bundles). Set to None to prevent the target from producing an Xcode target, while still allowing its inputs to be collected if other fields are set.Whether an Xcode target can be generated for this target. Even if
False, setting values for the other attributes can still cause inputs to be collected and shown in the Xcode project.Whether this target is a top-level (e.g. bundled app or executable) target. Top-level targets can be listed directly in the
top_level_targets attribute of xcodeproj.A list representing the command-line arguments that this target should execute or test with. Only meaningful for executable or test targets.
A
dict representing the environment variables that this target should execute or test with.The effective
Label to use for the target. This should generally be target.label, but in the case of skipped wrapper rules (e.g. *_unit_test targets), you might want to rename the target to the wrapped target’s label.An attribute name (or
None) to collect the bundle ID string from.An attribute name (or
None) to collect application icons from.An attribute name (or
None) to collect Files from for the entitlements-like attribute.An attribute name (or
None) to collect Files from for the provisioning_profile-like attribute.Whether to collect files from uncategorized attributes and include them in the project.
Whether this target is a mixed-language target (i.e. contains both Swift and Objective-C sources).
Whether this target contains no source files and only exposes headers.
A sequence of mnemonic (action) names used to gather link parameters. The first action that matches any of the mnemonics is used.
Example
The following shows a custom rule returningXcodeProjAutomaticTargetProcessingInfo to tell the aspect how to process it:
XcodeProjInfo
XcodeProjInfo is returned by targets to provide rich metadata to the xcodeproj aspect about how a target should be represented in the generated project. It carries depsets of structured data — compiled outputs, dependencies, LLDB context, output groups, and more — that the aspect accumulates as it traverses the build graph.
XcodeProjInfo is primarily an informational provider propagated by the aspect itself. For most custom rule use cases, returning XcodeProjAutomaticTargetProcessingInfo is the correct extension point. Use XcodeProjInfo only when you need full control over how a target and its dependencies are processed.Fields
The
Label of the target.A string that categorizes the type of the current target. This will be one of
"compile", "resources", or None. Even if this target doesn’t produce an Xcode target, it can still have a non-None value for this field.A value from
xcode_targets.make if this target can produce an Xcode target.A
depset of values from xcode_targets.make, which potentially will become targets in the Xcode project.A value from
input_files.collect/input_files.merge that contains information related to all input Files for the project collected so far. It also includes information about “extra files” that should be added to the Xcode project but are not associated with any targets.A value from
output_files.collect/output_files.merge that contains information about the output files for this target and its transitive dependencies.A
depset of target IDs that this target directly depends on.A
depset of target IDs that this target transitively depends on.A
depset of label strings of focused targets. This will include the current target (if focused) and any focused dependencies of the current target.A
depset of structs with id and label fields representing the transitive focused library dependencies of the target. Top-level targets use this field to determine the value of top_level_focused_deps.A
depset of structs with id, label, and deps fields. Used to allow custom schemes (see the xcschemes module) to include the correct versions of library targets.A
depset of structs with id and arg fields containing command-line argument values per target ID.A
depset of structs with id and env fields containing environment variable values per target ID.A
depset of structs with id and infoplist fields. The id is the target ID of the application extension, and infoplist is its Info.plist File.A
depset of structs with host and hosted fields, mapping host target IDs to their hosted target IDs (e.g. app extensions hosted by an app).A
depset of apple_platforms that this target and its transitive dependencies are built for.A
depset of tuples mapping target ID to bundle ID for resource bundle targets.A value from
compilation_providers.{collect,merge} carrying compiler flag and search path information.A value from
lldb_context.collect used to configure LLDB for debugging targets built with Bazel.A
depset of Swift debug settings Files produced by pbxproj_partials.write_target_build_settings.A
depset of tuples of an LLDB context key and Swift debug settings Files. Empty for non-top-level targets.A value from
output_groups.collect/output_groups.merge containing information related to Build with Bazel (BwB) mode output groups.A
depset of target IDs, each representing a target that can potentially be merged into a top-level target (determined by the top-level target).A
depset of structs containing information about targets that can potentially be merged into a top-level target.A
depset of tuples where the first element is the target ID being merged into and the second is a list of target IDs that have been merged into it.A
depset of (linker_path, product_path) tuples mapping linker-visible framework paths to their full built product paths.If this target is not a top-level target, this is the value from
ctx.rule.kind; otherwise None. Used to prevent library targets from being mistakenly listed as top-level targets.