From 91a47b3ad2fa34081f7f84ae2a633bce9de6fd09 Mon Sep 17 00:00:00 2001 From: Guillermo Mazzola Date: Thu, 19 Dec 2024 16:54:51 +0100 Subject: [PATCH] Removed embedded dependencies --- gradle/libs.versions.toml | 1 + .../kotlin/embedded-dependencies.gradle.kts | 33 ------------------- plugins/kotlin-compiler/build.gradle.kts | 9 +++-- plugins/kotlin-core/build.gradle.kts | 5 ++- plugins/matcher/build.gradle.kts | 1 - 5 files changed, 10 insertions(+), 39 deletions(-) delete mode 100644 plugins/buildSrc/src/main/kotlin/embedded-dependencies.gradle.kts diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 390db82..693c224 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -18,6 +18,7 @@ android-application = { id = "com.android.application", version.ref = "android" android-library = { id = "com.android.library", version.ref = "android" } buildConfig = { id = "com.github.gmazzo.buildconfig", version = "5.5.1" } importClasses = { id = "io.github.gmazzo.importclasses", version = "1.0.2" } +embeddedDependencies = { id = "io.github.gmazzo.dependencies.embedded", version = "1.0.2" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } diff --git a/plugins/buildSrc/src/main/kotlin/embedded-dependencies.gradle.kts b/plugins/buildSrc/src/main/kotlin/embedded-dependencies.gradle.kts deleted file mode 100644 index 94ab23a..0000000 --- a/plugins/buildSrc/src/main/kotlin/embedded-dependencies.gradle.kts +++ /dev/null @@ -1,33 +0,0 @@ -import org.gradle.kotlin.dsl.support.serviceOf - -plugins { - java -} - -val embedded by configurations.creating - -configurations.compileOnly { extendsFrom(embedded) } -configurations.testRuntimeOnly { extendsFrom(embedded) } - -tasks.jar { - val archiveOperations: ArchiveOperations = gradle.serviceOf() - - from(Callable { - embedded.map { dependency -> - when (dependency.extension.lowercase()) { - "jar" -> archiveOperations.zipTree(dependency).matching { - exclude( - "META-INF/MANIFEST.MF", - "META-INF/*.SF", - "META-INF/*.DSA", - "META-INF/*.RSA", - "META-INF/versions/" - ) - } - - else -> dependency - } - } - }) - duplicatesStrategy = DuplicatesStrategy.WARN -} diff --git a/plugins/kotlin-compiler/build.gradle.kts b/plugins/kotlin-compiler/build.gradle.kts index 1019797..e05b284 100644 --- a/plugins/kotlin-compiler/build.gradle.kts +++ b/plugins/kotlin-compiler/build.gradle.kts @@ -1,8 +1,8 @@ plugins { alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.embeddedDependencies) `compiler-arguments` `jvm-convention-module` - `embedded-dependencies` } description = "CodeOwners Kotlin Compiler Plugin" @@ -16,5 +16,10 @@ buildConfig { dependencies { compileOnly(libs.kotlin.plugin.compiler.api) - embedded(projects.matcher) + // TODO for some strange reason, KMP sets `isTransitive = false` on the `kotlinCompilerPluginClasspathIosArm64Main` configuration + // which causes any dependency to be ignored, so we have bundle them all here + // https://scans.gradle.com/s/hdmdwh42uxmpy/dependencies?focusedDependency=WzUsNTYsNTA3LFs1LDU2LFs1MDddXV0&focusedDependencyView=dependencies_or_failure&toggled=W1s1XSxbNSwzN10sWzUsMzcsWzU1MV1dLFs1LDM3LFs1NTEsNTUyXV0sWzUsNTZdXQ + embedded(projects.matcher) { + exclude(group = "org.jetbrains.kotlin") + } } diff --git a/plugins/kotlin-core/build.gradle.kts b/plugins/kotlin-core/build.gradle.kts index babae36..4c4295e 100644 --- a/plugins/kotlin-core/build.gradle.kts +++ b/plugins/kotlin-core/build.gradle.kts @@ -1,5 +1,3 @@ -import org.gradle.configurationcache.extensions.capitalized - plugins { alias(libs.plugins.kotlin.multiplatform) `jvm-convention-module` @@ -23,7 +21,8 @@ dependencies { } publishing.publications.withType().configureEach pub@{ - val javadocTask = tasks.register("javadoc${this@pub.name.capitalized()}") { + + val javadocTask = tasks.register("javadoc${this@pub.name.replaceFirstChar { it.uppercase() }}") { archiveBaseName = "${project.name}-${this@pub.name}" archiveClassifier = "javadoc" from(tasks.dokkaHtml) diff --git a/plugins/matcher/build.gradle.kts b/plugins/matcher/build.gradle.kts index 0151b87..c201c1a 100644 --- a/plugins/matcher/build.gradle.kts +++ b/plugins/matcher/build.gradle.kts @@ -2,7 +2,6 @@ plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.importClasses) `jvm-convention-module` - `embedded-dependencies` } description = "CodeOwners Matcher Library"