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

[gym] correctly inherit OTHER_SWIFT_FLAGS when using option 'analyze_build_time' #19737

Merged
merged 1 commit into from
Jan 4, 2022

Conversation

icecrystal23
Copy link
Contributor

@icecrystal23 icecrystal23 commented Dec 21, 2021

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass (well, sort of. Tests unrelated to my change were failing, but the test for the code I changed was passing when run in isolation)
  • 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

We had an issue with the Apollo SDK when using CocoaPods. Turns out the root cause of that bug was the OTHER_SWIFT_FLAGS not being successfully inherited here. See details of that bug here: apollographql/apollo-ios#2047

Description

Added an additional escape character to the $ on "$(inherited)" OTHER_SWIFT_FLAGS so that it successfully gets passed to xcodebuild rather than being evaluated too early.

Testing Steps

I tested gym on an example project with a custom OTHER_SWIFT_FLAGS setting and ensured that the actual CompileSwiftSources command in the build log had the custom flag in addition to the build time analysis ones.

-D MY_SWIFT_FLAG -Xfrontend -debug-time-function-bodies

@icecrystal23
Copy link
Contributor Author

Ok, figured out that I had a REALLY old fork of fastlane and updated my PR.
I noticed the attempt to inherit was removed in #11739 but this correctly adds the flag back (it wasn't correctly included before which I could see leading to issues).

@joshdholtz joshdholtz changed the title gym: Correctly inherit OTHER_SWIFT_FLAGS when using option 'analyze_build_time' [gym] correctly inherit OTHER_SWIFT_FLAGS when using option 'analyze_build_time' Jan 3, 2022
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.

One small question otherwise this looks good 😊

@@ -43,7 +43,7 @@ def options
options << "-scmProvider system"
end
options << config[:xcargs] if config[:xcargs]
options << "OTHER_SWIFT_FLAGS=\"-Xfrontend -debug-time-function-bodies\"" if config[:analyze_build_time]
options << "OTHER_SWIFT_FLAGS=\"\\\$(value) -Xfrontend -debug-time-function-bodies\"" if config[:analyze_build_time]
Copy link
Member

Choose a reason for hiding this comment

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

I'm not too familiar with this but is $(value) the same thing as $(inherited)? 🙃

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know where or if there is official documentation for it, but $(value) expands to the current build setting value. So it's sort of the command-line equivalent of $(inherited)

Copy link
Member

Choose a reason for hiding this comment

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

Ohhhhhh, cool cool! I see what this is doing now 🤯 Thank you for the explanation 🥰

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 you so much for debugging this and making this change! Really appreciate it 🙌

@joshdholtz joshdholtz merged commit eaf77b0 into fastlane:master Jan 4, 2022
@fastlane-bot
Copy link

Hey @icecrystal23 👋

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 🚀

@fastlane-bot
Copy link

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

@fastlane fastlane locked and limited conversation to collaborators Mar 17, 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