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

Configuration for additional version catalog unexpectedly applies to default version catalog #147

Open
marloustolk opened this issue Apr 22, 2024 · 1 comment

Comments

@marloustolk
Copy link

marloustolk commented Apr 22, 2024

Some of the libraries I use are being deleted on update (they get flagged as unused).
If I use @keep they will not get updates anymore and if I use the configuration keepUnusedLibraries.set(true) any possible unused library will not be deleted anymore.
That is why I wrote an additional version catalog containing the libraries I want to keep that get deleted on updates.
Then I used a different configuration for this catalog.

versionCatalogUpdate {
    keep {
        keepUnusedLibraries.set(false)
    }
    versionCatalogs {
        create("keeplibs") {
            catalogFile.set(file("gradle/keeplibs.versions.toml"))
            keep {
                 keepUnusedLibraries.set(true)
            }
        }
    }
}

I expected that the libraries in libs.versions.toml still get deleted when unused and the libraries in keeplibs.versions.toml never get deleted.
This configuration unexpectedly results in that all libraries (in both catalogs) never get deleted.

gradle 8.5
version-catalog-update 0.8.4

@hvisser
Copy link
Contributor

hvisser commented Apr 22, 2024

The dependency update plugin will only find updates if you have the dependencies actually referenced in your app. If they don't appear in your dependencies at all, then they will be considered unused. If you decide to mark those as "keep" they will always be retained, but never upgraded because the dependencies are never discovered/used.

You can also enable the new resolver (see #125 for details). This doesn't use the dependency versions plugin anymore but uses the catalog for the version information. For 1.0 this will be the default, but since it's quite a big change it's still behind a flag.

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

No branches or pull requests

2 participants