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
This commit is contained in:
Ilya Chernikov
2018-02-19 17:40:06 +01:00
parent d0ed0c4049
commit 07b82ff1cc
+6 -1
View File
@@ -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<T> Project.runtimeJarArtifactBy(task: Task, artifactRef: T, body: ConfigurablePublishArtifact.() -> Unit = {}) {