Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Upgrade Gradle to 7.4 & AGP to 7.1.1 (& Disable Jetifier)#12

Closed
ParaskP7 wants to merge 24 commits intowp-forkfrom
update/gradle-to-7.3.3-agp-to-7.0.4
Closed

Upgrade Gradle to 7.4 & AGP to 7.1.1 (& Disable Jetifier)#12
ParaskP7 wants to merge 24 commits intowp-forkfrom
update/gradle-to-7.3.3-agp-to-7.0.4

Conversation

@ParaskP7
Copy link
Copy Markdown

@ParaskP7 ParaskP7 commented Feb 16, 2022

This PR is part of Upgrade Gradle to 7.4 & AGP to 7.1.1 (& Disable Jetifier) PR. There are 13 libraries that are upgraded to Gradle 7.4 & AGP 7.1.1 (& Disable Jetifier).


All those PRs follow the general outline below:

  • Gradle version upgraded to 7.3.3 with the ./gradlew wrapper --gradle-version=7.3.3 --distribution-type=all command.
  • AGP version upgrade to 7.0.4 (see android/settings.gradle.kts change).
  • Build output diff:
    • To identify and fix new warnings/errors that got added.
    • To identify and verify old warnings/errors that got removed.
  • Lint output diff
    • To identify and fix new warnings/errors that got added.
    • To identify and verify old warnings/errors that got removed.
  • The above 4 steps were redone with a follow-up update to Gradle 7.4 & AGP 7.1.1.
  • Jetifier drop (see android/gradle.properties change).
  • OUTDATED
    • Version bump to 1.10.1-wp-5 (see package.json).
    • Tarball update to 1.10.1-wp-5 (see react-native-gesture-handler-1.10.1-wp-5.tgz).
    • The build was also verified through Jitpack (see build.log).
  • OUTDATED
    • AGP version upgrade to 7.1.1 (from 4.1.0) (within android/build.gradle). Cc @oguzkocer
    • Version bump to 2.2.0-wp-4 (see package.json).
    • Tarball update to 2.2.0-wp-4 (see react-native-gesture-handler-2.2.0-wp-4.tgz).
    • The build was also verified through Jitpack (see build.log).
  • UPDATED
    • Use common interface from reanimated (for more deals see here).
    • Version bump to 2.2.0-wp-5 (see package.json).
    • Tarball update to 2.2.0-wp-5 (see react-native-gesture-handler-2.2.0-wp-5.tgz).
    • The build was also verified through Jitpack (see build.log).

To test - Now

These changes can be tested as part of the gutenberg PR which is updated to use the temporarily non-tagged node module project dependencies generated with these changes.

To test - Later ⚙️

These changes can be tested as part of the gutenberg-mobile PR ⚙️ or WordPress-Android PR ⚙️ which is updated to use the bundle ⚙️ generated with these changes.

FYI: It's best to leave the testing step to the gutenberg PR review since even if these PRs are merged, they won't impact anything until the package.json file is updated. Worst case scenario, a follow up PR will get opened to fix any issues that are found during testing.


Follow up

Once these PRs are merged in, a new tag will get created for each library and the package.json file will be again updated accordingly.

@ParaskP7 ParaskP7 added the enhancement New feature or request label Feb 16, 2022
@ParaskP7 ParaskP7 requested a review from oguzkocer February 16, 2022 10:35
@ParaskP7 ParaskP7 self-assigned this Feb 16, 2022
The 'com.dipien.byebyejetifier' plugin was used to determine whether
Jetifier can be disable for this project.

After configuring 'Bye Bye Jetifier' and running the below command:
./gradlew canISayByeByeJetifier -Pandroid.enableJetifier=false

The output was clear, Jetifier can be now safely disabled for this
project: > Task :canISayByeByeJetifier

=========================================
Project: :
=========================================
 * No legacy android support usages found

=========================================
Project: :lib
=========================================
 * No legacy android support usages found

===================================================== ...
* No dependencies with legacy android support usages! ...
===================================================== ...

... ===============================
... You can say Bye Bye Jetifier. *
... ===============================
@ParaskP7 ParaskP7 changed the title Upgrade Gradle to 7.3.3 & AGP to 7.0.4 Upgrade Gradle to 7.4 & AGP to 7.1.1 (& Disable Jetifier) Feb 24, 2022
@ParaskP7
Copy link
Copy Markdown
Author

ParaskP7 commented Mar 3, 2022

👋 @oguzkocer

AGP version upgrade to 7.1.1 (from 4.1.0) (within android/build.gradle). Cc @oguzkocer

You will notice that I cc'ed you on the description because I want you to be aware of this change since it might revert the change you did by creating settings.gradle.kts and using pluginManagement instead of doing that directly through buildscript. Wdyt?

PS: This change was done because the wp-fork was recently updated from 1.10.1-wp-4 to 2.2.0-wp-3, a major upgrade on this branch, lots of diffs, which I then pulled in this PR to keep it up-to-date. Cc @fluiddot

@oguzkocer
Copy link
Copy Markdown

@ParaskP7 I've added plugin DSL support to this project as well as many other react-native fork projects because I wanted react-native-bridge the ability to set the plugin version for easy testing. In my humble opinion reverting the change is counter-productive and 71885ee by @fluiddot was a mistake.

@fluiddot The merge conflict was a very easy one to address, so I was wondering why you have opted to make this change. Is it at all possible you weren't familiar with the plugin DSL? If so, we can fix that easily in this PR. However, if it was intentional, I hope we can discuss it before we commit to the version in this PR.

@fluiddot
Copy link
Copy Markdown

fluiddot commented Mar 7, 2022

@fluiddot The merge conflict was a very easy one to address, so I was wondering why you have opted to make this change. Is it at all possible you weren't familiar with the plugin DSL? If so, we can fix that easily in this PR. However, if it was intentional, I hope we can discuss it before we commit to the version in this PR.

Just to clarify, do you refer to the change in the plugins block?

Before:

plugins {
    id "com.android.library"
    id "kotlin-android"
    id "maven-publish"
}

After:

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'

If so, it was probably a mistake from my side. I'm still getting familiar with Gradle DSL, so please let me know if there's anything else incorrect in the configurations 🙇 .

@oguzkocer
Copy link
Copy Markdown

@fluiddot That's part of it, but in short, we shouldn't have a buildscript block which is the old notation. For example, classpath("com.android.tools.build:gradle:4.1.0") is not necessary, because the version is set in the settings.gradle.kts like so. Kotlin plugin declaration should also be done in the settings.gradle.kts file similar to this.

Hope that clarifies it and if you'd like to learn more about the plugin DSL, you might find this documentation useful.

@ParaskP7
Copy link
Copy Markdown
Author

ParaskP7 commented Mar 9, 2022

👋 @oguzkocer !

@fluiddot That's part of it, but in short, we shouldn't have a buildscript block which is the old notation. For example, classpath("com.android.tools.build:gradle:4.1.0") is not necessary, because the version is set in the settings.gradle.kts like so. Kotlin plugin declaration should also be done in the settings.gradle.kts file similar to this.

Can you please take a look at this a00be91 commit, which resolves the above, and verify that I am not missing anything? 🙇

Cc @fluiddot

@oguzkocer
Copy link
Copy Markdown

@ParaskP7 a00be91 looks good to me, although I'd have preferred it if we passed the kotlin version directly instead of relying on a property. In settings.gradle files, using properties can be tricky at times. If it's working as is though, I don't mind keeping it if you prefer it like this.

@ParaskP7
Copy link
Copy Markdown
Author

👋 @oguzkocer !

@ParaskP7 a00be91 looks good to me, although I'd have preferred it if we passed the kotlin version directly instead of relying on a property. In settings.gradle files, using properties can be tricky at times. If it's working as is though, I don't mind keeping it if you prefer it like this.

Thanks for your input, I only chose this way in order to minimize changes from upstream. To be honest I am also preferring if we passed the Kotlin version directly. But yes, it does work as expected. 👍

@fluiddot wdyt, should I do this change or do you prefer us staying as close to the upstream as possible? 🤔

@fluiddot
Copy link
Copy Markdown

@fluiddot wdyt, should I do this change or do you prefer us staying as close to the upstream as possible? 🤔

@ParaskP7 Both options work for me, as we're already applying several modifications to the project, making more shouldn't be a problem.

If I understand correctly, the change would be to remove RNGH_kotlinVersion=1.5.20 from android/gradle.properties and set the version directly in android/settings.gradle.kts, right? In that case, I think the change is minor so feel free to apply it.

@ParaskP7
Copy link
Copy Markdown
Author

👋 @fluiddot !

@ParaskP7 Both options work for me, as we're already applying several modifications to the project, making more shouldn't be a problem.

Thanks for your input! 👍

If I understand correctly, the change would be to remove RNGH_kotlinVersion=1.5.20 from android/gradle.properties and set the version directly in android/settings.gradle.kts, right?

Exactly! 👍

In that case, I think the change is minor so feel free to apply it.

On it! 👍

@fluiddot
Copy link
Copy Markdown

@ParaskP7 Heads up that I've updated this branch with the recent changes incorporated in wp-fork (reference) and generated a new tarball. Besides, I also updated the Gutenberg PR to reflect the new version.

@ParaskP7
Copy link
Copy Markdown
Author

👋 @fluiddot !

@ParaskP7 Heads up that I've updated this branch with the recent changes incorporated in wp-fork (#18) and generated a new tarball. Besides, I also updated the WordPress/gutenberg#39097 to reflect the new version.

Thanks for this update! 👍

Btw, I just triggered a Jitpack build based on the latest commit and I got a build failure (see here).

TIL

* What went wrong:
Execution failed for task ':generateDebugRFile'.
> Could not resolve all files for configuration ':debugCompileClasspath'.
   > Could not find com.github.wordpress-mobile:react-native-reanimated:2.4.1-wp-1.
     Required by:
         project :

@ParaskP7
Copy link
Copy Markdown
Author

UPDATE: @fluiddot after your latest merge commit the build is now successful (see here).

PS: Should we also generate a new tarball as well? 🤔

@fluiddot
Copy link
Copy Markdown

Btw, I just triggered a Jitpack build based on the latest commit and I got a build failure (see here).

Yep, sorry for that, I forgot to add Jitpack repository, which was required for the latest changes.

UPDATE: @fluiddot after your latest merge commit the build is now successful (see here).

PS: Should we also generate a new tarball as well? 🤔

Right, I've just updated the tarball in aa2bbc9.

@ParaskP7
Copy link
Copy Markdown
Author

ParaskP7 commented Apr 6, 2022

Since we removed the source code for these projects from react-native-bridge, we don’t need these updates to happen together with the other projects anymore. That means we can close this draft PR for now and reopen it, if need be, in the future. There is little value in merging this now and diverging from the source repo.

PS: Eventually, we might upgrade Gradle & AGP when using a newer version of React Native if the new RN version requires it.

@ParaskP7 ParaskP7 closed this Apr 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants