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

Migrate instantly to gradle versions catalog with refreshVersions #504

Closed
wants to merge 11 commits into from

Conversation

jmfayard
Copy link
Member

@jmfayard jmfayard commented Feb 12, 2022

🚀 Description

Migrate instantly to gradle versions catalog with refreshVersions

📄 Motivation and Context

Versions Catalog is a new feature that is not yet widespread

The official page is not exactly user friendly

https://docs.gradle.org/current/userguide/platforms.html

We can automatize the migration to versions catalog with refreshVersions plus give them the benefit of looking for available updates

🧪 How Has This Been Tested?

Use this repository https://github.com/jmfayard/gradle-versions-catalog

Look at the result from this commit

jmfayard/gradle-versions-catalog@c9f9dfe

Run ./gradlew publishToMavenLocal and see the changes in the repo

You can also usesample-kotlin

📦 Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

✅ Checklist

If your project is using Gradle 7.0, you can use instead [Gradle versions catalog](https://docs.gradle.org/current/userguide/platforms.html)

```bash
$ ./gradlew refreshVersionsCatalog

> Task :refreshVersionsCatalog
        new file:   gradle/libs.versions.toml
        modified:   settings.gradle.kts
        modified:   versions.properties
```

The generated versions catalog looks like this:

```toml
## Generated by $ ./gradlew refreshVersionsCatalog

[libraries]

browser = "androidx.browser:browser:_"

cardview = "androidx.cardview:cardview:_"

okhttp = "com.squareup.okhttp3:okhttp:_"

junit = "junit:junit:_"
```

Like with buildSrcLibs, you get type-safe accessors available in the IDE:

<img width="949" alt="refreshVersions_–_build_gradle_kts__sample-kotlin_" src="https://user-images.githubusercontent.com/459464/128611606-4ce90b01-475d-402a-b223-1757a1c51deb.png">
# Conflicts:
#	sample-kotlin/build.gradle.kts
#	sample-kotlin/gradle/wrapper/gradle-wrapper.properties
#	sample-kotlin/versions.properties
@jmfayard jmfayard requested a review from LouisCAD February 12, 2022 16:28
jmfayard referenced this pull request in jmfayard/gradle-versions-catalog Feb 12, 2022
```bash
./gradlew refreshVersionsCatalog
./gradlew refreshVersionsMigrate
```
@jmfayard
Copy link
Member Author

Superseded by PR #509 (currently in draft)

I can't manage this PR which is many commits behind

@jmfayard jmfayard closed this Feb 26, 2022
@jmfayard jmfayard deleted the refreshVersionsCatalog branch July 30, 2022 15:07
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