Testing dependency resolution with capabilities via TestKit


After seeing capabilities mentioned in the 6.0 rc1 release notes, I started on a little plugin to provide capabilities for various slf4j-related dependencies so that common issues like including the log4j binding and the log4j bridge at the same time would fail at build time. Source here: https://bitbucket.org/marshallpierce/gradle-plugin-slf4j-capabilities/src

However, I can’t figure out how to get builds with configurations that I think should be invalid to fail, e.g. https://bitbucket.org/marshallpierce/gradle-plugin-slf4j-capabilities/src/4497f13fb861225243ca918e5fcf4f9aebdd740f/src/test/kotlin/org/mpierce/gradle/plugin/slf4j/capabilities/Slf4JCapabilitiesPluginTest.kt#lines-58.

Am I doing capabilities wrong, or is there something else I should do in testkit, or …?


It looks dependencies aren’t resolved unless there is at least one source file to compile, so adding a hello world class now lets me at least assert that lines for rejected modules are in the output. Is there a better / more structured way to assert on the result of dependency resolution?