Files
compose-multiplatform/idea-plugin/build.gradle.kts
Alexey Tsvetkov 588ad2c8c0 Fix build helpers publishing (#1416)
* Fix compatibility with Intellij 2021.3

Resolves #1373

* Use Java reflection

* Set Java source & target compatibility for build helpers

Otherwise, Gradle might set Gradle metadata attributes in such way,
that transitive dependencies of published modules are not resolved

* Configure shadow jar manually

Applying plugin configures additional publication,
so that both .jar and -shadow.jar are published,
and additional configurations are added to Gradle metadata.

To avoid unexpected metadata resolution results,
ShadowJar task is now configured manually

* Fix closeStagingRepo JSON request

* Update publishing build-helpers in compose
2021-11-18 13:00:54 +03:00

83 lines
2.4 KiB
Kotlin

import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "1.5.10"
id("org.jetbrains.intellij") version "1.3.0"
id("org.jetbrains.changelog") version "1.3.1"
}
val projectProperties = ProjectProperties(project)
group = "org.jetbrains.compose.desktop.ide"
version = projectProperties.deployVersion
repositories {
mavenCentral()
}
dependencies {
implementation("org.jetbrains.compose:preview-rpc")
}
intellij {
pluginName.set("Compose Multiplatform IDE Support")
type.set(projectProperties.platformType)
version.set(projectProperties.platformVersion)
downloadSources.set(projectProperties.platformDownloadSources)
plugins.set(
listOf(
"java",
"com.intellij.gradle",
"org.jetbrains.kotlin"
)
)
}
tasks.buildSearchableOptions {
// temporary workaround
enabled = false
}
tasks {
// Set the compatibility versions to 1.8
withType<JavaCompile> {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
withType<KotlinJvmCompile> {
kotlinOptions.jvmTarget = "1.8"
}
publishPlugin {
token.set(System.getenv("IDE_PLUGIN_PUBLISH_TOKEN"))
channels.set(projectProperties.pluginChannels)
}
patchPluginXml {
sinceBuild.set(projectProperties.pluginSinceBuild)
untilBuild.set(projectProperties.pluginUntilBuild)
}
runPluginVerifier {
ideVersions.set(projectProperties.pluginVerifierIdeVersions)
}
}
class ProjectProperties(private val project: Project) {
val deployVersion get() = stringProperty("deploy.version")
val platformType get() = stringProperty("platform.type")
val platformVersion get() = stringProperty("platform.version")
val platformDownloadSources get() = stringProperty("platform.download.sources").toBoolean()
val pluginChannels get() = listProperty("plugin.channels")
val pluginSinceBuild get() = stringProperty("plugin.since.build")
val pluginUntilBuild get() = stringProperty("plugin.until.build")
val pluginVerifierIdeVersions get() = listProperty("plugin.verifier.ide.versions")
private fun stringProperty(key: String): String =
project.findProperty(key)!!.toString()
private fun listProperty(key: String): List<String> =
stringProperty(key).split(",").map { it.trim() }
}