Shadow Gradle plugin 3rd party dependencies
Such dependencies will be embedded into plugin jar and their package will be relocated. This is need to avoid dependency conflicts with user build scripts dependencies or other Gradle plugins. Kotlin project dependencies are not shadowed. ^KT-46034 Fixed
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import org.jetbrains.dokka.gradle.DokkaTask
|
||||
import org.jetbrains.kotlin.pill.PillExtension
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import com.github.jengelman.gradle.plugins.shadow.transformers.DontIncludeResourceTransformer
|
||||
|
||||
plugins {
|
||||
id("gradle-plugin-common-configuration")
|
||||
@@ -54,18 +56,18 @@ dependencies {
|
||||
commonCompileOnly(intellijCore())
|
||||
commonCompileOnly(commonDependency("org.jetbrains.teamcity:serviceMessages"))
|
||||
commonCompileOnly("com.gradle:gradle-enterprise-gradle-plugin:3.9")
|
||||
commonCompileOnly(commonDependency("com.google.code.gson:gson"))
|
||||
commonCompileOnly(commonDependency("com.google.guava:guava"))
|
||||
commonCompileOnly("de.undercouch:gradle-download-task:4.1.1")
|
||||
commonCompileOnly("com.github.gundy:semver4j:0.16.4:nodeps") {
|
||||
exclude(group = "*")
|
||||
}
|
||||
commonCompileOnly(project(":kotlin-tooling-metadata"))
|
||||
|
||||
commonImplementation(project(":kotlin-gradle-plugin-idea"))
|
||||
commonImplementation(project(":kotlin-util-klib"))
|
||||
commonImplementation(project(":native:kotlin-klib-commonizer-api"))
|
||||
commonImplementation(project(":kotlin-tooling-metadata"))
|
||||
commonImplementation(project(":kotlin-project-model"))
|
||||
commonImplementation(commonDependency("com.google.code.gson:gson"))
|
||||
commonImplementation(commonDependency("com.google.guava:guava"))
|
||||
commonImplementation("de.undercouch:gradle-download-task:4.1.1")
|
||||
commonImplementation("com.github.gundy:semver4j:0.16.4:nodeps") {
|
||||
exclude(group = "*")
|
||||
}
|
||||
|
||||
commonRuntimeOnly(project(":kotlin-compiler-embeddable"))
|
||||
commonRuntimeOnly(project(":kotlin-annotation-processing-gradle"))
|
||||
@@ -80,6 +82,11 @@ dependencies {
|
||||
embedded(commonDependency("com.google.code.gson:gson")) { isTransitive = false }
|
||||
embedded(commonDependency("com.google.guava:guava")) { isTransitive = false }
|
||||
embedded(commonDependency("org.jetbrains.teamcity:serviceMessages")) { isTransitive = false }
|
||||
embedded(project(":kotlin-tooling-metadata")) { isTransitive = false }
|
||||
embedded("de.undercouch:gradle-download-task:4.1.1")
|
||||
embedded("com.github.gundy:semver4j:0.16.4:nodeps") {
|
||||
exclude(group = "*")
|
||||
}
|
||||
|
||||
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
"functionalTestImplementation"("com.android.tools.build:gradle:4.0.1") {
|
||||
@@ -87,6 +94,7 @@ dependencies {
|
||||
}
|
||||
"functionalTestImplementation"(gradleKotlinDsl())
|
||||
"functionalTestImplementation"(project(":kotlin-gradle-plugin-kpm-android"))
|
||||
"functionalTestImplementation"(project(":kotlin-tooling-metadata"))
|
||||
"functionalTestImplementation"(testFixtures(project(":kotlin-gradle-plugin-idea")))
|
||||
}
|
||||
|
||||
@@ -102,6 +110,7 @@ dependencies {
|
||||
testImplementation(project(":kotlin-test:kotlin-test-junit"))
|
||||
testImplementation(commonDependency("junit:junit"))
|
||||
testImplementation(project(":kotlin-gradle-statistics"))
|
||||
testImplementation(project(":kotlin-tooling-metadata"))
|
||||
}
|
||||
|
||||
if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
@@ -135,6 +144,17 @@ tasks {
|
||||
register("dokka") {
|
||||
dependsOn(named("dokkaJavadoc"))
|
||||
}
|
||||
|
||||
withType<ShadowJar>().configureEach {
|
||||
relocate("com.github.gundy", "$kotlinEmbeddableRootPackage.com.github.gundy")
|
||||
relocate("de.undercouch.gradle.tasks.download", "$kotlinEmbeddableRootPackage.de.undercouch.gradle.tasks.download")
|
||||
|
||||
// don't expose external Gradle plugin marker
|
||||
// workaround from https://github.com/johnrengelman/shadow/issues/505#issuecomment-644098082
|
||||
transform(DontIncludeResourceTransformer::class.java) {
|
||||
resource = "META-INF/gradle-plugins/de.undercouch.download.properties"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
projectTest {
|
||||
|
||||
@@ -7,6 +7,7 @@ plugins {
|
||||
publish()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
configureKotlinCompileTasksGradleCompatibility()
|
||||
|
||||
dependencies {
|
||||
implementation(kotlinStdlib())
|
||||
|
||||
Reference in New Issue
Block a user