Skip to main content

apple_selective_debugging

An apple_selective_debugging() rule configures which targets have debug information included in the final binary. By specifying include/exclude patterns for build targets or regular expressions, you can reduce binary size by stripping debug info from dependencies you don't need to debug.

Function Signature​

def apple_selective_debugging(
*,
name: str,
default_target_platform: None | str = None,
target_compatible_with: list[str] = [],
compatible_with: list[str] = [],
exec_compatible_with: list[str] = [],
visibility: list[str | target_name_glob] = [],
within_view: list[str | target_name_glob] = ["PUBLIC"],
metadata: OpaqueMetadata = {},
tests: list[str] = [],
modifiers: OpaqueMetadata = [],
_apple_tools: str = "prelude//apple/tools:apple-tools",
exclude_build_target_patterns: list[str] = [],
exclude_regular_expressions: list[str] = [],
filtering_strategy: str = "scrub_binary",
include_build_target_patterns: list[str] = [],
include_regular_expressions: list[str] = [],
json_type: str,
targets_json_file: None | str = None,
) -> None

Parameters​

  • name: (required)

    name of the target

  • default_target_platform: (defaults to: None)

    specifies the default target platform, used when no platforms are specified on the command line

  • target_compatible_with: (defaults to: [])

    a list of constraints that are required to be satisfied for this target to be compatible with a configuration

  • compatible_with: (defaults to: [])

    a list of constraints that are required to be satisfied for this target to be compatible with a configuration

  • exec_compatible_with: (defaults to: [])

    a list of constraints that are required to be satisfied for this target to be compatible with an execution platform

  • visibility: (defaults to: [])

    a list of visibility patterns restricting what targets can depend on this one

  • within_view: (defaults to: ["PUBLIC"])

    a list of visibility patterns restricting what this target can depend on

  • metadata: (defaults to: {})

    a key-value map of metadata associated with this target

  • tests: (defaults to: [])

    a list of targets that provide tests for this one

  • modifiers: (defaults to: [])

    an array of modifiers associated with this target

  • filtering_strategy: (defaults to: "scrub_binary")

    How the debug info of non-selected targets is excluded: - scrub_binary: the debug map (N_OSO entries) of the binaries of bundles is rewritten, so that the debug info of non-selected targets cannot be found. - dsym_allowlist: binaries are left untouched, only the dSYMs are restricted to the selected targets, using dsymutil --allow. Requires a dsymutil which supports that option. Debuggers that use the binary's debug map instead of the dSYM can still load the debug info of non-selected targets. Bundle binaries without debug info to select from (no AppleDebuggableInfo) are still scrubbed.