[kpm] :kgp-idea-proto: Use default 'embedded' configuration over custom 'shadows'

This commit is contained in:
sebastian.sellmair
2022-06-20 13:22:40 +02:00
committed by Space
parent e158cf5dd2
commit 096897492b
@@ -12,32 +12,20 @@ kotlin {
} }
} }
val shadows by configurations.creating { val embedded by configurations.getting {
isCanBeConsumed = false
isCanBeResolved = false
isTransitive = false isTransitive = false
configurations.getByName("compileOnly").extendsFrom(this) configurations.getByName("compileOnly").extendsFrom(this)
configurations.getByName("testImplementation").extendsFrom(this) configurations.getByName("testImplementation").extendsFrom(this)
} }
val shadowsRuntime by configurations.creating {
isCanBeConsumed = false
isCanBeResolved = true
isTransitive = false
extendsFrom(shadows)
attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attributes.attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
}
dependencies { dependencies {
api(project(":kotlin-gradle-plugin-idea")) api(project(":kotlin-gradle-plugin-idea"))
shadows("com.google.protobuf:protobuf-java:3.19.4") embedded("com.google.protobuf:protobuf-java:3.19.4")
shadows("com.google.protobuf:protobuf-kotlin:3.19.4") embedded("com.google.protobuf:protobuf-kotlin:3.19.4")
testImplementation(project(":kotlin-test:kotlin-test-junit")) testImplementation(project(":kotlin-test:kotlin-test-junit"))
testImplementation(testFixtures(project(":kotlin-gradle-plugin-idea"))) testImplementation(testFixtures(project(":kotlin-gradle-plugin-idea")))
} }
configureKotlinCompileTasksGradleCompatibility() configureKotlinCompileTasksGradleCompatibility()
sourceSets.main.configure { sourceSets.main.configure {
@@ -47,10 +35,9 @@ sourceSets.main.configure {
javadocJar() javadocJar()
sourcesJar() sourcesJar()
runtimeJar(tasks.register<ShadowJar>("shadowJar")) { runtimeJar(tasks.register<ShadowJar>("embeddable")) {
exclude("**/*.proto")
from(mainSourceSet.output) from(mainSourceSet.output)
configurations = listOf(shadowsRuntime) exclude("**/*.proto")
relocate("com.google.protobuf", "org.jetbrains.kotlin.kpm.idea.proto.com.google.protobuf") relocate("com.google.protobuf", "org.jetbrains.kotlin.kpm.idea.proto.com.google.protobuf")
} }