Skip to content

Swift library is getting invalidated and recompiled when private headers change in Objective-C dependency #1301

Open
@ivan-golub

Description

@ivan-golub

Likely coming from

transitive_inputs.append(compilation_context.headers)
includes all private and public transitive headers.

Running bazel aquery "deps(//examples/apple/objc_interop:Printer)" confirms Private.h header that is in srcs (ie private) is part of inputs of Compiling Swift module //examples/apple/objc_interop:Printer action

action 'Compiling Swift module //examples/apple/objc_interop:Printer'
  Mnemonic: SwiftCompile
  Target: //examples/apple/objc_interop:Printer
  Configuration: darwin_arm64-fastbuild
  Execution platform: @platforms//host:host
  ActionKey: f65865cb7a00d8996f036bcd31777ff98e6e2ac928c348fdd6fa8c89dd1dfb2e
  Inputs: [bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/PrintStream_modulemap/_/module.modulemap, bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/Printer.output_file_map.json, bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/tools/worker/worker, bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/internal/_middlemen/tools_Sworker_Sworker-runfiles, examples/apple/objc_interop/OIPrintStream.h, examples/apple/objc_interop/Printer.swift, examples/apple/objc_interop/Private.h, swift/toolchains/config/const_protocols_to_gather.json]
  Outputs: [bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/Printer.macro-expansions (TreeArtifact), bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/Printer_objs/Printer.swift.o, bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/Printer_objs/Printer.swift.swiftconstvalues, bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/examples_apple_objc_interop_Printer.swiftdoc, bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/examples_apple_objc_interop_Printer.swiftmodule, bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/examples_apple_objc_interop_Printer.swiftsourceinfo, bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/generated_header/Printer-Swift.h]
  Environment: [APPLE_SDK_PLATFORM=MacOSX, APPLE_SDK_VERSION_OVERRIDE=14.0, PATH=/bin:/usr/bin:/usr/local/bin, XCODE_VERSION_OVERRIDE=15.0.0.15A240d]
  Command Line: (exec bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/tools/worker/worker \
    swiftc \
    -target \
    arm64-apple-macos13.0 \
    -sdk \
    __BAZEL_XCODE_SDKROOT__ \
    -debug-prefix-map \
    '__BAZEL_XCODE_DEVELOPER_DIR__=/PLACEHOLDER_DEVELOPER_DIR' \
    -file-prefix-map \
    '__BAZEL_XCODE_DEVELOPER_DIR__=/PLACEHOLDER_DEVELOPER_DIR' \
    '-Xwrapped-swift=-bazel-target-label=@@//examples/apple/objc_interop:Printer' \
    -emit-object \
    -output-file-map \
    bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/Printer.output_file_map.json \
    -Xfrontend \
    -no-clang-module-breadcrumbs \
    -emit-module-path \
    bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/examples_apple_objc_interop_Printer.swiftmodule \
    -emit-objc-header-path \
    bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/generated_header/Printer-Swift.h \
    -emit-const-values-path \
    bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/Printer_objs/Printer.swift.swiftconstvalues \
    -Xfrontend \
    -const-gather-protocols-file \
    -Xfrontend \
    swift/toolchains/config/const_protocols_to_gather.json \
    -DDEBUG \
    -Onone \
    -Xfrontend \
    -no-serialize-debugging-options \
    -enable-testing \
    -gline-tables-only \
    '-Xwrapped-swift=-debug-prefix-pwd-is-dot' \
    '-Xwrapped-swift=-file-prefix-pwd-is-dot' \
    -module-cache-path \
    bazel-out/darwin_arm64-fastbuild/bin/_swift_module_cache \
    '-Xwrapped-swift=-macro-expansion-dir=bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/Printer.macro-expansions' \
    -Xcc \
    -iquote. \
    -Xcc \
    -iquotebazel-out/darwin_arm64-fastbuild/bin \
    -Xcc \
    '-fmodule-map-file=bazel-out/darwin_arm64-fastbuild/bin/examples/apple/objc_interop/PrintStream_modulemap/_/module.modulemap' \
    -Xfrontend \
    -color-diagnostics \
    -enable-batch-mode \
    -module-name \
    examples_apple_objc_interop_Printer \
    -enable-bare-slash-regex \
    -parse-as-library \
    -static \
    -Xcc \
    -O0 \
    -Xcc \
    '-DDEBUG=1' \
    examples/apple/objc_interop/Printer.swift)
# Configuration: ed8e8684eb5cd4576c9547de6ce9b0f2ecde34f2a5ec7d6f3d71fa9ce8a87dbf
# Execution platform: @@platforms//host:host
  ExecutionInfo: {requires-darwin: '', requires-worker-protocol: json, supports-workers: 1, supports-xcode-requirements-set: ''}

Repro: ivan-golub#1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions