[Build] Fix configuration cache issues with install task

* `install` task provided by `maven` plugin doesn't support configuration cache so replace `maven` plugin with `maven-publish` and use task that is subtype of PublishToMavenRepository. `maven-publish` partially support configuration cache, see https://github.com/gradle/gradle/issues/13468
* Apply `signing` plugin only if it really needed. The plugin doesn't support configuration cache. See https://github.com/gradle/gradle/issues/13470
Relates to #KT-44611
This commit is contained in:
Alexander Likhachev
2021-02-16 18:57:09 +03:00
parent 46b056c929
commit 078849d133
3 changed files with 44 additions and 18 deletions
@@ -1,10 +1,11 @@
import org.jetbrains.kotlin.pill.PillExtension
import plugins.configureKotlinPomAttributes
description = "Simple Annotation Processor for testing kapt"
plugins {
kotlin("jvm")
maven // only used for installing to mavenLocal()
`maven-publish` // only used for installing to mavenLocal()
id("jps-compatible")
}
@@ -13,9 +14,24 @@ pill {
}
dependencies {
compile(kotlinStdlib())
implementation(kotlinStdlib())
}
sourceSets {
"test" {}
}
publishing {
publications {
create<MavenPublication>("main") {
from(components["java"])
}
}
repositories {
mavenLocal() // to workaround configuration cache issues with 'publishToMavenLocal' task
}
}
tasks.register("install") {
dependsOn(tasks.named("publishAllPublicationsToMavenLocalRepository"))
}
@@ -1,5 +1,5 @@
apply plugin: 'kotlin'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'jps-compatible'
repositories {
@@ -38,4 +38,19 @@ dependencies {
// Relocate `com.intellij.*` and some other classes to match those in the `kotlin-compiler-embeddable`
// (for example, the actual package at runtime is `org.jetbrains.kotlin.com.intellij.*`):
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
// In a standalone build, you can setup the relocation with the Shadow plugin.
// In a standalone build, you can setup the relocation with the Shadow plugin.
publishing {
publications {
main(MavenPublication) {
artifact tasks.named("embeddable")
}
}
repositories {
mavenLocal() // to workaround configuration cache issues with 'publishToMavenLocal' task
}
}
tasks.register("install") {
dependsOn(tasks.named("publishAllPublicationsToMavenLocalRepository"))
}