From 8277b9bdb815638397f399eed50530219d0d8c15 Mon Sep 17 00:00:00 2001 From: Alan Cai Date: Tue, 9 Jul 2024 17:19:20 -0700 Subject: [PATCH] Fix published jars for non-shadowed packages (cherry picked from commit 6b49fc19f0e18fc5a80d1b8c07e9c0fac9b2f492) --- partiql-ast/build.gradle.kts | 11 +++++++++++ partiql-coverage/build.gradle.kts | 11 +++++++++++ partiql-plan/build.gradle.kts | 11 +++++++++++ partiql-planner/build.gradle.kts | 11 +++++++++++ partiql-spi/build.gradle.kts | 11 +++++++++++ partiql-types/build.gradle.kts | 11 +++++++++++ 6 files changed, 66 insertions(+) diff --git a/partiql-ast/build.gradle.kts b/partiql-ast/build.gradle.kts index c5e94c9ce1..5d97131c7d 100644 --- a/partiql-ast/build.gradle.kts +++ b/partiql-ast/build.gradle.kts @@ -25,6 +25,17 @@ dependencies { api(project(":partiql-types")) } +tasks.shadowJar { + configurations = listOf(project.configurations.shadow.get()) +} + +// Workaround for https://github.com/johnrengelman/shadow/issues/651 +components.withType(AdhocComponentWithVariants::class.java).forEach { c -> + c.withVariantsFromConfiguration(project.configurations.shadowRuntimeElements.get()) { + skip() + } +} + publish { artifactId = "partiql-ast" name = "PartiQL AST" diff --git a/partiql-coverage/build.gradle.kts b/partiql-coverage/build.gradle.kts index 9765b4d568..f99d60e1f0 100644 --- a/partiql-coverage/build.gradle.kts +++ b/partiql-coverage/build.gradle.kts @@ -28,6 +28,17 @@ dependencies { implementation(Deps.jgenhtml) } +tasks.shadowJar { + configurations = listOf(project.configurations.shadow.get()) +} + +// Workaround for https://github.com/johnrengelman/shadow/issues/651 +components.withType(AdhocComponentWithVariants::class.java).forEach { c -> + c.withVariantsFromConfiguration(project.configurations.shadowRuntimeElements.get()) { + skip() + } +} + // Need to add this as we have both Java and Kotlin sources. Dokka already handles multi-language projects. If // Javadoc is enabled, we end up overwriting index.html (causing compilation errors). tasks.withType() { diff --git a/partiql-plan/build.gradle.kts b/partiql-plan/build.gradle.kts index 63683435ae..37ee2104ce 100644 --- a/partiql-plan/build.gradle.kts +++ b/partiql-plan/build.gradle.kts @@ -26,6 +26,17 @@ dependencies { implementation(Deps.kotlinReflect) } +tasks.shadowJar { + configurations = listOf(project.configurations.shadow.get()) +} + +// Workaround for https://github.com/johnrengelman/shadow/issues/651 +components.withType(AdhocComponentWithVariants::class.java).forEach { c -> + c.withVariantsFromConfiguration(project.configurations.shadowRuntimeElements.get()) { + skip() + } +} + // Disabled for partiql-plan project. kotlin { explicitApi = null diff --git a/partiql-planner/build.gradle.kts b/partiql-planner/build.gradle.kts index 6cc00ec323..11c7dc9c9a 100644 --- a/partiql-planner/build.gradle.kts +++ b/partiql-planner/build.gradle.kts @@ -38,6 +38,17 @@ dependencies { testFixturesImplementation(project(":partiql-spi")) } +tasks.shadowJar { + configurations = listOf(project.configurations.shadow.get()) +} + +// Workaround for https://github.com/johnrengelman/shadow/issues/651 +components.withType(AdhocComponentWithVariants::class.java).forEach { c -> + c.withVariantsFromConfiguration(project.configurations.shadowRuntimeElements.get()) { + skip() + } +} + tasks.register("generateResourcePath") { dependsOn("processTestFixturesResources") doLast { diff --git a/partiql-spi/build.gradle.kts b/partiql-spi/build.gradle.kts index 27a3016a65..e38283bead 100644 --- a/partiql-spi/build.gradle.kts +++ b/partiql-spi/build.gradle.kts @@ -24,6 +24,17 @@ dependencies { testImplementation(Deps.kasechange) } +tasks.shadowJar { + configurations = listOf(project.configurations.shadow.get()) +} + +// Workaround for https://github.com/johnrengelman/shadow/issues/651 +components.withType(AdhocComponentWithVariants::class.java).forEach { c -> + c.withVariantsFromConfiguration(project.configurations.shadowRuntimeElements.get()) { + skip() + } +} + publish { artifactId = "partiql-spi" name = "PartiQL SPI" diff --git a/partiql-types/build.gradle.kts b/partiql-types/build.gradle.kts index b7559baacf..b4fd0246ec 100644 --- a/partiql-types/build.gradle.kts +++ b/partiql-types/build.gradle.kts @@ -23,6 +23,17 @@ dependencies { implementation(Deps.kotlinxCollections) } +tasks.shadowJar { + configurations = listOf(project.configurations.shadow.get()) +} + +// Workaround for https://github.com/johnrengelman/shadow/issues/651 +components.withType(AdhocComponentWithVariants::class.java).forEach { c -> + c.withVariantsFromConfiguration(project.configurations.shadowRuntimeElements.get()) { + skip() + } +} + publish { artifactId = "partiql-types" name = "PartiQL Types"