littlerobots / version-catalog-update-plugin

Gradle plugin for updating a project version catalog
Apache License 2.0
544 stars 22 forks source link

Versions declared in additional catalog don't get updated #148

Closed vnickolov closed 1 month ago

vnickolov commented 1 month ago

Hello,

I have two separate version catalog files - one is the default and the other one is named, they are both used and declared in settings.gradle, all looks good there.

Then I specify the additional catalog

versionCatalogUpdate {
    // sort the catalog by key (default is true)
    sortByKey = true

    keep {
        // keep versions without any library or plugin reference
        keepUnusedVersions = true
        // keep all libraries that aren't used in the project
        keepUnusedLibraries = true
        // keep all plugins that aren't used in the project
        keepUnusedPlugins = true
    }

    versionCatalogs {
        additionalCatalog {
            catalogFile = file("open/gradle/additional.versions.toml")
        }
    }
}

Intentionally lowered a version declared there. When I run

./gradlew versionCatalogUpdate --interactive

The "offending" version has been reported by the versions plugin but I don't see the open/gradle/additional.versions.toml being updated, nor there is open/gradle/additional.versions.updates.toml generated.

What am I missing? Is this a bug, or I have something misconfigured?

Thank you in advance, Ves

vnickolov commented 1 month ago

I figured it out, after reading the code 🙇

Declaring the additional catalog results in an additional Gradle task with the name of the catalog (capitalised) as a suffix, in the above case I had to do this in order for it to work

./gradlew versionCatalogUpdateAdditionalCatalog --interactive

Went back to the docs, and I clearly missed that paragraph 🤦