palantir / gradle-consistent-versions

Compact, constraint-friendly lockfiles for your dependencies
Apache License 2.0
113 stars 13 forks source link

Scope not recognized for dependencies in testFixtures* #691

Open dweiss opened 3 years ago

dweiss commented 3 years ago

Dependencies in testFixturesApi (and other configurations), now standard, are not recognized and cause this:

> Couldn't determine scope for dependency: bzzzz...:1.0.4
swanysimon commented 2 years ago

Related: https://github.com/palantir/gradle-consistent-versions/issues/308

I tried to force include the testFixtures source set, but this can cause issues with mismatched versions:

versionsLock {
    test {
        from(sourceSets.testFixtures)
    }
}

My current strategy is to make integrationTest extend from test, and then declare a testImplementation dependency on every dependency in a testFixtures* configuration. It's extremely unfortunate.

carterkozak commented 2 years ago

Hmm, the plugin will include all source sets with a name ending test (case insensitive) e.g. test and integrationTest, but I suppose it would be reasonable to include those which start with test as well. If you can rename testFixtures to end with test, that will unblock using existing versions.

https://github.com/palantir/gradle-consistent-versions/blob/a2212cfc89e01f16458aaee4df6a2440ec644520/src/main/java/com/palantir/gradle/versions/VersionsLockPlugin.java#L992-L996

swanysimon commented 2 years ago

The testFixtures* configurations are from a core Gradle plugin, so not really an option for us. I do like the idea of looking for configurations starting with test, since I (currently) can't think of any examples where you wouldn't want those included in the test version locks.