1- import org.scoverage.ScoverageExtension
2-
31/*
42 * This file was generated by the Gradle 'init' task.
53 *
@@ -20,8 +18,17 @@ plugins {
2018 `maven- publish`
2119 signing
2220
23- id(" org.scoverage" ) version " 8.0.3"
24- id(" com.gradleup.shadow" ) version " 8.3.6"
21+ alias(libs.plugins.scoverage) apply false
22+ alias(libs.plugins.shadow)
23+ }
24+
25+ // Check if configuration cache is enabled
26+ val isConfigCacheEnabled = providers.gradleProperty(" org.gradle.configuration-cache" )
27+ .map { it.toBoolean() }.getOrElse(false )
28+
29+ // Conditionally apply Scoverage plugin when configuration cache is disabled
30+ if (! isConfigCacheEnabled) {
31+ apply (plugin = " org.scoverage" )
2532}
2633
2734repositories {
@@ -43,11 +50,11 @@ configurations {
4350}
4451
4552dependencies {
46- compileOnly(" org .scala-lang:scala- library: $scalaSpecificVersion " )
47- compileOnly(" com.fasterxml. jackson.dataformat:jackson-dataformat-yaml:2.17.1 " )
48- compileOnly(" com.fasterxml. jackson.module:jackson-module-scala_ $scalaVersion :2.17.1 " )
53+ compileOnly(libs .scala. library)
54+ compileOnly(libs. jackson.dataformat.yaml )
55+ compileOnly(libs. jackson.module.scala )
4956
50- api(" com.softwaremill. quicklens:quicklens_ $scalaVersion :1.9.7 " ) {
57+ api(libs. quicklens) {
5158 exclude(group = " org.scala-lang" )
5259 }
5360}
@@ -58,20 +65,25 @@ testing {
5865 val test by getting(JvmTestSuite ::class ) {
5966 dependencies {
6067 // Use Scalatest for testing our library
61- implementation(" org .scalatest:scalatest_ $scalaVersion :3.2.19 " )
62- implementation(" org .scalatestplus:junit-5-11_ $scalaVersion :3.2.19.0 " )
63- implementation(" org .scalamock:scalamock_ $scalaVersion :5.2.0 " )
68+ implementation(libs .scalatest)
69+ implementation(libs .scalatestplus.junit )
70+ implementation(libs .scalamock)
6471
6572 // Need scala-xml at test runtime
66- runtimeOnly(" org .scala-lang.modules:scala-xml_ $scalaVersion :1.3.1 " )
73+ runtimeOnly(libs .scala.xml )
6774 }
6875 }
6976 }
7077}
7178
7279tasks.test {
7380 jvmArgs(" -Djava.security.manager=allow" , " -Djdk.module.illegalAccess=deny" , " --add-opens=java.base/java.lang=ALL-UNNAMED" , " --add-opens=java.base/java.lang.invoke=ALL-UNNAMED" , " --add-opens=java.base/java.lang.reflect=ALL-UNNAMED" , " --add-opens=java.base/java.io=ALL-UNNAMED" , " --add-opens=java.base/java.net=ALL-UNNAMED" , " --add-opens=java.base/java.nio=ALL-UNNAMED" , " --add-opens=java.base/java.util=ALL-UNNAMED" , " --add-opens=java.base/java.util.concurrent=ALL-UNNAMED" , " --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED" , " --add-opens=java.base/sun.nio.ch=ALL-UNNAMED" , " --add-opens=java.base/sun.nio.cs=ALL-UNNAMED" , " --add-opens=java.base/sun.security.action=ALL-UNNAMED" , " --add-opens=java.base/sun.util.calendar=ALL-UNNAMED" , " --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED" )
74- finalizedBy(tasks.reportScoverage)
81+
82+ // Only finalize with Scoverage report when configuration cache is disabled
83+ if (! isConfigCacheEnabled) {
84+ finalizedBy(tasks.named(" reportScoverage" ))
85+ }
86+
7587 useJUnitPlatform {
7688 includeEngines(" scalatest" )
7789 testLogging {
@@ -120,13 +132,16 @@ tasks.jar {
120132tasks.shadowJar {
121133 archiveBaseName.set(" datacaterer" )
122134 archiveAppendix.set(" api" )
123- archiveVersion.set(project. version.toString())
135+ archiveVersion.set(version.toString())
124136 archiveClassifier.set(" " )
125137 isZip64 = true
126138}
127139
128- configure<ScoverageExtension > {
129- scoverageScalaVersion.set(" 2.12.15" )
140+ // Configure Scoverage only when it's applied (configuration cache disabled)
141+ if (! isConfigCacheEnabled) {
142+ configure< org.scoverage.ScoverageExtension > {
143+ scoverageScalaVersion.set(" 2.12.15" )
144+ }
130145}
131146
132147publishing {
@@ -145,7 +160,7 @@ publishing {
145160 artifact(tasks.shadowJar)
146161 artifact(tasks[" sourcesJar" ])
147162 artifact(tasks[" javadocJar" ])
148- groupId = project.properties[ " groupId " ] .toString()
163+ groupId = group .toString()
149164 artifactId = apiArtifactId
150165
151166 pom {
0 commit comments