Skip to content

[gym, scan, snapshot] Allow disabling swift packages fetches when using xcodebuild#29862

Merged
iBotPeaches merged 4 commits into
fastlane:masterfrom
alexandre-pod:feature/allow_disabling_swift_packages_fetches_when_using_xcodebuild
Jan 29, 2026
Merged

[gym, scan, snapshot] Allow disabling swift packages fetches when using xcodebuild#29862
iBotPeaches merged 4 commits into
fastlane:masterfrom
alexandre-pod:feature/allow_disabling_swift_packages_fetches_when_using_xcodebuild

Conversation

@alexandre-pod

@alexandre-pod alexandre-pod commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I see several green ci/circleci builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.
  • I've added or updated relevant unit tests.

Motivation and Context

I want to be able to give the argument -skipPackageUpdates to xcodebuild when running gym or run_tests to prevent it from fetching all packages repository.
Without this argument the execution of xcodebuild -showBuildSettings can be slow as it will first need to fetch all dependencies repository

This was attempted by #21562, but the PR is stalled since several years without update.

closes #21562

Description

No existing option allowed to add this argument to xcodebuild in all situations:

  • The option skip_package_dependencies_resolution disables the package resolution before getting the build settings of the project. This prevented an execution of xcodebuild -resolvePackageDependencies ..., but it does not gives the option -skipPackageUpdates to xcodebuild when running xcodebuild -showBuildSettings
  • The option disable_package_automatic_updates prevents xcodebuild from updating swift packages automatically, and respect the versions in Package.resolved. But this does not prevent xcodebuild from updating packages repository when used
  • The last alternative considered was to use the option xcargs and giving it the option -skipPackageUpdates. But this is option is not supported when getting build settings. (This follow the documentation saying this option is used in the build phase)

In this PR I added another option skip_package_repository_fetches that will add the -skipPackageUpdates to xcodebuild arguments.
I choose this name to prevent confusion in what it does.

And as suggested in #21562 I updated the description of the option disable_package_automatic_updates to include that the argument -disableAutomaticPackageResolution will be given to xcodebuild.

I was able to confirm in CI that -skipPackageUpdates was properly given to xcodebuild preventing it from updating all packages repositories when the new option is used.

Testing Steps

I've run bundle exec rspec but I was not able to have all tests pass before my changes. But my changes did not break any tests that were passing before.
Here the list of tests I was not able to see pass

Finished in 6 minutes 23 seconds (files took 5.14 seconds to load)
7486 examples, 9 failures

Failed examples:

rspec ./fastlane/spec/plugins_specs/plugin_generator_spec.rb:297 # Fastlane::PluginGenerator#generate All tests and style validation of the new plugin are passing rubocop validations are passing
rspec ./fastlane/spec/plugins_specs/plugin_generator_spec.rb:303 # Fastlane::PluginGenerator#generate All tests and style validation of the new plugin are passing `rake` runs both rspec and rubocop
rspec ./gym/spec/code_signing_mapping_spec.rb:29 # Gym::CodeSigningMapping#detect_project_profile_mapping returns the mapping of the selected provisioning profiles
rspec ./gym/spec/code_signing_mapping_spec.rb:38 # Gym::CodeSigningMapping#detect_project_profile_mapping detects the build configuration from selected scheme
rspec ./gym/spec/code_signing_mapping_spec.rb:47 # Gym::CodeSigningMapping#detect_project_profile_mapping detects the build configuration from selected scheme of a project based on inheritance for resolve xcconfigs
rspec ./gym/spec/code_signing_mapping_spec.rb:58 # Gym::CodeSigningMapping#detect_project_profile_mapping_for_tv_os returns the mapping of the selected provisioning profiles for tv_os
rspec ./gym/spec/platform_detection_spec.rb:32 # Gym detects the correct platform for a visionOS project
rspec ./trainer/spec/test_parser_spec.rb:312 # Trainer Trainer::XCResult::Parser Xcode 16 xcresult bundle generates correct JUnit XML including retries
rspec ./trainer/spec/test_parser_spec.rb:326 # Trainer Trainer::XCResult::Parser Xcode 16 xcresult bundle generates correct JUnit XML excluding retries

…when using the options "disable_package_automatic_updates" or "skip_package_repository_fetches"
@iBotPeaches

Copy link
Copy Markdown
Member
snapshot/lib/snapshot/options.rb:8:3: C: Metrics/ClassLength: Class has too many lines. [325/320]
  class Options ...
  ^^^^^^^^^^^^^

Test failure is odd. I'd just add an ignore since an options class growing in options seems fine.

@iBotPeaches iBotPeaches changed the title Allow disabling swift packages fetches when using xcodebuild [gym, scan, snapshot] Allow disabling swift packages fetches when using xcodebuild Jan 23, 2026
@iBotPeaches iBotPeaches merged commit d9e0f05 into fastlane:master Jan 29, 2026
9 checks passed

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @alexandre-pod 👋

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 🚀"

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulations! 🎉 This was released as part of fastlane 2.232.0 🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants