Update Gradle plugins publishing setup

Simplifies and make it aligned with official documentation, which
removes some old workarounds. Additionally, it enables publication of
Gradle metadata file, which is required for plugin variants feature
support.

Instead of using 'gradleApi()' as Gradle API dependency, which provides
build current Gradle version api, now setup is using
"dev.gradleplugins:gradle-api" artifacts with specific Gradle version.
This allows to have more fine-grained Gradle support for removed apis.

^KT-49227 In Progress
This commit is contained in:
Yahor Berdnikau
2021-11-09 17:01:09 +01:00
committed by Space
parent e4610d9df6
commit 1d2796d491
19 changed files with 346 additions and 180 deletions
@@ -34,36 +34,16 @@ dependencies {
compileOnly project(':dependencies:intellij-core')
}
// 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.
// You should configure your own Gradle plugin publication!
extensions.configure(GradlePluginDevelopmentExtension) {
it.setAutomatedPublishing(false)
}
gradlePlugin {
plugins {
create("gradle-subplugin-example") {
id = "org.jetbrains.kotlin.gradle-subplugin-example"
implementationClass = "example.ExampleSubplugin"
}
}
}
pluginBundle {
plugins {
named("gradle-subplugin-example") {
id = "org.jetbrains.kotlin.gradle-subplugin-example"
displayName = "Kotlin Gradle subplugin example"
}
}
}
PluginMarkersKt.publishPluginMarkers(project, true)
// Disable releasing for this plugin
// It is not intended to be released publicly
tasks.withType(PublishToMavenRepository)