MobileNativeFoundation / rules_xcodeproj

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

Use sub-params file for incremental link params processor #2878

Closed polac24 closed 9 months ago

polac24 commented 9 months ago

Rehash of https://github.com/MobileNativeFoundation/rules_xcodeproj/pull/1862 for incremental_link_params_processor.py

Problem

In a step for cache population for a massive application we get "Argument list too long" also from incremental_link_params_processor. (command: bazel run //:name.xcodeproj -- --generator_output_groups=all_targets build)

Action failed to execute: java.io.IOException: Cannot run program "...//rules_xcodeproj.noindex/build_output_base/execroot/register"): error=7, Argument list too long
...

BAZEL ERROR
ERROR: .../BUILD.bazel:373:19: Generating bazel-out/*/*-App.rules_xcodeproj.link.params failed: (Exit -1): incremental_link_params_processor failed: error executing command (from target *-App)
brentleyjones commented 9 months ago

46f7a1f47c02e8bec3398913c5d018dd3cc71da5 fixed this for the compile params. Ideally we can find a way to do the same here. The args() that we use should already turn into params files.

polac24 commented 9 months ago

@brentleyjones, thanks for referencing. I tried different features to force param files mode in linking, without success (I tested archive_param_file, linker_param_file,supports_param_files`). Let me know, if you know any other ways to workaround that.

If there is nothing available yet, can we workaround this issue with this PR?

brentleyjones commented 9 months ago

Those features would adjust how the normal linking happens. The actions already use a params file though if they don't themselves run into this issue, so instead we are probably dealing with a native rule -> starlark thing. Let me dig in more to see if there is something else we can flip before going this route.

brentleyjones commented 9 months ago

Yep, looks like this will always be broken the way it is until the rules are Starlarkified: https://github.com/bazelbuild/bazel/blob/48892ae099581d4c9ad9bab785add2c0bb17e6be/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java#L228-L242.

I'm fine with something like this change. I'll approve the PR to get it running on CI.

brentleyjones commented 9 months ago

I assume you've tested this with SwiftUI previews? Also examples/integration?

polac24 commented 9 months ago

@brentleyjones, sorry for a late response: yes, I tested SwiftUI preview in examples/integrations - works fine. Let me know if I should update something - from what I see, errors in Test - Bazel HEAD is not introduced in this PR (saw failing on other PRs too).

brentleyjones commented 9 months ago

Correct, those you can ignore.

brentleyjones commented 9 months ago

Just need another approval.