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

Update fails on a rich version declaration #17

Closed
eugene-krivobokov opened this issue Jan 29, 2022 · 2 comments
Closed

Update fails on a rich version declaration #17

eugene-krivobokov opened this issue Jan 29, 2022 · 2 comments
Assignees

Comments

@eugene-krivobokov
Copy link

eugene-krivobokov commented Jan 29, 2022

Environment:

nl.littlerobots.version-catalog-update: 0.2.1
com.github.ben-manes.versions: 0.39.0
Gradle: 7.3.2

libs.versions.toml:

[versions]
kotlinCoroutines = { strictly = "1.5.2-native-mt" }

[libraries]
kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinCoroutines" }
kotlin-coroutinesAndroid = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinCoroutines" }

Scenario:

./gradlew versionCatalogUpdate --no-configuration-cache

Unexpected result:

Caused by: java.lang.IllegalStateException: Expected class java.lang.String for key kotlinCoroutines, but was class java.util.LinkedHashMap	
at nl.littlerobots.vcu.VersionCatalogParser.parse(VersionCatalogParser.kt:131)	
at nl.littlerobots.vcu.plugin.VersionCatalogUpdateTask.updateCatalog(VersionCatalogUpdateTask.kt:83)

This format is only the one of possible: toml-dependencies-format

Expected behavior

It's not obvious how to make a decision in different combinations of a rich version.
There're higher chances that such customizations are because of some workarounds.
Maybe It's safer to start skipping them and warn users about this decision.

@eugene-krivobokov eugene-krivobokov changed the title Update fails on rich versions format Update fails on a rich version declaration Jan 29, 2022
@hvisser
Copy link
Contributor

hvisser commented Jan 29, 2022

Thanks for reporting, you're right I missed that a version could be a rich declaration in the version block too. There is some handling for library declarations but I think in that case the library is left alone without any updates, like you suggest. After checking; there is handling for it in the version parser, but the updating the catalog isn't handled correctly either, so that needs to be fixed too then 😅

@hvisser hvisser self-assigned this Jan 29, 2022
@hvisser
Copy link
Contributor

hvisser commented Jan 30, 2022

While there's no automatic update on version definitions with a condition, a message is logged when updates are available for dependencies using a condition.

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