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

[Deps] Migrate to Version Catalogs #12765

Merged
merged 88 commits into from
Oct 16, 2024
Merged

Conversation

ParaskP7
Copy link
Contributor

@ParaskP7 ParaskP7 commented Oct 4, 2024

Project Thread: paaHJt-7cv-p2

This PR migrates all dependencies and plugins in this project to Version Catalogs and under the newly created gradle/libs.versions.toml file.


Description

FYI: I recommend reviewing this PR commit-by-commit just to make sure that every dependency and plugin has been migrated appropriately, just to make sure that there isn't any left-overs that need addressing.

PS: The gradle/libs.versions.toml file, on both, its versions and libraries sections:

  • It is alphabetically ordered.
  • It is using the kebal-case naming convention (or else dash-case) .
  • All words are lowercased.
  • Where it makes sense the org name is added in its prefix to group dependencies together and make them easily identifiable.
  • Where needed the word main is added in its suffix to make sure that a dependency cannot be a parent of another dependency and a dependency itself. This helps in various corner cases.

Extra Focus Required (⚠️)

Below are some commits you want to put some extra focus on, along with a brief description on each. You can read the full description on the commit itself:

  • [libraries]:
    • google mlkit -> 9df67a7
      • Google MLKit vs Google Play Services dependency naming.
    • androidx core -> d967e75
      • Upgrade 1.0.0 to 1.0.1 version.
    • androidx preference -> 42b9e11
      • Upgrade 1.2.0 to 1.2.1 version.
    • androidx datastore -> 7f69b0c
      • Upgrade 1.0.0 to 1.1.0 version.
    • androidx hilt -> e810a1f
      • Downgrade 1.2.0 to 1.1.0 version.
    • bumptech glide -> 8893f9a
      • Drop @aar from version.
    • androidx activity -> 13af208
      • No associated version for androidx-activity-compose'.
    • androidx compose -> 9e129c0
      • Use bom instead of 1.3.2 version.
    • androidx wear -> c276911
      • No associated version for androidx-wear-tiles.
  • [plugins]:
    • kotlin plugin -> 73e832f
      • Drop org.jetbrains.kotlin.jvm from plugins.
    • androidx navigation -> 5f790e8
      • No associated version for androidx-navigation-compose.

On all the above commits I had to make a call, that is, in terms of how to resolve the inconsistency. If any of the changes look suspicious to you, or doesn't seem the right thing to do, please feel free to call me on it and we could revert it (just to keep things as is), or change it to a different resolution (ie. pick a different version).


Testing information

  • Smoke test the app and verify everything is working as expected.
  • You could also run the ./gradlew buildHealth task locally and verify that everything is working as expected (CI).

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

FYI: Notice that the Japanese, Chinese and Korea 'Text Recognition'
related dependencies are not 'Google MLKit' related but actually
'Google Play Services' related. However, to keep things simple and since
the version is coming from 'Google MLKit' and it main 'Text Recognition'
dependency the overall version catalog is pointing to 'Google MLKit' and
not 'Google Play Services'.
FYI: Notice that the 'AndroidX Core Splashscreen' version on the
'WooCommerce' module is pointing to '1.0.0', while on the
'WooCommerce-Wear' module it is pointing to '1.0.1'. This change
also updates the 'WooCommerce' version to point to '1.0.1' as well, it
being just a batch update that includes a single bugfix and no more.

Release Notes: https://developer.android.com/jetpack/androidx/releases/
core#core-splashscreen-1.0.1
FYI: Notice that the 'AndroidX Preference KTX' version on the
'WooCommerce' module is pointing to '1.2.0', while on the
'WooCommerce-Wear' module it is pointing to '1.2.1'. This change
also updates the 'WooCommerce' version to point to '1.2.1' as well, it
being just a batch update that includes a few bugfixes and no more.

Release Notes: https://developer.android.com/jetpack/androidx/releases/
preference#1.2.1
FYI: Notice that the 'AndroidX Datastore' versions on the
'WooCommerce' module are pointing to '1.0.0', while on the
'WooCommerce-Wear' module they are pointing to '1.1.0'. This change
also updates the 'WooCommerce' versions to point to '1.1.0' as well, it
having only additional features on top of '1.0.0' but no breaking
changes.

Release Notes: https://developer.android.com/jetpack/androidx/releases/
datastore#1.1.0
FYI: The 'androidx-navigation-compose' dependency on the 'WooCommerce'
module had no associated version on it, and was most probably taking
this version from 'androidx-compose-bom' instead. However, the same
dependency on the 'WooCommerce-Wear' module did have one. This change,
applies the same version on the 'WooCommerce' module to keep things
consistent.
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 4, 2024

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitfe7308d
Direct Downloadwoocommerce-prototype-build-pr12765-fe7308d.apk

@ParaskP7 ParaskP7 force-pushed the deps/migrate-to-version-catalogs branch from cc9a507 to 13a9d59 Compare October 4, 2024 19:25
@ParaskP7 ParaskP7 marked this pull request as ready for review October 4, 2024 19:59
Copy link
Member

@hichamboushaba hichamboushaba left a comment

Choose a reason for hiding this comment

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

Excellent work @ParaskP7 👏, this looks really great, and works well (I tested building both the main app and the Wear one).

I left two minor comments, but none is blocking, so I'm pre-approving.

Comment on lines 154 to 155
androidx-wear-tiles-main = { group = "androidx.wear.tiles", name = "tiles" }
androidx-wear-tiles-material = { group = "androidx.wear.tiles", name = "tiles-material" }
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest putting an explicit version on this, currently, this dependency is coming as a transitive dependency from the horologist dependencies as well, so they dictate the version 1.3.0, if we remove them, the resolution for the library fails:

Screenshot 2024-10-10 at 12 10 05

So I suggest putting the version 1.3.0 to match the existing one, and make it clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great suggestion @hichamboushaba , this is now done: c11e208

build.gradle Outdated
alias(libs.plugins.detekt)
alias(libs.plugins.automattic.measure.builds)
alias(libs.plugins.dependency.analysis)
alias(libs.plugins.android.application).apply(false)
Copy link
Member

Choose a reason for hiding this comment

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

very minor np, I think that keeping using apply false instead of apply(false) (for example: alias(libs.plugins.android.application) apply false feels more familiar to the previous syntax and looks better 😅, I know it's a small thing, so feel free to ignore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Small things matter, this is now done: 970ec5a

…to deps/migrate-to-version-catalogs

# Conflicts:
#	build.gradle
Release Notes: https://github.com/wordpress-mobile/
WordPress-FluxC-Android/releases/tag/2.99.0

The actual update was done as part of
5531327, but after merging this
branch with 'trunk', to fully resolved this one conflict, the FluxC
update needs to be redone, this time within 'libs.versions.toml'.
As per the c276911 commit, these two
'androidx-wear-tiles' dependencies had no associated version on them.
This could be problematic, non deterministic and could cause trouble
moving forward. As such, and as per the PR comment suggestion below,
this commit adds the most appropriate '1.3.0' version, which is also the
one currently being implicitly set transitively by the 'horologist'
dependencies themselves.

PR Comment: https://github.com/woocommerce/woocommerce-android/pull/
12765#discussion_r1795224428
@ParaskP7
Copy link
Contributor Author

Thank you so much for the review @hichamboushaba , you rock! 🙇 ❤️ 🚀

Also, apologies for not coming back to you sooner, being on our meetup last week and all. But, I am back now and ready to pick this up with you again! 💯

@ParaskP7 ParaskP7 added this to the 20.9 milestone Oct 14, 2024
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

Android Lint found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@codecov-commenter
Copy link

codecov-commenter commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 40.84%. Comparing base (dd1bf89) to head (fe7308d).
Report is 89 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff            @@
##              trunk   #12765   +/-   ##
=========================================
  Coverage     40.84%   40.84%           
  Complexity     5744     5744           
=========================================
  Files          1236     1236           
  Lines         69687    69687           
  Branches       9663     9663           
=========================================
  Hits          28466    28466           
  Misses        38596    38596           
  Partials       2625     2625           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ParaskP7
Copy link
Contributor Author

Android Lint found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

FYI: This is all about the libs.version.toml and the (known) multiple Obsolete Android Gradle Plugin Version + Obsolete Gradle Dependency warnings on it.

@ParaskP7
Copy link
Contributor Author

👋 @hichamboushaba , based on your comment reactions I think we could now proceed and merge this, right? This is just me making it sure before hitting the button? 😊

@hichamboushaba
Copy link
Member

Yes, you can go ahead @ParaskP7, I didn't merge it myself in case you needed an input from Wojtek as well.

@ParaskP7
Copy link
Contributor Author

Great, right, thanks for the confirmation on that @hichamboushaba ! 🙇

@wzieba any additional input from you maybe before me merging this? 🙏

Copy link
Contributor

@wzieba wzieba left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for solid work @ParaskP7 !

The dependency diff reports some initially unexpected changes, but after reading the description and commits, things are clear to me 👍 :shipit:

@ParaskP7
Copy link
Contributor Author

Awesome, thanks for looking at this and the 👍 @wzieba ! 🙇 🚀

FYI: I just merged the latest changes from trunk into this PR and upon CI successfully building it I'll merge this. ✅

@ParaskP7 ParaskP7 merged commit 3588e15 into trunk Oct 16, 2024
15 checks passed
@ParaskP7 ParaskP7 deleted the deps/migrate-to-version-catalogs branch October 16, 2024 08:25
@ParaskP7 ParaskP7 mentioned this pull request Nov 8, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants