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

feat: Introduce Version Catalog for Dependency Management #1607

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

jamesarich
Copy link
Contributor

@jamesarich jamesarich commented Feb 23, 2025

This introduces a version catalog via libs.versions.toml to centralize and manage project dependencies. It replaces the previous hardcoded dependency versions in .gradle files with references to the version catalog. This change enhances maintainability and organization by centralizing dependency management.

  • Added gradle/libs.versions.toml to define dependencies, plugins, and their versions.
  • Updated build.gradle to utilize references from the version catalog,
  • Updated app/build.gradle to utilize references from the version catalog.
  • Removed hardcoded version strings in gradle files.
  • Added note and suppressed warning to avoid updating zxing-core dependency
  • Consolidated dependencies into [bundles]
  • Refactored to ensure consistency in version catalog definititons and gradle dependencies

This commit introduces a version catalog via `libs.versions.toml` to centralize and manage project dependencies. It replaces the previous hardcoded dependency versions in `app/build.gradle` with references to the version catalog. This change enhances maintainability and organization by centralizing dependency management.

- Added `gradle/libs.versions.toml` to define dependencies and their versions.
- Updated `app/build.gradle` to utilize dependencies from the version catalog.
-Sorts `versions`, `dependencies`, and `plugins` references alphabetically.
*   Suppressed warning about updating zxing-core to avoid confusion.
*   Added a note to avoid updating zxing-core.
@jamesarich jamesarich marked this pull request as ready for review February 23, 2025 15:39
Copy link
Contributor

@jsoberg jsoberg left a comment

Choose a reason for hiding this comment

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

LGTM 🥳 Happy to see this!

I pulled and tested a build to verify as well, all good (I just can't accept PRs yet). I don't think we have to change anything with Renovate for this to just work with dependency updates but I'm not 100% sure on that

app/build.gradle Outdated
def appcompat_version = '1.7.0'
implementation "androidx.appcompat:appcompat:$appcompat_version"

implementation libs.appcompat
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nit: using parenthesis for most other deps here:

Suggested change
implementation libs.appcompat
implementation(libs.appcompat)

Copy link
Contributor

Choose a reason for hiding this comment

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

eh actually further down it's more of a norm to not use them in this file - I like the idea of using them throughout just because it's forced if we move to kts vs Groovy, but nbd either way

firebase-crashlytics-gradle = { module = "com.google.firebase:firebase-crashlytics-gradle" }
fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "fragment-ktx" }
google-services = { module = "com.google.gms:google-services", version.ref = "google-services" }
gradle = { module = "com.android.tools.build:gradle", version.ref = "gradle" }
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nit: I might call this agp or android-gradle-plugin, was just confused at first when I saw gradle

@jamesarich
Copy link
Contributor Author

jamesarich commented Feb 23, 2025

LGTM 🥳 Happy to see this!

I pulled and tested a build to verify as well, all good (I just can't accept PRs yet). I don't think we have to change anything with Renovate for this to just work with dependency updates but I'm not 100% sure on that

Thank you! Also just noticed the parantheses inconsistency. Inconsistency in the version catalog definitions too: module vs group so will align these as well.

Considering some [bundles] as well - gonna move this back to draft for now

@jamesarich jamesarich marked this pull request as draft February 23, 2025 16:40
-   Ensures all library dependencies are called with `implementation(libs.xxx)` instead of `implementation libs.xxx` in `build.gradle`.
- Updated dependencies in the app build.gradle to use bundles where possible.
@jamesarich jamesarich marked this pull request as ready for review February 23, 2025 19:05
@jamesarich jamesarich requested a review from jsoberg February 23, 2025 19:05
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