Bug: 'ERROR: Internal precondition failure' raised when generating a project containing a target with more than one dynamically generated localizable resource #2904
When generating a localizable resources directory (e.g. fr.lproj) using a custom rule, project generation works if the generated directory contains a single file, but fails if the generated directory contains more than one file.
A setup with a single file inside the generated directory works as expected:
fr.lproj
|- Localizable.strings
While a setup with more than one file inside the generated directory fails with the Internal precondition failure error:
In both cases, directly building the app target which contains the generated localizable resource directory using bazel build //Path/To:AppTarget works as expected.
The error message looks like some kind of incorrect argument offset:
ERROR: Internal precondition failure:
tools/generators/lib/PBXProj/src/ConsumeArgs.swift:168: "/Users/<username>/Developer/rules_xcodeproj/examples/integration/iOSApp/bazel-output-base/rules_xcodeproj.noindex/build_output_base/execroot/_main/bazel-out/darwin_arm64-dbg/bin/external/rules_xcodeproj~override~internal~rules_xcodeproj_generated/generator/xcodeproj-incremental-bazel-sim_arm64/xcodeproj-incremental-bazel-sim_arm64_pbxproj_partials/target_arguments_files/3": Failed to parse "iOSApp/Source/es.lproj/unprocessed.json" as Int.Type for <folder-resources-count>
Reproduction steps
Issue is consistently reproducible in the example on PR 2903.
Steps to reproduce:
cd examples/integration/iOSApp
bazel run //:xcodeproj-incremental-bazel-sim_arm64
Expected behavior
We should be able to successfully generate a project which uses a custom rule that generates more than one localizable resource file enclosed in a standard localizable resources directory like this:
Description
When generating a localizable resources directory (e.g. fr.lproj) using a custom rule, project generation works if the generated directory contains a single file, but fails if the generated directory contains more than one file.
A setup with a single file inside the generated directory works as expected:
While a setup with more than one file inside the generated directory fails with the
Internal precondition failure
error:In both cases, directly building the app target which contains the generated localizable resource directory using
bazel build //Path/To:AppTarget
works as expected.The error message looks like some kind of incorrect argument offset:
Reproduction steps
Issue is consistently reproducible in the example on PR 2903.
Steps to reproduce:
cd examples/integration/iOSApp
bazel run //:xcodeproj-incremental-bazel-sim_arm64
Expected behavior
We should be able to successfully generate a project which uses a custom rule that generates more than one localizable resource file enclosed in a standard localizable resources directory like this:
rules_xcodeproj version
e181453a45b1e64674110aa06fa81c30dec6ed19
Xcode version
15.1
Bazel version
7.0.3
rules_apple version
2.0.0
rules_swift version
1.6.0
Additional information
No response