refreshVersions icon indicating copy to clipboard operation
refreshVersions copied to clipboard

[Question/Bug] - Does it handle same publishedGroupId same artifact version but different artifact name?

Open GuilhE opened this issue 5 years ago • 3 comments

Checklist

  • [ ] I verified that the task ./gradlew :dependencyUpdates works correctly. If that's not the case, it's better to submit a bug-report to https://github.com/ben-manes/gradle-versions-plugin
  • [ ] I tried to reproduce the bug within sample-groovy, sample-kotlin or sample-versionsOnlyMode
  • [ ] I have run with $ ./gradlew --scan buildSrcVersions or $./gradlew --scan refreshVersions to provide a Build Scan URL

Describe the bug

I think I might have discovered a bug. It appears that if I have the same publishedGroupId, same artifact version but different artifact name, this plugin will create a const shared by both versions and it will not notify about updates if one of the artifacts gets an update.

To Reproduce Well I didn't try to reproduce because I caught this by "fixing it". So I moved on and saved the configuration for later issue a report.

So, Libs.kt:

/**
 * https://guilhe.github.io/ResourcesProvider-ktx/
 */
const val resources_provider_ktx: String = "com.github.guilhe:resources-provider-ktx:" +
        Versions.com_github_guilhe

/**
 * https://github.com/GuilhE/android-quantity-picker-view
 */
const val quantity_picker_view: String = "com.github.guilhe:quantity-picker-view:" +
        Versions.com_github_guilhe

Same publishedGroupId (com.github.guilhe), different artifacts (quantity-picker-view | resources-provider-ktx), and same version generated:

const val com_github_guilhe: String = "1.2.0"

Somewhere in time, they shared the same version, that's probably why the const was created and shared in the first place. Lately, one of the libs receives an update and, after a successful ./gradlew buildSrcVersions, no "update comment" was shown in Verions.kt. I had to manually update it.

Expected behavior No common version const for different artifacts with same publishedGroupId

Additional context After a "manually re-import" a different const for each artifact was generated:

 /**
  * https://guilhe.github.io/ResourcesProvider-ktx/
  */
 const val resources_provider_ktx: String = "com.github.guilhe:resources-provider-ktx:" +
         Versions.resources_provider_ktx

 /**
  * https://github.com/GuilhE/android-quantity-picker-view
  */
 const val quantity_picker_view: String = "com.github.guilhe:quantity-picker-view:" +
         Versions.quantity_picker_view

    const val quantity_picker_view: String = "1.2.1"
    const val resources_provider_ktx: String = "1.2.0"

Now they're independent and both receives "update hints".

GuilhE avatar Mar 17 '20 00:03 GuilhE

Anyone?

GuilhE avatar Mar 28 '20 16:03 GuilhE

Bump

GuilhE avatar Sep 13 '20 13:09 GuilhE

Hello @GuilhE, First, I'd like to apologize for not responding earlier to your issue.

We are no longer supporting buildSrcVersions and we have replaced it by refreshVersions. It works a little differently as it doesn't touch your buildSrc (in order to not invalidate the whole build on each edit which would break all build caches and incremental compilation), and instead provides hand-crafted dependency constants, and lets you put the versions in a separate versions.properties file.

You can keep using current constants with it by replacing the version with an underscore (_), that is a version placeholder that tells refreshVersions to set the actual version from the versions.properties file using Gradle APIs.

Would you look at the new setting up guide and docs and try it?

LouisCAD avatar Sep 13 '20 19:09 LouisCAD