Revert "[Build] Fix configuration cache issues with install task"
This reverts commit 078849d1
This commit is contained in:
@@ -16,6 +16,7 @@ import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
|
|||||||
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
|
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
|
||||||
import org.gradle.api.tasks.TaskProvider
|
import org.gradle.api.tasks.TaskProvider
|
||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.*
|
||||||
|
import org.gradle.plugins.signing.Sign
|
||||||
import org.gradle.plugins.signing.SigningExtension
|
import org.gradle.plugins.signing.SigningExtension
|
||||||
import org.gradle.plugins.signing.SigningPlugin
|
import org.gradle.plugins.signing.SigningPlugin
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -26,6 +27,7 @@ class KotlinBuildPublishingPlugin @Inject constructor(
|
|||||||
) : Plugin<Project> {
|
) : Plugin<Project> {
|
||||||
override fun apply(target: Project): Unit = with(target) {
|
override fun apply(target: Project): Unit = with(target) {
|
||||||
apply<MavenPublishPlugin>()
|
apply<MavenPublishPlugin>()
|
||||||
|
apply<SigningPlugin>()
|
||||||
|
|
||||||
val publishedRuntime = configurations.maybeCreate(RUNTIME_CONFIGURATION).apply {
|
val publishedRuntime = configurations.maybeCreate(RUNTIME_CONFIGURATION).apply {
|
||||||
isCanBeConsumed = false
|
isCanBeConsumed = false
|
||||||
@@ -127,20 +129,13 @@ fun Project.configureDefaultPublishing() {
|
|||||||
name = KotlinBuildPublishingPlugin.REPOSITORY_NAME
|
name = KotlinBuildPublishingPlugin.REPOSITORY_NAME
|
||||||
url = file("${project.rootDir}/build/repo").toURI()
|
url = file("${project.rootDir}/build/repo").toURI()
|
||||||
}
|
}
|
||||||
mavenLocal() // to workaround configuration cache issues with 'publishToMavenLocal' task
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val signingRequired = project.providers.gradleProperty("signingRequired").forUseAtConfigurationTime().orNull?.toBoolean()
|
configureSigning()
|
||||||
?: project.providers.gradleProperty("isSonatypeRelease").forUseAtConfigurationTime().orNull?.toBoolean() ?: false
|
|
||||||
|
|
||||||
if (signingRequired) {
|
|
||||||
apply<SigningPlugin>()
|
|
||||||
configureSigning()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register("install") {
|
tasks.register("install") {
|
||||||
dependsOn(tasks.named("publishAllPublicationsToMavenLocalRepository"))
|
dependsOn(tasks.named("publishToMavenLocal"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<PublishToMavenRepository>()
|
tasks.withType<PublishToMavenRepository>()
|
||||||
@@ -149,10 +144,20 @@ fun Project.configureDefaultPublishing() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun Project.configureSigning() {
|
private fun Project.configureSigning() {
|
||||||
|
val signingRequired = provider {
|
||||||
|
project.findProperty("signingRequired")?.toString()?.toBoolean()
|
||||||
|
?: project.property("isSonatypeRelease") as Boolean
|
||||||
|
}
|
||||||
|
|
||||||
configure<SigningExtension> {
|
configure<SigningExtension> {
|
||||||
|
setRequired(signingRequired)
|
||||||
sign(extensions.getByType<PublishingExtension>().publications) // all publications
|
sign(extensions.getByType<PublishingExtension>().publications) // all publications
|
||||||
useGpgCmd()
|
useGpgCmd()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType<Sign>().configureEach {
|
||||||
|
setOnlyIf { signingRequired.get() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun TaskProvider<PublishToMavenRepository>.configureRepository() =
|
fun TaskProvider<PublishToMavenRepository>.configureRepository() =
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import org.jetbrains.kotlin.pill.PillExtension
|
import org.jetbrains.kotlin.pill.PillExtension
|
||||||
import plugins.configureKotlinPomAttributes
|
|
||||||
|
|
||||||
description = "Simple Annotation Processor for testing kapt"
|
description = "Simple Annotation Processor for testing kapt"
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
`maven-publish` // only used for installing to mavenLocal()
|
maven // only used for installing to mavenLocal()
|
||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,24 +13,9 @@ pill {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlinStdlib())
|
compile(kotlinStdlib())
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
"test" {}
|
"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: 'kotlin'
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven'
|
||||||
apply plugin: 'jps-compatible'
|
apply plugin: 'jps-compatible'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -38,19 +38,4 @@ dependencies {
|
|||||||
// Relocate `com.intellij.*` and some other classes to match those in the `kotlin-compiler-embeddable`
|
// 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.*`):
|
// (for example, the actual package at runtime is `org.jetbrains.kotlin.com.intellij.*`):
|
||||||
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
|
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"))
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user