bazelbuild / bazelbuild/rules_apple
Conflicting outputs when building with --define=apple.experimental.tree_artifact_outputs=1
- Dominant language
- Starlark
- Stars
- 593
- Forks
- 334
- Avg merge
- 16h 48m
- Merged PRs (30d)
- 9
Description
When two application targets decared in the same BUILD file are built together with `--define=apple.experimental.tree_artifact_outputs=1`, each having the same bundle name, the Bazel build fails.
There are no build failures when building via `--define=apple.experimental.tree_artifact_outputs=0`.
**Repro:**
```
bazel build :HelloWorld :HelloWorld-Beta --define=apple.experimental.tree_artifact_outputs=1
```
[repro.zip](https://github.com/bazelbuild/rules_apple/files/11081049/repro.zip)
Error Log:
```
ERROR: file 'HelloWorld.app' is generated by these conflicting actions:
Label: //:HelloWorld, //:HelloWorld-Beta
RuleClass: ios_application rule
JavaActionClass: class com.google.devtools.build.lib.analysis.actions.StarlarkAction
Configuration: 0b98b517ca42c5fd26fcd2bcd166b34b84a6c22d2344086c2b3e749c2e8193bd
Mnemonic: BundleTreeApp
Action key: aeea3ae6c1de92c04bf14fc9789d875fa978bde7697a00b35637df7193cd88d7, 8c54878f5e170eaf4fdacf9ae53e8b606ba3b206523bef761a4e48771b412ac4
Progress message: Bundling, processing and signing HelloWorld, Bundling, processing and signing HelloWorld-Beta
Action describeKey: Bundling, processing and signing HelloWorld
Environment variable: XCODE_VERSION_OVERRIDE=14.1.0.14B47b
Environment variable: APPLE_SDK_VERSION_OVERRIDE=16.1
Environment variable: APPLE_SDK_PLATFORM=iPhoneSimulator
Argument: bazel-out/darwin_arm64-opt-exec-2B5CBBC6-ST-521287fc850f/bin/external/build_bazel_rules_apple/tools/bundletool/bundletool_experimental
Argument: bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-bc46a42dbfe8/bin/HelloWorld-intermediates/bundletool_control.json
, Bundling, processing and signing HelloWorld-Beta
Environment variable: XCODE_VERSION_OVERRIDE=14.1.0.14B47b
Environment variable: APPLE_SDK_VERSION_OVERRIDE=16.1
Environment variable: APPLE_SDK_PLATFORM=iPhoneSimulator
Argument: bazel-out/darwin_arm64-opt-exec-2B5CBBC6-ST-521287fc850f/bin/external/build_bazel_rules_apple/tools/bundletool/bundletool_experimental
Argument: bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-bc46a42dbfe8/bin/HelloWorld-Beta-intermediates/bundletool_control.json
PrimaryInput: File:[/private/var/tmp/_bazel_chirag.ramani/5646a08425b0ad6703d2a0a3bcdd60c2/external/build_bazel_rules_apple[source]]tools/bundletool/bundletool_experimental.py
PrimaryOutput: File:[[]bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-bc46a42dbfe8/bin]HelloWorld.app
Owner information: ConfiguredTargetKey{label=//:HelloWorld, config=BuildConfigurationKey[0b98b517ca42c5fd26fcd2bcd166b34b84a6c22d2344086c2b3e749c2e8193bd]}, ConfiguredTargetKey{label=//:HelloWorld-Beta, config=BuildConfigurationKey[0b98b517ca42c5fd26fcd2bcd166b34b84a6c22d2344086c2b3e749c2e8193bd]}
MandatoryInputs: Attempted action contains artifacts not in previous action (first 5):
HelloWorld-intermediates/HelloWorld
HelloWorld-intermediates/storyboards/HelloWorld
HelloWorld-intermediates/Info.plist
HelloWorld-intermediates/PkgInfo
HelloWorld-intermediates/bundletool_control.json
Previous action contains artifacts not in attempted action (first 5):
HelloWorld-Beta-intermediates/HelloWorld
HelloWorld-Beta-intermediates/storyboards/HelloWorld-Beta
HelloWorld-Beta-intermediates/Info.plist
HelloWorld-Beta-intermediates/PkgInfo
HelloWorld-Beta-intermediates/bundletool_control.json
Outputs: are equal
ERROR: com.google.devtools.build.lib.actions.MutableActionGraph$ActionConflictException: for HelloWorld.app, previous action: action 'Bundling, processing and signing HelloWorld-Beta', attempted action: action 'Bundling, processing and signing HelloWorld'
```
Contributor guide
Research direction
Unpack repro.zip and run the reported `bazel build :HelloWorld :HelloWorld-Beta --define=apple.experimental.tree_artifact_outputs=1` command. Start with tools/bundletool/bundletool_experimental.py and the generated bundletool_control.json files, using the conflict log to compare both actions. Done means the two application targets build together without a conflicting `HelloWorld.app` output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios
- Domain
- build-system, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100