[gym] Add app_name parameter to skip xcodebuild -showBuildSettings#29953
Conversation
`scan` already supports `app_name` to avoid calling `xcodebuild -showBuildSettings`, but `gym` does not. In `gym`, `build_command_generator.rb` calls `Gym.project.app_name` to generate the xcodebuild log file name. This triggers `xcodebuild -showBuildSettings`, which can take 7+ minutes on large workspaces with 1200+ targets. Adding an `app_name` parameter allows users to skip the expensive `showBuildSettings` call by providing the value directly, following the same pattern as `scan`. Resolves the gym-side of the problem described in fastlane#20897.
There was a problem hiding this comment.
Pull request overview
Adds an optional app_name configuration to gym so users can control the generated xcodebuild logfile name and avoid deriving the app name via Gym.project.app_name (which can trigger an expensive xcodebuild -showBuildSettings call).
Changes:
- Add
app_nameas a new optionalgymconfig option (GYM_APP_NAME). - Update
Gym::BuildCommandGenerator.xcodebuild_log_pathto preferGym.config[:app_name]overGym.project.app_name. - Add a spec covering
xcodebuild_log_pathwhenapp_nameis provided.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| gym/lib/gym/options.rb | Introduces the new app_name config item for gym. |
| gym/lib/gym/generators/build_command_generator.rb | Uses app_name to construct the xcodebuild logfile name. |
| gym/spec/build_command_generator_spec.rb | Adds test coverage for logfile naming with app_name. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
iBotPeaches
left a comment
There was a problem hiding this comment.
thanks! I dispatched Copilot - could you help me understand the flow path that xcodebuild -showBuildSettings was called prior to this change? I look at your diff and not seeing how it skips that expensive call.
Apologies if its obvious - I'm just not seeing it.
You'll want to check this test as its failing across the fleet - 1) Gym Gym::BuildCommandGenerator Derived Data Example uses the correct build command with the example project
f23925f to
bfab287
Compare
|
Thanks for the quick review and for dispatching Copilot, @iBotPeaches! Happy to explain the flow. How
So whenever With this change, when As a note, Regarding the failing test — I also fixed the I have addressed the Copilot suggestions as well — updated the description wording, removed |
- Remove requires_xcodebuild tag since test only checks path construction - Add expect(Gym.project).not_to receive(:app_name) to verify build settings lookup is skipped when app_name is provided
|
Addressing Copilot feedback: #1 (description wording): Updated to #3 (test assertion): Added #4 (requires_xcodebuild): Kept |
Gym.config= triggers detect_platform which requires Xcode. Mark test as requires_xcodebuild to skip on Ubuntu CI.
|
thanks! That makes sense. I missed that |
Use || operator instead of if/else as suggested in review.
|
CI looks good as well. Just will peek issues to see if we can close any issue with this PR and merge later today. |
There was a problem hiding this comment.
Hey @Goeun1001 👋
Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a month, and your PR will be included in the next one.
Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀"
There was a problem hiding this comment.
Congratulations! 🎉 This was released as part of fastlane 2.233.0 🚀
Checklist
bundle exec rspecfrom the root directory to see all new and existing tests passbundle exec rubocop -ato ensure the code style is validci/circlecibuilds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)Motivation and Context
scanalready supports anapp_nameparameter that allows skippingxcodebuild -showBuildSettings(#20898, #20897), butgymdoes not.In
gym,build_command_generator.rbcallsGym.project.app_nameto generate the xcodebuild log file name. This triggersxcodebuild -showBuildSettings, which can take 7+ minutes on large workspaces (1200+ targets) and frequently causes timeouts in CI environments.When users already know their app name, there is no need to invoke this expensive command just to derive a log file name.
Description
gym/lib/gym/options.rb: Addedapp_nameoptional parameter (same pattern asscan'sapp_name)gym/lib/gym/generators/build_command_generator.rb: UseGym.config[:app_name]when available, fall back toGym.project.app_namegym/spec/build_command_generator_spec.rb: Added unit test forapp_nameinxcodebuild_log_pathThis is a minimal, backward-compatible change — the parameter is optional and falls back to the existing behavior when not provided.
Testing Steps
Specify
app_namein gym config:Expected Result: gym does not call
xcodebuild -showBuildSettingsWithout
app_name, behavior is unchanged.