logging-capabilities
logging-capabilities copied to clipboard
Make build compatible with Gradle configuration cache
Gradle 6.6 will introduce a configuration cache.
This plugin can be applied and be compatible with the feature. However its build probably requires some work.
From my limited testing it looks like this plugin is compatible with the gradle plugin cache already. It's only when there's a configuration failure does the gradle configuration cache complain.
With loggingCapabilities.enforceLogback()
~/git/test-logging-libraries % ./gradlew run
Configuration cache is an incubating feature.
Calculating task graph as no configuration cache is available for tasks: run
> Task :app:run
Hello World!
22:15:50.028 [main] INFO test.logging.libraries.App - kek
BUILD SUCCESSFUL in 1s
2 actionable tasks: 1 executed, 1 up-to-date
Configuration cache entry stored.
Without loggingCapabilities.enforceLogback()
~/git/test-logging-libraries % ./gradlew run
Configuration cache is an incubating feature.
Calculating task graph as configuration cache cannot be reused because file 'app/build.gradle.kts' has changed.
> Task :app:compileJava FAILED
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:compileJava'.
> Could not resolve all files for configuration ':app:compileClasspath'.
> Could not resolve org.slf4j:slf4j-simple:1.7.30.
Required by:
project :app
> Module 'org.slf4j:slf4j-simple' has been rejected:
Cannot select module with conflict on capability 'dev.jacomet.logging:slf4j-impl:1.0' also provided by [ch.qos.logback:logback-classic:1.2.3(compile)]
> Could not resolve ch.qos.logback:logback-classic:1.2.3.
Required by:
project :app
> Module 'ch.qos.logback:logback-classic' has been rejected:
Cannot select module with conflict on capability 'dev.jacomet.logging:slf4j-impl:1.0' also provided by [org.slf4j:slf4j-simple:1.7.30(compile)]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Configuration cache problems found in this build.
2 problems were found storing the configuration cache.
- Task `:app:compileJava` of type `org.gradle.api.tasks.compile.JavaCompile`: value 'configuration ':app:compileClasspath'' failed to visit file collection
- Task `:app:run` of type `org.gradle.api.tasks.JavaExec`: value 'classpath' failed to visit file collection
See the complete report at file:///Users/cwalker/git/test-logging-libraries/build/reports/configuration-cache/19wne5bnmw8wnwom00lw4dei9/configuration-cache-report.html
> Could not resolve all files for configuration ':app:compileClasspath'.
> Could not resolve org.slf4j:slf4j-simple:1.7.30.
Required by:
project :app
> Module 'org.slf4j:slf4j-simple' has been rejected:
Cannot select module with conflict on capability 'dev.jacomet.logging:slf4j-impl:1.0' also provided by [ch.qos.logback:logback-classic:1.2.3(compile)]
> Could not resolve ch.qos.logback:logback-classic:1.2.3.
Required by:
project :app
> Module 'ch.qos.logback:logback-classic' has been rejected:
Cannot select module with conflict on capability 'dev.jacomet.logging:slf4j-impl:1.0' also provided by [org.slf4j:slf4j-simple:1.7.30(compile)]
> Could not resolve all files for configuration ':app:runtimeClasspath'.
> Could not resolve org.slf4j:slf4j-simple:1.7.30.
Required by:
project :app
> Module 'org.slf4j:slf4j-simple' has been rejected:
Cannot select module with conflict on capability 'dev.jacomet.logging:slf4j-impl:1.0' also provided by [ch.qos.logback:logback-classic:1.2.3(runtime)]
> Could not resolve ch.qos.logback:logback-classic:1.2.3.
Required by:
project :app
> Module 'ch.qos.logback:logback-classic' has been rejected:
Cannot select module with conflict on capability 'dev.jacomet.logging:slf4j-impl:1.0' also provided by [org.slf4j:slf4j-simple:1.7.30(runtime)]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
EDIT: Testing with Gradle 7.0 on jdk-16 on macOS Big Sur
Currently the build does not accept the configuration cache because the license plugin used is not compatible.
Closing as obsolete since the plugin code moved elsewhere.