From 4a5a3decb6a52cf7e12f44da79703d667ded2fce Mon Sep 17 00:00:00 2001 From: Zac Sweers Date: Sun, 12 May 2024 15:07:45 -0400 Subject: [PATCH] Omit the stdlib from the compiler plugin and gradle plugin artifacts (#218) * Omit the stdlib from the compiler plugin and gradle plugin artifacts Resolves #199 * Add stdlib deps where appropriate --- CHANGELOG.md | 5 +++++ gradle/libs.versions.toml | 1 + redacted-compiler-plugin-gradle/build.gradle.kts | 1 + redacted-compiler-plugin-gradle/gradle.properties | 3 +++ redacted-compiler-plugin/build.gradle.kts | 2 ++ redacted-compiler-plugin/gradle.properties | 3 +++ 6 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d17f503..b5bfd70b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========= +**Unreleased** +-------------- + +- Omit the stdlib from transitive dependencies on the compiler plugin and Gradle plugin artifacts. Both kotlinc and Gradle impose their own versions on the classpath. + 1.8.1 ----- diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3d61162b..3a6697b8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -41,6 +41,7 @@ kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } kotlin-gradlePlugin-api = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin-api", version.ref = "kotlin" } kotlin-aptEmbeddable = { module = "org.jetbrains.kotlin:kotlin-annotation-processing-embeddable", version.ref = "kotlin" } +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } ksp = { module = "com.google.devtools.ksp:symbol-processing", version.ref = "ksp" } ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" } diff --git a/redacted-compiler-plugin-gradle/build.gradle.kts b/redacted-compiler-plugin-gradle/build.gradle.kts index 39809e36..6618d2cc 100644 --- a/redacted-compiler-plugin-gradle/build.gradle.kts +++ b/redacted-compiler-plugin-gradle/build.gradle.kts @@ -85,6 +85,7 @@ spotless { dependencies { compileOnly(libs.kotlin.gradlePlugin) compileOnly(libs.kotlin.gradlePlugin.api) + compileOnly(libs.kotlin.stdlib) } configure { publishToMavenCentral(automaticRelease = true) } diff --git a/redacted-compiler-plugin-gradle/gradle.properties b/redacted-compiler-plugin-gradle/gradle.properties index 2c8eb132..2518f56e 100644 --- a/redacted-compiler-plugin-gradle/gradle.properties +++ b/redacted-compiler-plugin-gradle/gradle.properties @@ -2,6 +2,9 @@ POM_NAME=Redacted Compiler Plugin (Gradle) POM_ARTIFACT_ID=redacted-compiler-plugin-gradle POM_PACKAGING=jar +# Gradle imposes its own +kotlin.stdlib.default.dependency=false + GROUP=dev.zacsweers.redacted VERSION_NAME=1.9.0-SNAPSHOT POM_DESCRIPTION=A Kotlin compiler plugin that generates redacted toString() implementations. diff --git a/redacted-compiler-plugin/build.gradle.kts b/redacted-compiler-plugin/build.gradle.kts index 0084d94a..9e1f0340 100644 --- a/redacted-compiler-plugin/build.gradle.kts +++ b/redacted-compiler-plugin/build.gradle.kts @@ -11,10 +11,12 @@ tasks.withType().configureEach { dependencies { compileOnly(libs.kotlin.compilerEmbeddable) + compileOnly(libs.kotlin.stdlib) implementation(libs.autoService) ksp(libs.autoService.ksp) testImplementation(libs.kotlin.reflect) + testImplementation(libs.kotlin.stdlib) testImplementation(libs.kotlin.compilerEmbeddable) // Cover for https://github.com/tschuchortdev/kotlin-compile-testing/issues/274 testImplementation(libs.kotlin.aptEmbeddable) diff --git a/redacted-compiler-plugin/gradle.properties b/redacted-compiler-plugin/gradle.properties index d63d6fe7..8f380f2d 100644 --- a/redacted-compiler-plugin/gradle.properties +++ b/redacted-compiler-plugin/gradle.properties @@ -1,3 +1,6 @@ POM_NAME=Redacted Compiler Plugin POM_ARTIFACT_ID=redacted-compiler-plugin POM_PACKAGING=jar + +# kotlinc imposes its own +kotlin.stdlib.default.dependency=false \ No newline at end of file