Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[action] allow using a .xcode-version file with xcversion action #19644

Merged
merged 3 commits into from
Dec 9, 2021

Conversation

rogerluan
Copy link
Member

@rogerluan rogerluan commented Nov 25, 2021

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've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Motivation and Context

I felt the necessity to unify the implementation to a single .xcode-version file, making it consistent with xcode-install itself, and ensure_xcode_version action.

Description

This PR allows us to use a .xcode-version and omit the :version parameter when invoking xcversion action. It finds and reads the contents of a .xcode-version file just like the ensure_xcode_version action does:

if required_version.to_s.length == 0
# The user didn't provide an Xcode version, let's see
# if the current project has a `.xcode-version` file
#
# The code below can be improved to also consider
# the directory of the Xcode project
xcode_version_paths = Dir.glob(".xcode-version")
if xcode_version_paths.first
UI.verbose("Loading required version from #{xcode_version_paths.first}")
required_version = File.read(xcode_version_paths.first).strip
else
UI.user_error!("No version: provided when calling the `ensure_xcode_version` action")
end
end

Testing Steps

To test this branch, modify your Gemfile as:

gem "fastlane", :git => "https://github.com/fastlane/fastlane.git", :branch => "rogerluan-use-xcode-version-file-with-xcversion"

And run bundle install to apply the changes.

@joshdholtz
Copy link
Member

@rogerluan Added my changes if you don't mind reviewing this whenever you get a chance 😇

Copy link
Member Author

@rogerluan rogerluan left a comment

Choose a reason for hiding this comment

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

LGTM @joshdholtz ! 🚀 thanks for those improvements! Much better!
(and now I've learned how to implement a dynamic default value 😁 )

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

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

Thank so much for doing all the heavy lifting on this PR 😊 This is a great change 🙌

@joshdholtz joshdholtz merged commit a79fa27 into master Dec 9, 2021
@rogerluan rogerluan deleted the rogerluan-use-xcode-version-file-with-xcversion branch December 9, 2021 21:53
@fastlane-bot
Copy link

Hey @rogerluan 👋

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 week, 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 🚀

Copy link

@fastlane-bot fastlane-bot left a comment

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.199.0 🚀

@fastlane fastlane locked and limited conversation to collaborators Feb 9, 2022
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.

None yet

3 participants