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

[Fastlane.swift] take into account .fastlaneDefault case when retrieving OptionalConfigValue as a ruby argument #19197

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rserentill
Copy link

@rserentill rserentill commented Aug 3, 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

When retrieving a OptionalConfigValue as a ruby argument, if the case is .fastlaneDefault (used for setting the values defined in configuration files such as Scanfile, MakeFile, Gymfile, Deliverfile, etc) the returned value is nil, instead of the default value.
Resolves #19196

Description

Added .fastlaneDefault case to return the appropriate value as a RubyCommand.Argument instead of nil.

Testing Steps

Tested the use case described in the open issue. Executed scan function in swift. It works on CI and it doesn't ask to select a scheme anymore when not in CI, it takes the correct value specified on the Scanfile.

@google-cla
Copy link

google-cla bot commented Aug 3, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Aug 3, 2021
@rserentill
Copy link
Author

@googlebot I signed it!

@google-cla
Copy link

google-cla bot commented Aug 3, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@rserentill rserentill force-pushed the swift-OptionalConfigValue-ruby-argument branch from 849f80f to 8df3851 Compare August 3, 2021 09:46
@google-cla google-cla bot added cla: yes and removed cla: no labels Aug 3, 2021
@rserentill
Copy link
Author

@googlebot I fixed it.

@joshdholtz joshdholtz changed the title Take into account .fastlaneDefault case when retrieving OptionalConfigValue as a ruby argument [Fastlane.swift] take into account .fastlaneDefault case when retrieving OptionalConfigValue as a ruby argument Aug 3, 2021
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.

This makes sense to me I think 😇 I'd like @minuscorp's 👀 on this before merging those since I'm not the expert on this part 😉

Copy link
Collaborator

@minuscorp minuscorp left a comment

Choose a reason for hiding this comment

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

This will raise issues regarding conflicting options which was the main reason of separating this cases. For fixing this issue, I think the approach is how the values are picked from the Scanfile, to be set as .userDefined instead of .fastlaneDefault

@rserentill
Copy link
Author

@minuscorp Thanks for your comments! you mean in the declaration of scan function to have scheme: OptionalConfigValue<String?> = .userDefined(scanfile.scheme) instead of scheme: OptionalConfigValue<String?> = .fastlaneDefault(scanfile.scheme)? what would be the point of having .fastlaneDefault case then?
Sorry if I'm missing something, I'm not very familiar with the actual purpose of OptionalConfigValue 😇

@minuscorp
Copy link
Collaborator

Usually .fastlaneDefault aims to cover arguments where there are values coming from fastlane itself instead of configuration files. We cannot detect if the Scanfile.scheme value has a default or a user defined one at runtime nor at compile time, so I assumed that the least harmful decision could be the current implementation, but not for the issue you have raised of course, so we should always send config files values, even if they are default ones.

@rserentill
Copy link
Author

@minuscorp Ok, to make it clear, your suggestion is to use .userDefined in all the functions that use config file values in Fastlane.swift, instead of using .fastlaneDefault right?

@minuscorp
Copy link
Collaborator

Without being able to test it by myself right now, it seems to be a potential solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Swift: scheme value in Scanfile is ignored
5 participants