-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
referenced
this pull request
in jmfayard/gradle-versions-catalog
Feb 12, 2022
```bash ./gradlew refreshVersionsCatalog ./gradlew refreshVersionsMigrate ```
jmfayard
force-pushed
the
refreshVersionsCatalog
branch
from
February 14, 2022 16:30
7b44285
to
a3bae6e
Compare
This was referenced Feb 20, 2022
Superseded by PR #509 (currently in draft) I can't manage this PR which is many commits behind |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 Description
Migrate instantly to gradle versions catalog with refreshVersions
./gradlew wrapper --gradle-version 7.4
./gradlew refreshVersionsCatalog
./gradlew refreshVersionsMigrate
./gradlew 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 repoYou can also use
sample-kotlin
📦 Types of changes
✅ Checklist