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

android build: Upgrade Gradle to 6.2. #4319

Merged
merged 3 commits into from
Dec 5, 2020

Conversation

chrisbobbe
Copy link
Contributor

Part of the RN v0.62 -> v0.63 changes to the template app [1],
corresponding to the following commits:

I didn't find that the additions to android/gradlew.bat (from
facebook/react-native@d4d8887b5) were reproducible using our upgrade
command for any upgrade between 6.0.1 (where we were before this
commit) and 6.2.

But I could reproduce them by running that command to upgrade to
6.3. So, we might as well include them. It's possible that there are
some difference between the upgrade command we run and the command
React Native maintainers run, or (maybe more likely) React Native
initially went for an upgrade to 6.3 then partially backed it out,
to only go to 6.2.

The build scan revealed a handful of new deprecation notices not
flagged at our last Gradle upgrade (2c42511), also for things that
will be removed in Gradle 7.0 [2].

[1] https://react-native-community.github.io/upgrade-helper/?from=0.62.2&to=0.63.3
[2] https://scans.gradle.com/s/3ocxcu7uxryfe/deprecations

@chrisbobbe chrisbobbe requested a review from gnprice November 27, 2020 22:03
@chrisbobbe
Copy link
Contributor Author

(Linking the RN v0.63 upgrade issue, #4245.)

@gnprice
Copy link
Member

gnprice commented Dec 5, 2020

I didn't find that the additions to android/gradlew.bat (from
facebook/react-native@d4d8887) were reproducible using our upgrade
command for any upgrade between 6.0.1 (where we were before this
commit) and 6.2.

But I could reproduce them by running that command to upgrade to
6.3.

Remember what we discovered at the last Gradle upgrade, at #4244 (comment):

  • Maybe the update to the gradlew script depends on the version you start from, rather than the one you upgrade to?

It's at least pretty easy to imagine how that behavior could arise -- you have one version installed, you ask that version to upgrade, but while that existing version is still running it also goes and tries to update your wrapper scripts to the latest and best that it knows about. Not good behavior but easy to imagine.

I think in fact I can confirm that that's what we're seeing. Once you're already on 6.2, if you rerun that "upgrade" command with the exact same arguments -- so "upgrade again" to 6.2 -- then you get that gradlew.bat change. The same is true if you upgrade to some other version like 6.3.

The other script change here, we actually get if you do the same with the version 6.0.1 we're already on.

I'll add a commit that does the 6.0.1 re-upgrade, and amends the instructions-comment.

gnprice and others added 3 commits December 4, 2020 16:44
…ure.

The way we've historically managed this -- using the upgrade command
in the most natural way -- has meant that we're always using the
Gradle wrapper from the *previous* Gradle version we last upgraded from.

The version mismatch itself is fine: much of the point of the Gradle
wrapper is to be a thin indirection layer that can start up whatever
version of Gradle a given project specifies.  But when doing an
upgrade, this behavior sure makes things confusing -- the shell script
we end up with can vary when trying two different sequences of
upgrades that end with the exact same version.  That sure looks like
something's wrong with the upgrade process, causing time spent debugging.

Now that we have debugged it, there's a simple workaround to make it
stop happening: just run each upgrade twice, so that everything settles
at the new version.  Do that for the last upgrade, and update the comment
so we know to do that in the future.
Part of the RN v0.62 -> v0.63 changes to the template app [1],
corresponding to the following commits:

- facebook/react-native@aa0ef1533
- facebook/react-native@a89a55353
- facebook/react-native@947a5593e
- facebook/react-native@d4d8887b5

The build scan revealed a handful of new deprecation notices not
flagged at our last Gradle upgrade (2c42511), also for things that
will be removed in Gradle 7.0 [2].

[greg: updated jar too, by following new upgrade procedure described
 in preceding commit]

[1] https://react-native-community.github.io/upgrade-helper/?from=0.62.2&to=0.63.3
[2] https://scans.gradle.com/s/3ocxcu7uxryfe/deprecations
@gnprice gnprice merged commit 04624e0 into zulip:master Dec 5, 2020
@gnprice
Copy link
Member

gnprice commented Dec 5, 2020

Merged, thanks! I also bumped it further to the latest bugfix release of that 6.2.x series.

@chrisbobbe
Copy link
Contributor Author

chrisbobbe commented Dec 5, 2020

I think in fact I can confirm that that's what we're seeing. Once you're already on 6.2, if you rerun that "upgrade" command with the exact same arguments -- so "upgrade again" to 6.2 -- then you get that gradlew.bat change. The same is true if you upgrade to some other version like 6.3.

Ohh, OK, right! That first commit, with the instruction to run the same command twice, is helpful. I remembered there was some oddness about how these upgrades worked, but I was fuzzy on the details; I should have looked back at your comments on the previous upgrade. Thanks for the reminder, and for fixing it for the future. 🙂

@chrisbobbe chrisbobbe deleted the pr-upgrade-gradle branch November 5, 2021 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants