-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Move use_flipper
logic inside use_react_native
and simplify the Flipper dependencies logic
#33882
Conversation
Base commit: 406a474 |
…use_flipper_into_use_react_native
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tackling this issue. There are a couple of things to still take care of.
For context, this PR has been triggered by #33764, while we were investigating how to solve it.
Perhaps, it make sense to specify this into the PR description, WDYT?
I'm still in the draft phase, I wanted to highlight the workaround that fixes #33764 when this is becomes ready for review, but I can add it now :) |
@@ -108,6 +108,11 @@ def use_react_native! (options={}) | |||
pod 'libevent', '~> 2.1.12' | |||
end | |||
|
|||
if flipper_configuration.flipper_enabled && !production |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a temporary workaround that should fix #33764
If production is true the flipper pods are not added at all (differently than what CocoaPods does that compiles them, but then doesn't copy the frameworks), this avoids Flipper to be compiled when releasing, hence avoids the error discussed in the issue.
The downside of this workaround is that before making a release, the user needs to call pod install
again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The downside of this workaround is that before making a release, the user needs to call pod install again
Correct me if I'm wrong, but it used to have to call it anyway, passing production = false
, right?
I would also specify, perhaps also adding some doc, that it's still the case. When a user wants to build for release, it has to run PRODUCTION=1 pod install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct, however if there wasn't the mentioned issue we could only rely on CocoaPods' configurations logic to do esclude Flipper from production (it would anyway compile flipper but wouldn't copy it) and remove the production flag.
The PRODUCTION=1 pod install
is how this is set up on RNTester, final users could potentially set their own way to define if is production or not depending on their needs and their workflow.
If we think setting the PRODUCTION
env variable is a good default to express that we want the production flag true I can add that to the template as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment about that here? I think this can be easily missed since it's such a weird quirk of CocoaPods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry I missed this comment, will make another PR to fix those two comments as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #33902
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for this. Added a clarification
@@ -108,6 +108,11 @@ def use_react_native! (options={}) | |||
pod 'libevent', '~> 2.1.12' | |||
end | |||
|
|||
if flipper_configuration.flipper_enabled && !production |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The downside of this workaround is that before making a release, the user needs to call pod install again
Correct me if I'm wrong, but it used to have to call it anyway, passing production = false
, right?
I would also specify, perhaps also adding some doc, that it's still the case. When a user wants to build for release, it has to run PRODUCTION=1 pod install
@f-meloni has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
# | ||
# Note that if you have use_frameworks! enabled, Flipper will not work and | ||
# you should disable the next line. | ||
use_flipper!() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small heads up: shouldn't we deprecate use_flipper()
now?
What happens to a user that is doing?
use_react_native!(
...
:flipper_configuration => FlipperConfiguration.enabled,
)
use_flipper!()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that it won't work, the function use_flipper
won't exist anymore after this change.
The only thing is probably how tell the user that the flipper configuration is now into the use_react_native
function.
In case we wanted to do so we could use something like
def use_flipper!(versions = {}, configurations: ['Debug'])
Pod::UI.warn "use_flipper is deprecated, use the flipper_configuration option in the use_react_native function"
use_flipper_pods(versions, :configurations => configurations)
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup that makes total sense 👍
66b34a1
to
b3a0bc6
Compare
Just a heads up that this should be flagged in the release notes for .70 |
@f-meloni has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
…use_flipper_into_use_react_native
@f-meloni has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
def self.enabled(configurations = ["Debug"], versions = {}) | ||
return FlipperConfiguration.new(true, configurations, versions) | ||
end | ||
|
||
def self.disabled | ||
return FlipperConfiguration.new(false, [], {}) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: In Ruby, the last statement is always returned so we can drop return
here to be more idiomatic:
def self.enabled(configurations = ["Debug"], versions = {}) | |
return FlipperConfiguration.new(true, configurations, versions) | |
end | |
def self.disabled | |
return FlipperConfiguration.new(false, [], {}) | |
end | |
def self.enabled(configurations = ["Debug"], versions = {}) | |
FlipperConfiguration.new(true, configurations, versions) | |
end | |
def self.disabled | |
FlipperConfiguration.new(false, [], {}) | |
end |
@@ -108,6 +108,11 @@ def use_react_native! (options={}) | |||
pod 'libevent', '~> 2.1.12' | |||
end | |||
|
|||
if flipper_configuration.flipper_enabled && !production |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment about that here? I think this can be easily missed since it's such a weird quirk of CocoaPods.
This pull request was successfully merged by @f-meloni in 0bd5239. When will my fix make it into a release? | Upcoming Releases |
…abled (#33902) Summary: Follow up of #33882 ## Changelog [Internal] - Add comment to explain why production flag is used when Flipper is enabled Pull Request resolved: #33902 Reviewed By: cortinico, f-meloni Differential Revision: D36632238 Pulled By: cipolleschi fbshipit-source-id: a859006851d9f50a4ad0ae1141006e8dac7aee6e
Summary: ### Mentioned - pr[main]: #33882 - discussion: reactwg/react-native-releases#21 (reply in thread) - pr[0.69-stable]: #34098 Close: #33764 Saw the issue ago couple wks too: leotm/react-native-template-new-architecture#757 Fixed similarly: leotm/react-native-template-new-architecture#791 ## Changelog [iOS] [Changed] - Update Podfile to allow `PRODUCTION=1 pod install` [CATEGORY] [TYPE] - Message Pull Request resolved: #34234 Test Plan: Everything builds and runs as expected Reviewed By: cortinico Differential Revision: D38029117 Pulled By: cipolleschi fbshipit-source-id: bdb58200a999cb66f1043a2feb670f9037c8e463
Summary: ### Mentioned - pr[main]: #33882 - discussion: reactwg/react-native-releases#21 (reply in thread) - pr[0.69-stable]: #34098 Close: #33764 Saw the issue ago couple wks too: leotm/react-native-template-new-architecture#757 Fixed similarly: leotm/react-native-template-new-architecture#791 ## Changelog [iOS] [Changed] - Update Podfile to allow `PRODUCTION=1 pod install` [CATEGORY] [TYPE] - Message Pull Request resolved: #34234 Test Plan: Everything builds and runs as expected Reviewed By: cortinico Differential Revision: D38029117 Pulled By: cipolleschi fbshipit-source-id: bdb58200a999cb66f1043a2feb670f9037c8e463
* Draft ios.yml * Fix indentation * Update ios.yml * Build app for release * Fix prod build error w Flipper, set env flag Issue - reactwg/react-native-releases#21 (comment) - facebook/react-native#33764 PR - facebook/react-native#33882 * Remove stale comment * Temporarily add `npx react-native info` * Move `npx react-native info` after `yarn` * Add release bundle step before build * Update bundle script * Update bundle script * Update RN CLI from next (8.0.0-alpha.0) to 9.0.0-alpha.5 * Remove devDep @react-native-community/cli No luck with 9.0.0-alpha.5 Should now use npm:9.0.0-alpha.4 (via npm:^9.0.0-alpha.3) * Try bundling also to ios/MyApp/main.jsbundle * Add debug before release bundle/build * Fix yarn lockfile/cache conflict res * Add normal pod install before debug * Comment debug pod install and build, working fine * Update pbxproj and xcscheme Follow-up: - facebook/react-native#34274 (comment) Also update parts in-line with current main - https://github.com/facebook/react-native/tree/main/template * Disable Metro experimentalImportSupport * Resolve Yarn lockfile From conflict res * Rename xcode.env prefix _ to . * Remove react-native-flipper * Revert "Remove react-native-flipper" This reverts commit 646dd74. * Revert "Rename xcode.env prefix _ to ." This reverts commit 8f15810. * Revert "Disable Metro experimentalImportSupport" This reverts commit 41ed14b. * Add index.js for iOS Release bundling * Add back @react-native-community/cli 9.0.0-alpha.5 * Revert "Try bundling also to ios/MyApp/main.jsbundle" This reverts commit 80e7354. * Revert "Comment debug pod install and build, working fine" This reverts commit 0ea4d01. * Update workflow comments
Summary
This PR tries to simplify the
use_flipper
logic:use_flipper
a configuration insideuse_react_native
's optionsproduction
flag in theuse_react_native
's options to decide if add or not the Flipper podsThis PR also adds a workaround for #33764
Changelog
[iOS] [Changed] - Move
use_flipper
logic insideuse_react_native
and simplify the Flipper dependencies logicTest Plan
Executed a pod install with and without flipper and with isProduction true