Don't publish testing -all jar. (#3493)

This commit is contained in:
Anuraag Agrawal 2021-07-06 06:12:04 +09:00 committed by GitHub
parent f5d6b39b72
commit 3fc5d71771
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

View File

@ -40,7 +40,7 @@ val testInstrumentation by configurations.creating {
isCanBeResolved = true
}
tasks.named<ShadowJar>("shadowJar").configure {
tasks.shadowJar {
configurations = listOf(project.configurations.runtimeClasspath.get(), testInstrumentation)
archiveFileName.set("agent-testing.jar")
@ -108,6 +108,19 @@ afterEvaluate {
}
}
// shadowJar is only used for creating a jar for testing, but the shadow plugin automatically adds
// it to a project's published Java component. Skip it if publishing is configured for this
// project.
plugins.withId("maven-publish") {
configure<PublishingExtension> {
(components["java"] as AdhocComponentWithVariants).run {
withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
skip()
}
}
}
}
configurations.configureEach {
if (name.toLowerCase().endsWith("testruntimeclasspath")) {
// Added by agent, don't let Gradle bring it in when running tests.