Modernize build a bit (#1383)

This commit is contained in:
Zac Sweers
2021-08-23 17:09:59 -04:00
committed by GitHub
parent 95250b0359
commit 6947ab00d0
18 changed files with 113 additions and 153 deletions

View File

@@ -22,14 +22,15 @@ plugins {
kotlin("jvm")
kotlin("kapt")
id("com.vanniktech.maven.publish")
id("com.github.johnrengelman.shadow") version "7.0.0"
alias(libs.plugins.mavenShadow)
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
@Suppress("SuspiciousCollectionReassignment")
freeCompilerArgs += listOf(
"-Xopt-in=com.squareup.kotlinpoet.metadata.KotlinPoetMetadataPreview"
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=com.squareup.kotlinpoet.metadata.KotlinPoetMetadataPreview",
)
}
}
@@ -57,38 +58,38 @@ dependencies {
// https://youtrack.jetbrains.com/issue/KT-41702
api(project(":moshi"))
api(kotlin("reflect"))
shade(Dependencies.Kotlin.metadata) {
shade(libs.kotlinxMetadata) {
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
}
api(Dependencies.KotlinPoet.kotlinPoet)
shade(Dependencies.KotlinPoet.metadata) {
api(libs.kotlinpoet)
shade(libs.kotlinpoet.metadata.core) {
exclude(group = "org.jetbrains.kotlin")
exclude(group = "com.squareup", module = "kotlinpoet")
}
shade(Dependencies.KotlinPoet.metadataSpecs) {
shade(libs.kotlinpoet.metadata.specs) {
exclude(group = "org.jetbrains.kotlin")
exclude(group = "com.squareup", module = "kotlinpoet")
}
api(Dependencies.KotlinPoet.elementsClassInspector)
shade(Dependencies.KotlinPoet.elementsClassInspector) {
api(libs.kotlinpoet.elementsClassInspector)
shade(libs.kotlinpoet.elementsClassInspector) {
exclude(group = "org.jetbrains.kotlin")
exclude(group = "com.squareup", module = "kotlinpoet")
exclude(group = "com.google.guava")
}
api(Dependencies.asm)
api(libs.asm)
api(Dependencies.AutoService.annotations)
kapt(Dependencies.AutoService.processor)
api(Dependencies.Incap.annotations)
kapt(Dependencies.Incap.processor)
api(libs.autoService)
kapt(libs.autoService.processor)
api(libs.incap)
kapt(libs.incap.processor)
// Copy these again as they're not automatically included since they're shaded
testImplementation(Dependencies.KotlinPoet.metadata)
testImplementation(Dependencies.KotlinPoet.metadataSpecs)
testImplementation(Dependencies.KotlinPoet.elementsClassInspector)
testImplementation(Dependencies.Testing.junit)
testImplementation(Dependencies.Testing.truth)
testImplementation(Dependencies.Testing.compileTesting)
testImplementation(libs.kotlinpoet.metadata.core)
testImplementation(libs.kotlinpoet.metadata.specs)
testImplementation(libs.kotlinpoet.elementsClassInspector)
testImplementation(libs.junit)
testImplementation(libs.truth)
testImplementation(libs.kotlinCompileTesting)
}
val relocateShadowJar = tasks.register<ConfigureShadowRelocation>("relocateShadowJar") {