MobileNativeFoundation / rules_xcodeproj

Bazel rules for generating Xcode projects.
MIT License
528 stars 86 forks source link

Bug: Internal precondition failure when generating xcode project. #3090

Open ztzhang opened 2 months ago

ztzhang commented 2 months ago

Description

Under incremental generation mode, we hit Internal precondition failure when generating the xcode project. Specifically, the top level target is an ios_application with extensions. The error seems to indicate when creating scheme, the extension target ID is not found:

tools/generators/xcschemes/src/Generator/CreateScheme.swift:181: Extension Target ID "@@//:example_extension ios_arm64-dbg-ios-arm64-min18.0-applebin_ios-ST-a34dd529b319" not found in:
[@@//:example_control_widget ios_arm64-dbg-ios-arm64-min18.0-applebin_ios-ST-a34dd529b319, @@//:example_control_widget ios_sim_arm64-dbg-ios-sim_arm64-min18.0-applebin_ios-ST-3e8967f1473a]
Please file a bug report at https://github.com/MobileNativeFoundation/rules_xcodeproj/issues/new?template=bug.md

The project generation works fine if I set generation_mode = "legacy". But under legacy mode, building the project inside xcode will throw an error suggeting ld in the sandbox does not have the right permission:

error: unable to spawn process  `PATH_TO_PROJECT/example.xcodeproj/rules_xcodeproj/bazel/ld' (permission denied).

Indeed, ld only has permission -rw-r--r--. It goes away when I mannually grant +x permission.

Reproduction steps

Here's a self-contained, reproducible repo: https://github.com/ztzhang/rules_xcodeproj_bug.

Expected behavior

Project generation works as expected, and build inside xcode works as expected.

rules_xcodeproj version

2.6.1, or 2.7.0

Xcode version

16.1 (beta) or 16.0

Bazel version

7.1.0

rules_apple version

3.8.0

rules_swift version

No response

Additional information

No response