Slackbot
07/11/2022, 11:09 PMgrossws
07/11/2022, 11:22 PMruntimeClasspath
should break a build so `apiElements`/`runtimeElements` should be broken too. I would think that it should be enough to prevent the sqlite impl propagation. I'm not sure if you should care at all about `compileClasspath`/`compileOnly`/`compileOnlyApi` in this case.grossws
07/11/2022, 11:32 PMimplementation
it also should break the build preventing propagation if the dependency was brought transitively via `implementation`'s direct dependencies' afaik.
Do you want to forbid sqlite in the current module or taint all dependent projects to prevent them using sqlite through other deps? Later case seems more suited for platform with reject constraint.tony
07/11/2022, 11:34 PMtony
07/11/2022, 11:35 PMimplementation
also taint testImplementation
(testCompileClasspath and testRuntimeClasspath), for example?grossws
07/11/2022, 11:41 PMimplementation
should apply to testImplementation
in the same project, at least for a platform applied to the projectgrossws
07/11/2022, 11:42 PMgrossws
07/11/2022, 11:43 PMtony
07/11/2022, 11:43 PMcompileKotlin
will fail in the expected way, but compileTestKotlin
will nottony
07/11/2022, 11:43 PMgrossws
07/11/2022, 11:44 PMtony
07/11/2022, 11:45 PMgrossws
07/11/2022, 11:46 PMgrossws
07/11/2022, 11:48 PMgrossws
07/11/2022, 11:49 PMgrossws
07/11/2022, 11:49 PMtony
07/11/2022, 11:51 PMgrossws
07/11/2022, 11:51 PMtony
07/11/2022, 11:51 PMgrossws
07/11/2022, 11:51 PMgrossws
07/11/2022, 11:53 PMJendrik Johannes
07/12/2022, 6:23 AMimplementation
is the best choice imo. You wonât win anything by using api
. Using api
would mean that the constraint would propagate, at compile time, as âtransitive dependencyâ to all direct consumers of a project (thatâs what apiElements is for). But you would still have to add it to all projects as there is nothing that would allow you to just add it to one project and then propagate it everywhere at compile time. Hence, I would stick with implementation
.Jendrik Johannes
07/12/2022, 6:28 AMtestImplementation
-> implementation
is one of these things that were done in the early days of Gradle to mimic Maven behaviour. (Well to be correct it was testCompile
-> compile
back then, but this was preserved probably to not break to many existing things.). I wish this could be removed, but I doubt it will every happen (backward compatibility). Imo it meddles with the isolation of variants/sourceSets and makes things harder to understand. It would be much clearer (imo) if tests wonât automatically see all dependencies of main
. In the end, if something is implementation
for main
, why should the test see it (itâs supposed to be internal then).Jendrik Johannes
07/12/2022, 6:30 AMtest
to main
(ie, test variant depends on main variant - testImplementation(project(path))
- test will not only see your main code, but also everything that is api
. And âtestâ would be like a feature variant that behaves similar to other feature variants. Itâs still kind of complicated đ but it would be consistent.Jendrik Johannes
07/12/2022, 6:30 AMtest
is special in this regard and that is why other test setups (Kotion, Android) maybe do not have this relationship.tony
07/12/2022, 7:35 AMLouis Jacomet
07/12/2022, 7:41 AMcompileClasspath
and runtimeClasspath
extend from it.CristianGM
07/12/2022, 8:51 AMCristianGM
07/12/2022, 8:52 AMLouis Jacomet
07/12/2022, 8:54 AMCristianGM
07/12/2022, 8:55 AMLouis Jacomet
07/12/2022, 8:55 AMCristianGM
07/12/2022, 8:56 AMLouis Jacomet
07/12/2022, 8:56 AMforbiddenRuntimeDependenciesThatAreAllowedInTest
đCristianGM
07/12/2022, 9:00 AMtest
IIRCCristianGM
07/12/2022, 9:02 AMtony
07/12/2022, 6:59 PM- debugUnitTestRuntimeClasspath extendsFrom:
* testDebugRuntimeOnly
* testDebugImplementation
* testRuntimeOnly
* testImplementation
* debugUnitTestRuntimeOnly
* testRuntimeOnly
* testDebugRuntimeOnly
* debugUnitTestImplementation
* debugUnitTestApi
* testApi
* testDebugApi
* testImplementation
* testDebugImplementation
Jendrik Johannes
07/13/2022, 6:15 AM*Classpath
or also on *Elements
? The later would make it propagate. A build scan (or running dependencies
) should give more insights.tony
07/13/2022, 7:10 AMdebugRuntimeClasspath
extend from. The build scan was not super helpful; I still think these views have usability issues, and recall I used to teach people how to read this stuff. It clearly showed that the dependency was only present on debugUnitTestRuntimeClasspath
, and then a whole bunch of paths to the constraint that I couldn't parse.
Here's a snippet. I've also attached a screencap.
Dependency path 'register.common.addons:impl:unspecified' --> 'com.squareup.sqldelight:sqlite-driver:1.5.3'
Constraint path 'register.common.addons:impl:unspecified' --> 'register.common.addons:impl:unspecified' (debugRuntimeElements) --> 'com.squareup.sqldelight:sqlite-driver:{reject all versions}' because of the following reason: <omitted for brevity>'
...
The "dependency path" in question is testImplementation com.squareup.sqldelight:sqlite-driver:1.5.3
Does (debugRuntimeElements)
imply that my test classpath inherits from the runtime classpath and therefore inherits the constraint as well? I could believe it, even though my code walking the extendsFrom
relationship doesn't show it and it also conflicts with what I'd expect from the relationships described in the java-library plugin docs. I know those aren't exactly relevant for Android, but I was hoping (sigh) that Android was sane hereLouis Jacomet
07/13/2022, 2:16 PMdebugRuntimeElements extendsFrom debugRuntimeClasspath
but that would be really annoyingtony
07/13/2022, 5:01 PMextendsFrom
directly, or maybe it's in an afterEvaluate and it's an ordering issue that I can't see it. Well, I guess this idea is just dead in the waterJendrik Johannes
07/14/2022, 6:00 AM