Skip to content

Bug: "Extract app intents metadata" fails on Xcode 16.3 #3171

@marcelofabri

Description

@marcelofabri

Description

This was introduced on Xcode 16.3 and afaict only affects library schemes.

When building a library scheme (CMD + B), I get errors in the "Extract app intents metadata" step (which seems to be added/managed by Xcode):

    cd /var/tmp/_bazel_marcelo.fabri/1aa5054588dbdef9e7534a2972fca9b5/rules_xcodeproj.noindex/build_output_base/execroot/_main
    /Applications/Xcode-16.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/appintentsmetadataprocessor --toolchain-dir /Applications/Xcode-16.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain --module-name SwiftLintCore --sdk-root /Applications/Xcode-16.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk --xcode-version 16E140 --platform-family macOS --deployment-target 13.5 --output /Users/marcelo.fabri/Library/Developer/Xcode/DerivedData/SwiftLint-goubhwswxpjkjgbfnvncdbjhnvyd/Build/Products/Debug/bazel-out/darwin_arm64-dbg-ST-9a5aec5712f9/bin/SwiftLintCore.appintents --target-triple arm64-apple-macos13.5 --binary-file /Users/marcelo.fabri/Library/Developer/Xcode/DerivedData/SwiftLint-goubhwswxpjkjgbfnvncdbjhnvyd/Build/Products/Debug/bazel-out/darwin_arm64-dbg-ST-9a5aec5712f9/bin/libSwiftLintCore.a --dependency-file /Users/marcelo.fabri/Library/Developer/Xcode/DerivedData/SwiftLint-goubhwswxpjkjgbfnvncdbjhnvyd/Build/Intermediates.noindex/SwiftLint.build/bazel-out/darwin_arm64-dbg-ST-9a5aec5712f9/bin/SwiftLintCore/Objects-normal/arm64/SwiftLintCore_libtool_dependency_info.dat --stringsdata-file /Users/marcelo.fabri/Library/Developer/Xcode/DerivedData/SwiftLint-goubhwswxpjkjgbfnvncdbjhnvyd/Build/Intermediates.noindex/SwiftLint.build/bazel-out/darwin_arm64-dbg-ST-9a5aec5712f9/bin/SwiftLintCore/Objects-normal/arm64/ExtractedAppShortcutsMetadata.stringsdata --source-file-list /Users/marcelo.fabri/Library/Developer/Xcode/DerivedData/SwiftLint-goubhwswxpjkjgbfnvncdbjhnvyd/Build/Intermediates.noindex/SwiftLint.build/bazel-out/darwin_arm64-dbg-ST-9a5aec5712f9/bin/SwiftLintCore/Objects-normal/arm64/SwiftLintCore.SwiftFileList --metadata-file-list /Users/marcelo.fabri/Library/Developer/Xcode/DerivedData/SwiftLint-goubhwswxpjkjgbfnvncdbjhnvyd/Build/Intermediates.noindex/SwiftLint.build/bazel-out/darwin_arm64-dbg-ST-9a5aec5712f9/bin/SwiftLintCore/SwiftLintCore.DependencyMetadataFileList --static-metadata-file-list /Users/marcelo.fabri/Library/Developer/Xcode/DerivedData/SwiftLint-goubhwswxpjkjgbfnvncdbjhnvyd/Build/Intermediates.noindex/SwiftLint.build/bazel-out/darwin_arm64-dbg-ST-9a5aec5712f9/bin/SwiftLintCore/SwiftLintCore.DependencyStaticMetadataFileList --swift-const-vals-list /Users/marcelo.fabri/Library/Developer/Xcode/DerivedData/SwiftLint-goubhwswxpjkjgbfnvncdbjhnvyd/Build/Intermediates.noindex/SwiftLint.build/bazel-out/darwin_arm64-dbg-ST-9a5aec5712f9/bin/SwiftLintCore/Objects-normal/arm64/SwiftLintCore.SwiftConstValuesFileList --force --deployment-aware-processing --validate-assistant-intents --no-app-shortcuts-localization

2025-04-19 23:09:21.080 appintentsmetadataprocessor[57127:5968754] Starting appintentsmetadataprocessor export
2025-04-19 23:09:21.108 appintentsmetadataprocessor[57127:5968754] error: At least one halting error produced during export. No AppIntents metadata have been exported and this target is not usable with AppIntents until errors are resolved.
error: Unable to parse compiler-emitted metadata at `file:///Users/marcelo.fabri/Library/Developer/Xcode/DerivedData/SwiftLint-goubhwswxpjkjgbfnvncdbjhnvyd/Build/Intermediates.noindex/SwiftLint.build/bazel-out/darwin_arm64-dbg-ST-9a5aec5712f9/bin/SwiftLintCore/Objects-normal/arm64/Array+SwiftLint.swiftconstvalues`: The file “Array+SwiftLint.swiftconstvalues” couldn’t be opened because there is no such file.
error: Unable to parse compiler-emitted metadata at `file:///Users/marcelo.fabri/Library/Developer/Xcode/DerivedData/SwiftLint-goubhwswxpjkjgbfnvncdbjhnvyd/Build/Intermediates.noindex/SwiftLint.build/bazel-out/darwin_arm64-dbg-ST-9a5aec5712f9/bin/SwiftLintCore/Objects-normal/arm64/ByteCount+SwiftSyntax.swiftconstvalues`: The file “ByteCount+SwiftSyntax.swiftconstvalues” couldn’t be opened because there is no such file.

Reproduction steps

  1. Checkout realm/SwiftLint@ad23d08
  2. Run bazel run //bazel:xcodeproj
  3. Open SwiftLint.xcodeproj
  4. Build the SwiftLintCore scheme

Expected behavior

It should compile without any issues

rules_xcodeproj version

2.11.2

Xcode version

16.3

Bazel version

7.0.0

rules_apple version

3.20.1

rules_swift version

2.8.1

Additional information

Applying this patch fixes the issue for us, but not sure what would be the other consequences in Xcode, especially for projects that do use one of the protocols listed in https://github.com/bazelbuild/rules_swift/blob/master/swift/toolchains/config/const_protocols_to_gather.json

diff --git tools/generators/target_build_settings/src/Generator/ProcessSwiftArgs.swift tools/generators/target_build_settings/src/Generator/ProcessSwiftArgs.swift
index 9c40792a..3d3cb0fd 100644
--- tools/generators/target_build_settings/src/Generator/ProcessSwiftArgs.swift
+++ tools/generators/target_build_settings/src/Generator/ProcessSwiftArgs.swift
@@ -317,6 +317,10 @@ extension Generator.ProcessSwiftArgs {
             ("OTHER_SWIFT_FLAGS", args.joined(separator: " ").pbxProjEscaped)
         )
 
+        buildSettings.append(
+            ("SWIFT_ENABLE_EMIT_CONST_VALUES", "NO")
+        )
+
         return (
             hasDebugInfo,
             clangArgs,

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions