Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shadow packaging in code gen artifact #1214

Merged
merged 7 commits into from
Sep 19, 2020
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions kotlin/codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ plugins {
kotlin("jvm")
kotlin("kapt")
id("com.vanniktech.maven.publish")
id("com.github.johnrengelman.shadow") version "5.2.0"
id("com.github.johnrengelman.shadow") version "6.0.0"
}

tasks.withType<KotlinCompile>().configureEach {
Expand All @@ -38,26 +38,30 @@ tasks.withType<KotlinCompile>().configureEach {
val shade: Configuration = configurations.maybeCreate("compileShaded")
configurations.getByName("compileOnly").extendsFrom(shade)
dependencies {
implementation(project(":moshi"))
implementation(kotlin("reflect"))
// Use `api` because kapt will not resolve `runtime` dependencies without it, only `compile`
ZacSweers marked this conversation as resolved.
Show resolved Hide resolved
api(project(":moshi"))
api(kotlin("reflect"))
shade(Dependencies.Kotlin.metadata) {
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
}
implementation(Dependencies.KotlinPoet.kotlinPoet)
api(Dependencies.KotlinPoet.kotlinPoet)
shade(Dependencies.KotlinPoet.metadata) {
exclude(group = "org.jetbrains.kotlin")
exclude(group = "com.squareup", module = "kotlinpoet")
}
shade(Dependencies.KotlinPoet.metadataSpecs) {
exclude(group = "org.jetbrains.kotlin")
exclude(group = "com.squareup", module = "kotlinpoet")
}
shade(Dependencies.KotlinPoet.elementsClassInspector) {
exclude(group = "org.jetbrains.kotlin")
exclude(group = "com.squareup", module = "kotlinpoet")
}
implementation(Dependencies.asm)
api(Dependencies.asm)

implementation(Dependencies.AutoService.annotations)
api(Dependencies.AutoService.annotations)
kapt(Dependencies.AutoService.processor)
implementation(Dependencies.Incap.annotations)
api(Dependencies.Incap.annotations)
kapt(Dependencies.Incap.processor)

// Copy these again as they're not automatically included since they're shaded
Expand Down Expand Up @@ -103,8 +107,7 @@ afterEvaluate {
if (name == "pluginMaven") {
// This is to properly wire the shadow jar's gradle metadata and pom information
setArtifacts(artifacts.matching { it.classifier != "" })
// Ugly but artifact() doesn't support TaskProviders
artifact(shadowJar.get())
artifact(shadowJar)
}
}
}
Expand Down