Slackbot
11/23/2023, 10:07 PMVampire
11/23/2023, 10:42 PMIs there a way to disable inheritance for theconfiguration? I.e., it doesn't inherit thetestImplementationdependencies.implementation
configurations.implementation {
setExtendsFrom(listOf())
}
Also, are there other test configurations that inherit from main configuration?
testRuntimeOnly
https://github.com/gradle/gradle/blob/master/platforms/jvm/plugins-java/src/main/java/org/gradle/api/plugins/JavaPlugin.java#L381-L382Adam
11/23/2023, 10:44 PMMike Wacker
11/23/2023, 11:18 PM-Xlint:classfile compilation warning(/error with -Werror) that would happen if I incorrectly made a dependency an implementation dependency instead of an api dependency. You won't see that warning/error when you run the unit tests, but you will see it when you try to use the types in that module from another module.Mike Wacker
11/30/2023, 6:24 AMrealUnitTests test suite--and did a bulk-move of test sources from src/test/java to src/realUnitTests/java--I could get the behavior I want: each test suite starts from a blank slate in terms of dependencies. But is there a way to get that same blank slate behavior in the default test suite (which means that a bulk-move is not needed)?Mike Wacker
11/30/2023, 6:27 AMconfigurations.testImplementation {
setExtendsFrom(listOf())
}
It had an unfortunate side-effect: when I ran the tests, I got `ClassNotFoundException`(?) (I think it was that one, may have been something similar) exceptions; the implementation dependencies for the main sources were not available at runtime.Adam
11/30/2023, 9:43 AMVampire
11/30/2023, 1:58 PMjava plugin does is setting
• the compile classpath of the default test suite's source set to
â—¦ the output of the main source set
â—¦ and the default test suite's source set's compile classpath configuration
• the runtime classpath of the default test suites's source set to
â—¦ the output of the default test suites's source set,
â—¦ the output of the main source set
â—¦ and the default test suite's source set's runtime classpath configuration
• the default test suite's implementation configuration to extend from the main source set's implementation configuration
• the default test suite's runtimeOnly configuration to extend from the main source set's runtimeOnly configuration
If you want the behavior of custom test suites, you would need to revert those changes to their default settings, which I cannot tell you from the top of my head.Vampire
11/30/2023, 2:01 PMsrc/test/... make test task depend on the custom test task, and disable the test task. Then when the test task is run, it first runs the custom test task, itself does nothing as it is disabled, and the custom test task uses the unmoved sources from src/test/.... You might also want to disable other tasks like processTestResources, compileTestJava, and so on to avoid doing unnecessary work. But with that setup it should work without moving the actual files. It is just a bit awkward setup. 🙂