From 07b82ff1ccfbb2522ac4c84489eae1b849cb046a Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Mon, 19 Feb 2018 17:40:06 +0100 Subject: [PATCH] Fix noDefaultJar helper - remove the disabled jar from archives before this fix switching to the gradle 4.6-rc1 caused the problem on local publish task - kotlin-compiler.jar not found --- buildSrc/src/main/kotlin/artifacts.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/artifacts.kt b/buildSrc/src/main/kotlin/artifacts.kt index e4857d13ffb..973ab977a18 100644 --- a/buildSrc/src/main/kotlin/artifacts.kt +++ b/buildSrc/src/main/kotlin/artifacts.kt @@ -53,7 +53,12 @@ fun Project.testsJar(body: Jar.() -> Unit = {}): Jar { } fun Project.noDefaultJar() { - tasks.findByName("jar")?.enabled = false + tasks.findByName("jar")?.let { defaultJarTask -> + defaultJarTask.enabled = false + configurations.findByName("archives")?.artifacts?.removeAll { + (it as? ArchivePublishArtifact)?.archiveTask?.let { it == defaultJarTask } ?: false + } + } } fun Project.runtimeJarArtifactBy(task: Task, artifactRef: T, body: ConfigurablePublishArtifact.() -> Unit = {}) {