[Build] Add workaround to make local publishing serializable

Also signing plugin now being applied only when signing is required.
#KT-44611 In Progress
This commit is contained in:
Alexander Likhachev
2021-04-13 17:33:56 +03:00
parent 4e6c483ccc
commit 03f9d78eb3
4 changed files with 109 additions and 17 deletions
@@ -1,5 +1,5 @@
apply plugin: 'kotlin'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'jps-compatible'
repositories {
@@ -38,4 +38,28 @@ 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")
}
}
}
tasks.register("install") {
dependsOn(tasks.named("publishToMavenLocal"))
}
// workaround for Gradle configuration cache
// TODO: remove it when https://github.com/gradle/gradle/pull/16945 merged into used in build Gradle version
tasks.withType(PublishToMavenLocal) {
def originalTask = it
def serializablePublishTask =
tasks.register(originalTask.name + "Serializable", PublishToMavenLocalSerializable) {
publication = originalTask.publication
}
originalTask.onlyIf { false }
originalTask.dependsOn(serializablePublishTask)
}