diff --git a/build.gradle.kts b/build.gradle.kts index 22fca7f31a3..b9d5f401111 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,7 +17,7 @@ plugins { id("com.github.spotbugs") version "6.5.5" id("de.thetaphi.forbiddenapis") version "3.10" id("io.github.gradle-nexus.publish-plugin") version "2.0.0" - id("com.gradleup.shadow") version "8.3.9" apply false + id("com.gradleup.shadow") version "9.4.2" apply false id("me.champeau.jmh") version "0.7.3" apply false id("org.gradle.playframework") version "0.16.0" apply false } diff --git a/buildSrc/call-site-instrumentation-plugin/build.gradle.kts b/buildSrc/call-site-instrumentation-plugin/build.gradle.kts index 0667e21e1c9..b67d858bcb0 100644 --- a/buildSrc/call-site-instrumentation-plugin/build.gradle.kts +++ b/buildSrc/call-site-instrumentation-plugin/build.gradle.kts @@ -1,7 +1,7 @@ plugins { java id("com.diffplug.spotless") version "8.4.0" - id("com.gradleup.shadow") version "8.3.9" + id("com.gradleup.shadow") version "9.4.2" } java { @@ -69,7 +69,13 @@ tasks { } shadowJar { + duplicatesStrategy = DuplicatesStrategy.INCLUDE mergeServiceFiles() + // Service descriptors are intentionally merged by mergeServiceFiles(); let + // duplicate service entries reach that transformer instead of failing first. + filesNotMatching("META-INF/services/**") { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } manifest { attributes(mapOf("Main-Class" to "datadog.trace.plugin.csi.PluginApplication")) } diff --git a/buildSrc/modifiable-config-agent/build.gradle.kts b/buildSrc/modifiable-config-agent/build.gradle.kts index ddef5f7b008..c586b0123f8 100644 --- a/buildSrc/modifiable-config-agent/build.gradle.kts +++ b/buildSrc/modifiable-config-agent/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - id("com.gradleup.shadow") version "8.3.9" + id("com.gradleup.shadow") version "9.4.2" } java { diff --git a/dd-java-agent/agent-aiguard/build.gradle b/dd-java-agent/agent-aiguard/build.gradle index 70aab194be4..40d7d7d8d1f 100644 --- a/dd-java-agent/agent-aiguard/build.gradle +++ b/dd-java-agent/agent-aiguard/build.gradle @@ -34,4 +34,3 @@ tasks.named("shadowJar", ShadowJar) { tasks.named("jar", Jar) { archiveClassifier = 'unbundled' } - diff --git a/dd-java-agent/benchmark-integration/build.gradle b/dd-java-agent/benchmark-integration/build.gradle index 9a033a774d7..49f94e0714e 100644 --- a/dd-java-agent/benchmark-integration/build.gradle +++ b/dd-java-agent/benchmark-integration/build.gradle @@ -1,26 +1,3 @@ -buildscript { - repositories { - mavenLocal() - if (project.rootProject.hasProperty("gradlePluginProxy")) { - maven { - url project.rootProject.property("gradlePluginProxy") - allowInsecureProtocol = true - } - } - if (project.rootProject.hasProperty("mavenRepositoryProxy")) { - maven { - url project.rootProject.property("mavenRepositoryProxy") - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } - dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1' - } -} - apply from: "$rootDir/gradle/java.gradle" description = 'Integration Level Agent benchmarks.' diff --git a/dd-java-agent/build.gradle b/dd-java-agent/build.gradle index ae78df4410c..40b7c6fbd8a 100644 --- a/dd-java-agent/build.gradle +++ b/dd-java-agent/build.gradle @@ -81,8 +81,24 @@ dependencies { def generalShadowJarConfig(ShadowJar shadowJarTask) { shadowJarTask.with { mergeServiceFiles() + addMultiReleaseAttribute = false duplicatesStrategy = DuplicatesStrategy.FAIL + // Service descriptors are intentionally merged by mergeServiceFiles(); let + // duplicate service entries reach that transformer instead of failing first. + filesMatching('META-INF/services/**') { + duplicatesStrategy = DuplicatesStrategy.INCLUDE + } + // Vendored dependencies often repeat license/notice metadata. Keep one copy + // while still failing on unexpected duplicate runtime resources and classes. + filesMatching([ + 'META-INF/LICENSE*', + 'META-INF/NOTICE*', + 'META-INF/AL2.0', + 'META-INF/LGPL2.1', + ]) { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } // Remove some cruft from the final jar. // These patterns should NOT include **/META-INF/maven/**/pom.properties, which is @@ -99,6 +115,7 @@ def generalShadowJarConfig(ShadowJar shadowJarTask) { exclude '**/inst/META-INF/versions/**' exclude '**/META-INF/versions/*/org/yaml/**' exclude '**/package.html' + exclude '**/about.html' // Used to generate Java code during build, no need to include original file exclude '**/*.trie' @@ -257,7 +274,7 @@ includeSubprojShadowJar(project(':products:metrics:metrics-lib'), 'metrics', inc includeSubprojShadowJar(project(':products:feature-flagging:feature-flagging-agent'), 'feature-flagging', includedJarFileTree) def sharedShadowJar = tasks.register('sharedShadowJar', ShadowJar) { - it.configurations = [project.configurations.sharedShadowInclude] + it.configurations.add(project.configurations.named('sharedShadowInclude')) // Put the jar in a different directory so we don't overwrite the normal shadow jar and // break caching, and also to not interfere with CI scripts that copy everything in the // libs directory @@ -275,16 +292,16 @@ def sharedShadowJar = tasks.register('sharedShadowJar', ShadowJar) { exclude(project(':utils:time-utils')) exclude(project(':products:metrics:metrics-api')) exclude(project(':products:metrics:metrics-agent')) - exclude(dependency('org.slf4j::')) + exclude(dependency('org.slf4j:.*:.*')) // use dd-instrument-java's embedded copy of asm - exclude(dependency('org.ow2.asm:asm:')) + exclude(dependency('org.ow2.asm:asm:.*')) } } includeShadowJar(sharedShadowJar, 'shared', includedJarFileTree) // place the tracer in its own shadow jar separate to instrumentation def traceShadowJar = tasks.register('traceShadowJar', ShadowJar) { - it.configurations = [project.configurations.traceShadowInclude] + it.configurations.add(project.configurations.named('traceShadowInclude')) it.destinationDirectory.set(project.layout.buildDirectory.dir("trace-lib")) it.archiveClassifier = 'trace' it.dependencies deps.excludeShared @@ -299,7 +316,10 @@ tasks.named("shadowJar", ShadowJar) { generalShadowJarConfig(it) - configurations = [project.configurations.shadowInclude] + // The default shadowJar task has a runtimeClasspath convention. Replace it + // instead of adding to it, otherwise runtimeClasspath would be bundled too. + configurations.empty() + configurations.add(project.configurations.named('shadowInclude')) archiveClassifier = '' diff --git a/dd-java-agent/ddprof-lib/build.gradle b/dd-java-agent/ddprof-lib/build.gradle index b4f3219ae23..f6d653e3bbd 100644 --- a/dd-java-agent/ddprof-lib/build.gradle +++ b/dd-java-agent/ddprof-lib/build.gradle @@ -16,10 +16,8 @@ dependencies { } tasks.named("shadowJar", ShadowJar) { - dependencies { - deps.excludeShared - exclude '**/*.debug' - } + dependencies deps.excludeShared + exclude '**/*.debug' archiveClassifier = 'all' include { def rslt = false diff --git a/dd-java-agent/instrumentation/build.gradle b/dd-java-agent/instrumentation/build.gradle index 5e36217ad42..8077740656f 100644 --- a/dd-java-agent/instrumentation/build.gradle +++ b/dd-java-agent/instrumentation/build.gradle @@ -120,13 +120,37 @@ if (project.gradle.startParameter.taskNames.any { it.endsWith("generateMuzzleRep tasks.named('shadowJar', ShadowJar) { duplicatesStrategy = DuplicatesStrategy.FAIL + // Shadow 8.x silently wrote duplicate class (130+) entries into the instrumentation jar. + // Those duplicate entries did not survive as duplicates in the final agent jar, + // because `:dd-java-agent:expandAgentShadowJarInst` expands the instrumentation jar + // with a `Sync` task, and the specific `inst` expansion keeps the first duplicate path. + // (explicit `duplicatesStrategy = DuplicatesStrategy.EXCLUDE` on the `inst` prefix). + // + // Shadow 9 refactored deeply it's "copy" pipeline via https://github.com/GradleUp/shadow/pull/1233 + // by `Project.zipTree` and can now honor `DuplicatesStrategy`, see in particular + // * https://github.com/GradleUp/shadow/issues/1223 - Duplicates from jars are not handled per duplicatesStrategy + // * https://github.com/GradleUp/shadow/issues/488 - DuplicatesStrategy.FAIL doesn't work with transform + // + // Keeping `duplicatesStrategy = FAIL` only, Shadow 9 now fails while creating the instrumentation jar. + filesMatching([ + // agent-installer also publishes this Java 11 source-set output at runtime. + 'datadog/trace/agent/tooling/bytebuddy/DDJava9ClassFileTransformer*.class', + // agent-installer also publishes this Java 25 source-set output at runtime. + 'datadog/trace/agent/tooling/servicediscovery/MemFDUnixWriterFFM*.class', + // aggregate instrumentation includes some classes directly and via jars. + 'datadog/trace/instrumentation/**/*.class', + // same aggregate duplication, for Java 11 exception profiling advice. + 'datadog/exceptions/instrumentation/**/*.class', + ]) { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } dependencies { // the tracer is now in a separate shadow jar exclude(project(":dd-trace-core")) exclude(dependency('com.datadoghq:sketches-java')) exclude(dependency('com.google.re2j:re2j')) + deps.excludeShared.execute(it) } - dependencies deps.excludeShared } // temporary config to add slf4j-simple so we get logging from instrumenters while indexing diff --git a/dd-java-agent/instrumentation/liberty/liberty-23.0/build.gradle b/dd-java-agent/instrumentation/liberty/liberty-23.0/build.gradle index f90c9eed237..dbbcdb9b066 100644 --- a/dd-java-agent/instrumentation/liberty/liberty-23.0/build.gradle +++ b/dd-java-agent/instrumentation/liberty/liberty-23.0/build.gradle @@ -137,7 +137,10 @@ tasks.named('filterLogbackClassic', Sync) { } tasks.named("shadowJar", ShadowJar) { - configurations = [project.configurations.shadow] + // The default shadowJar task has a runtimeClasspath convention. Replace it + // instead of adding to it; this jar is intentionally built from the shadow configuration only. + configurations.empty() + configurations.add(project.configurations.named('shadow')) zip64 = true archiveFileName = 'openliberty-shadow.jar' diff --git a/dd-java-agent/instrumentation/servlet/jakarta-servlet-5.0/build.gradle b/dd-java-agent/instrumentation/servlet/jakarta-servlet-5.0/build.gradle index 93ffdc1a131..07a424a3113 100644 --- a/dd-java-agent/instrumentation/servlet/jakarta-servlet-5.0/build.gradle +++ b/dd-java-agent/instrumentation/servlet/jakarta-servlet-5.0/build.gradle @@ -37,7 +37,7 @@ tasks.register('relocatedJavaxJar', ShadowJar) { archiveClassifier.set('relocated-javax') - configurations = [project.configurations.javaxClassesToRelocate] + configurations.add(project.configurations.named('javaxClassesToRelocate')) include '**/*.jar' include '**/Servlet31InputStreamWrapper.class' diff --git a/dd-java-agent/testing/build.gradle b/dd-java-agent/testing/build.gradle index 02d83f9db62..f979f390728 100644 --- a/dd-java-agent/testing/build.gradle +++ b/dd-java-agent/testing/build.gradle @@ -67,9 +67,9 @@ tasks.named("shadowJar", ShadowJar) { // Only bundle jetty dependencies into the jar (relocated) // All other dependencies remain as transitive dependencies dependencies { - include(dependency { + include { it.moduleGroup == 'org.eclipse.jetty' || it.moduleGroup == 'org.eclipse.jetty.http2' - }) + } } // Relocate jetty classes to avoid conflicts with instrumented versions diff --git a/dd-smoke-tests/appsec/springboot-graphql/build.gradle b/dd-smoke-tests/appsec/springboot-graphql/build.gradle index 78ce91a23ca..6c07696b614 100644 --- a/dd-smoke-tests/appsec/springboot-graphql/build.gradle +++ b/dd-smoke-tests/appsec/springboot-graphql/build.gradle @@ -1,4 +1,5 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import com.github.jengelman.gradle.plugins.shadow.transformers.PropertiesFileTransformer plugins { id 'com.gradleup.shadow' @@ -16,8 +17,23 @@ jar { } shadowJar { - mergeServiceFiles { - include 'META-INF/spring.*' + duplicatesStrategy = DuplicatesStrategy.INCLUDE + mergeServiceFiles() + append 'META-INF/spring.handlers' + append 'META-INF/spring.schemas' + append 'META-INF/spring.tooling' + transform(PropertiesFileTransformer) { + paths = ['META-INF/spring.factories'] + mergeStrategy = "append" + } + filesNotMatching([ + 'META-INF/services/**', + 'META-INF/spring.handlers', + 'META-INF/spring.schemas', + 'META-INF/spring.tooling', + 'META-INF/spring.factories', + ]) { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE } } diff --git a/dd-smoke-tests/custom-systemloader/build.gradle b/dd-smoke-tests/custom-systemloader/build.gradle index b9d1d63caf3..28836e0f103 100644 --- a/dd-smoke-tests/custom-systemloader/build.gradle +++ b/dd-smoke-tests/custom-systemloader/build.gradle @@ -14,7 +14,7 @@ tasks.named("jar", Jar) { } tasks.named("shadowJar", ShadowJar) { - configurations = [project.configurations.runtimeClasspath] + configurations.add(project.configurations.named('runtimeClasspath')) } dependencies { diff --git a/dd-smoke-tests/field-injection/build.gradle b/dd-smoke-tests/field-injection/build.gradle index 2117c2e056b..468f33342f9 100644 --- a/dd-smoke-tests/field-injection/build.gradle +++ b/dd-smoke-tests/field-injection/build.gradle @@ -14,7 +14,7 @@ tasks.named("jar", Jar) { } tasks.named("shadowJar", ShadowJar) { - configurations = [project.configurations.runtimeClasspath] + configurations.add(project.configurations.named('runtimeClasspath')) } dependencies { diff --git a/dd-smoke-tests/grpc-1.5/build.gradle b/dd-smoke-tests/grpc-1.5/build.gradle index 4babb64d12c..d691a9e157f 100644 --- a/dd-smoke-tests/grpc-1.5/build.gradle +++ b/dd-smoke-tests/grpc-1.5/build.gradle @@ -39,8 +39,12 @@ protobuf { } tasks.withType(ShadowJar).configureEach { + duplicatesStrategy = DuplicatesStrategy.INCLUDE archiveClassifier.set("fat") mergeServiceFiles() + filesNotMatching('META-INF/services/**') { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } } tasks.withType(Test).configureEach { diff --git a/dd-smoke-tests/iast-propagation/build.gradle b/dd-smoke-tests/iast-propagation/build.gradle index 89a7fd287dc..33d3d1019e0 100644 --- a/dd-smoke-tests/iast-propagation/build.gradle +++ b/dd-smoke-tests/iast-propagation/build.gradle @@ -30,7 +30,7 @@ tasks.named("jar", Jar) { } tasks.named("shadowJar", ShadowJar) { - configurations = [project.configurations.runtimeClasspath] + configurations.add(project.configurations.named('runtimeClasspath')) } dependencies { diff --git a/dd-smoke-tests/log-injection/build.gradle b/dd-smoke-tests/log-injection/build.gradle index e4e86df74ed..9e01a511e8b 100644 --- a/dd-smoke-tests/log-injection/build.gradle +++ b/dd-smoke-tests/log-injection/build.gradle @@ -178,7 +178,9 @@ def generateTestingJar(String interfaceName, String backend, List("shadowJ dependencies { // direct dependencies exclude(project(":dd-trace-api")) - exclude(dependency("io.opentracing:")) - exclude(dependency("io.opentracing.contrib:")) - exclude(dependency("org.slf4j:")) - exclude(dependency("com.github.jnr:")) + exclude(dependency("io.opentracing:.*:.*")) + exclude(dependency("io.opentracing.contrib:.*:.*")) + exclude(dependency("org.slf4j:.*:.*")) + exclude(dependency("com.github.jnr:.*:.*")) // indirect dependency of JNR, no need to embed - exclude(dependency("org.ow2.asm:")) + exclude(dependency("org.ow2.asm:.*:.*")) } relocate("com.", "ddtrot.com.") { diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index e8daf61cd03..a037fccee09 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -7,71 +7,76 @@ final class CachedData { // Inverse of "shared". These exclude directives are part of shadowJar's DSL // which is similar but not exactly the same as the regular gradle dependency{} block // Also, transitive dependencies have to be explicitly listed - excludeShared : (Closure) { - // projects bundled with shared or on bootstrap - exclude(project(':dd-java-agent:agent-bootstrap')) - exclude(project(':dd-java-agent:agent-debugger:debugger-bootstrap')) - exclude(project(':dd-java-agent:agent-logging')) - exclude(project(':dd-trace-api')) - exclude(project(':internal-api')) - exclude(project(':internal-api:internal-api-9')) - exclude(project(':communication')) - exclude(project(':components:context')) - exclude(project(':components:environment')) - exclude(project(':components:json')) - exclude(project(':products:feature-flagging:feature-flagging-bootstrap')) - exclude(project(':products:metrics:metrics-agent')) - exclude(project(':products:metrics:metrics-api')) - exclude(project(':products:metrics:metrics-lib')) - exclude(project(':remote-config:remote-config-api')) - exclude(project(':remote-config:remote-config-core')) - exclude(project(':telemetry')) - exclude(project(':utils:config-utils')) - exclude(project(':utils:container-utils')) - exclude(project(':utils:filesystem-utils')) - exclude(project(':utils:queue-utils')) - exclude(project(':utils:socket-utils')) - exclude(project(':utils:time-utils')) - exclude(project(':utils:logging-utils')) - exclude(project(':utils:version-utils')) - exclude(project(':dd-java-agent:agent-crashtracking')) - exclude(project(':dd-java-agent:ddprof-lib')) - exclude(dependency('org.slf4j::')) - exclude(dependency(':dd-instrument-java:')) + // Can't use shadow's Action because dependencies.gradle is used in + // projects that don't have this plugin (e.g. the other unrelated declarations) + excludeShared : new Action() { + @Override + void execute(Object filter) { + // projects bundled with shared or on bootstrap + filter.exclude(filter.project(':dd-java-agent:agent-bootstrap')) + filter.exclude(filter.project(':dd-java-agent:agent-debugger:debugger-bootstrap')) + filter.exclude(filter.project(':dd-java-agent:agent-logging')) + filter.exclude(filter.project(':dd-trace-api')) + filter.exclude(filter.project(':internal-api')) + filter.exclude(filter.project(':internal-api:internal-api-9')) + filter.exclude(filter.project(':communication')) + filter.exclude(filter.project(':components:context')) + filter.exclude(filter.project(':components:environment')) + filter.exclude(filter.project(':components:json')) + filter.exclude(filter.project(':products:feature-flagging:feature-flagging-bootstrap')) + filter.exclude(filter.project(':products:metrics:metrics-agent')) + filter.exclude(filter.project(':products:metrics:metrics-api')) + filter.exclude(filter.project(':products:metrics:metrics-lib')) + filter.exclude(filter.project(':remote-config:remote-config-api')) + filter.exclude(filter.project(':remote-config:remote-config-core')) + filter.exclude(filter.project(':telemetry')) + filter.exclude(filter.project(':utils:config-utils')) + filter.exclude(filter.project(':utils:container-utils')) + filter.exclude(filter.project(':utils:filesystem-utils')) + filter.exclude(filter.project(':utils:queue-utils')) + filter.exclude(filter.project(':utils:socket-utils')) + filter.exclude(filter.project(':utils:time-utils')) + filter.exclude(filter.project(':utils:logging-utils')) + filter.exclude(filter.project(':utils:version-utils')) + filter.exclude(filter.project(':dd-java-agent:agent-crashtracking')) + filter.exclude(filter.project(':dd-java-agent:ddprof-lib')) + filter.exclude(filter.dependency('org.slf4j:.*:.*')) + filter.exclude(filter.dependency('.*:dd-instrument-java:.*')) - // okhttp and its transitives (both fork and non-fork) - exclude(dependency('com.datadoghq.okhttp3:okhttp')) - exclude(dependency('com.squareup.okhttp3:okhttp')) - exclude(dependency('com.datadoghq.okio:okio')) - exclude(dependency('com.squareup.okio:okio')) - exclude(dependency('at.yawk.lz4:lz4-java')) - exclude(dependency('io.airlift:aircompressor')) + // okhttp and its transitives (both fork and non-fork) + filter.exclude(filter.dependency('com.datadoghq.okhttp3:okhttp')) + filter.exclude(filter.dependency('com.squareup.okhttp3:okhttp')) + filter.exclude(filter.dependency('com.datadoghq.okio:okio')) + filter.exclude(filter.dependency('com.squareup.okio:okio')) + filter.exclude(filter.dependency('at.yawk.lz4:lz4-java')) + filter.exclude(filter.dependency('io.airlift:aircompressor')) - // dogstatsd and its transitives - exclude(dependency('com.datadoghq:java-dogstatsd-client')) - exclude(dependency('com.github.jnr::')) - exclude(dependency('org.ow2.asm::')) + // dogstatsd and its transitives + filter.exclude(filter.dependency('com.datadoghq:java-dogstatsd-client')) + filter.exclude(filter.dependency('com.github.jnr:.*:.*')) + filter.exclude(filter.dependency('org.ow2.asm:.*:.*')) - // sketches-java used by dd-trace-core (DataStreams) and metrics - exclude(dependency('com.datadoghq:sketches-java')) + // sketches-java used by dd-trace-core (DataStreams) and metrics + filter.exclude(filter.dependency('com.datadoghq:sketches-java')) - // javac plugin client - exclude(dependency('com.datadoghq:dd-javac-plugin-client')) + // javac plugin client + filter.exclude(filter.dependency('com.datadoghq:dd-javac-plugin-client')) - // moshi and its transitives - exclude(dependency('com.squareup.moshi::')) + // moshi and its transitives + filter.exclude(filter.dependency('com.squareup.moshi:.*:.*')) - // jctools and its transitives - exclude(dependency('org.jctools::')) + // jctools and its transitives + filter.exclude(filter.dependency('org.jctools:.*:.*')) - // cafe_crypto and its transitives - exclude(dependency('cafe.cryptography::')) + // cafe_crypto and its transitives + filter.exclude(filter.dependency('cafe.cryptography:.*:.*')) - // snakeyaml-engine and its transitives - exclude(dependency('org.snakeyaml:snakeyaml-engine')) + // snakeyaml-engine and its transitives + filter.exclude(filter.dependency('org.snakeyaml:snakeyaml-engine')) - // re2j and its transitives - exclude(dependency('com.google.re2j:re2j')) + // re2j and its transitives + filter.exclude(filter.dependency('com.google.re2j:re2j')) + } } ] } diff --git a/products/feature-flagging/feature-flagging-agent/build.gradle.kts b/products/feature-flagging/feature-flagging-agent/build.gradle.kts index 902ae5a6023..10a93e79e43 100644 --- a/products/feature-flagging/feature-flagging-agent/build.gradle.kts +++ b/products/feature-flagging/feature-flagging-agent/build.gradle.kts @@ -1,4 +1,6 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.DependencyFilter import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import org.gradle.api.Action import org.gradle.kotlin.dsl.project plugins { @@ -23,8 +25,7 @@ dependencies { tasks.named("shadowJar") { dependencies { val deps = project.extra["deps"] as Map<*, *> - val excludeShared = deps["excludeShared"] as groovy.lang.Closure<*> - excludeShared.delegate = this - excludeShared.call() + val excludeShared = deps["excludeShared"] as Action + excludeShared.execute(this) } } diff --git a/products/metrics/metrics-lib/build.gradle.kts b/products/metrics/metrics-lib/build.gradle.kts index ae38432669a..3a6cca1dd49 100644 --- a/products/metrics/metrics-lib/build.gradle.kts +++ b/products/metrics/metrics-lib/build.gradle.kts @@ -1,4 +1,6 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.DependencyFilter import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import org.gradle.api.Action plugins { `java-library` @@ -27,9 +29,8 @@ dependencies { tasks.named("shadowJar") { dependencies { val deps = project.extra["deps"] as Map<*, *> - val excludeShared = deps["excludeShared"] as groovy.lang.Closure<*> - excludeShared.delegate = this - excludeShared.call() + val excludeShared = deps["excludeShared"] as Action + excludeShared.execute(this) } }