question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for Gradle 7.4 Version Catalogs

See original GitHub issue

Gradle 7.0 introduced the “centralized declaration of dependencies”. Namely, dependencies can be aliased, grouped, and versioned in a TOML file. It would be incredibly nice if refreshVersions could target the libs.versions.toml file in future, rather than relying on a custom version.properties.

Update: notes from jmfayard

the plan for now is not to give up versions.properties

it’s to auto-generate the libraries versions catalog, with the placeholder version _ and use the typesafe accessors to help migrate an existing project to refreshVersions

Running $ ./gradlew refreshVersionsCatalog would

  • Enable catalog version if necessary
// Enable Gradle's version catalog support
// https://docs.gradle.org/current/userguide/platforms.html
enableFeaturePreview("VERSION_CATALOGS")
  • Generate versions.properties, with all version keys (marked as unused)
  • Generate gradle/libs.dependencies.toml
  • Use the IDE and auto-completion to replace hardcoded dependencies with refreshVerion’s dependency notations and versionCatalog or buildSrc/Libs.kt
  • To help with this, this task will show which typesafe accessors are available $ ./ gradlew refreshVersionsMapping
androidx.car:car                             | AndroidX.car
com.retrofit:retrofit-converter-json          | Square.retrofit.converter.json
org.koin:koin                                  |  libs.koin

Documentation

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:22
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
jmfayardcommented, Feb 25, 2022

I’ve got news! cc @DanySK @beski @jsschneider @NikkyAI and all.

I implemented support for versions catalog:

  • generating it automatically
  • rewriting the files build.gradle(.kts) to use them
  • adding dependency updates in gradle/libs.versions.toml

It’s published in the snapshot version "0.40.2-SNAPSHOT"

Have a look at the Testing? pargraph from the pull-request https://github.com/jmfayard/refreshVersions/pull/509

4reactions
jmfayardcommented, May 18, 2021

I have a plan to combine versions catalog and refreshVersions. I updated the issue with my notes

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sharing dependency versions between projects
A version catalog is a list of dependencies, represented as dependency coordinates, that a user can pick from when declaring dependencies in a...
Read more >
Gradle version catalogs for an awesome ... - ProAndroidDev
You can create the version catalogs manually in settings.gradle but the easiest way is to use a TOML file which will be really...
Read more >
Gradle version catalogs for an awesome ... - Droidcon
Implementing Version Catalogs: 1️. Make sure you are using Gradle 7.4 or newer. This is easily checked using: ./gradlew --version.
Read more >
Integrating Version Catalog | Medium - Umang Chamaria
Version catalog is a preview feature currently(in Gradle version 7.x.x) hence the feature needs to be enabled in your project's settings.gradle(.kts) file as ......
Read more >
Manage your dependencies with Gradle version catalogs
Version Catalogs are a native Gradle solution for managing dependency versions in your build scripts. They provide a version catalog DSL, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found