mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2024-10-27 20:44:05 +00:00
Drop properties(key)
and environment(key)
helpers and use providers directly
This commit is contained in:
parent
8c3191eec0
commit
d320c4195c
@ -3,9 +3,6 @@ import org.jetbrains.changelog.markdownToHTML
|
|||||||
import org.jetbrains.intellij.platform.gradle.Constants.Constraints
|
import org.jetbrains.intellij.platform.gradle.Constants.Constraints
|
||||||
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
|
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
|
||||||
|
|
||||||
fun properties(key: String) = providers.gradleProperty(key)
|
|
||||||
fun environment(key: String) = providers.environmentVariable(key)
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("java") // Java support
|
id("java") // Java support
|
||||||
alias(libs.plugins.kotlin) // Kotlin support
|
alias(libs.plugins.kotlin) // Kotlin support
|
||||||
@ -15,8 +12,8 @@ plugins {
|
|||||||
alias(libs.plugins.kover) // Gradle Kover Plugin
|
alias(libs.plugins.kover) // Gradle Kover Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
group = properties("pluginGroup").get()
|
group = providers.gradleProperty("pluginGroup").get()
|
||||||
version = properties("pluginVersion").get()
|
version = providers.gradleProperty("pluginVersion").get()
|
||||||
|
|
||||||
// Set the JVM language level used to build the project.
|
// Set the JVM language level used to build the project.
|
||||||
kotlin {
|
kotlin {
|
||||||
@ -39,13 +36,13 @@ dependencies {
|
|||||||
|
|
||||||
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
|
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
|
||||||
intellijPlatform {
|
intellijPlatform {
|
||||||
create(properties("platformType"), properties("platformVersion"))
|
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
|
||||||
|
|
||||||
// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
|
// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
|
||||||
bundledPlugins(properties("platformBundledPlugins").map { it.split(',') })
|
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
|
||||||
|
|
||||||
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
|
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
|
||||||
plugins(properties("platformPlugins").map { it.split(',') })
|
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
|
||||||
|
|
||||||
instrumentationTools()
|
instrumentationTools()
|
||||||
pluginVerifier()
|
pluginVerifier()
|
||||||
@ -57,7 +54,7 @@ dependencies {
|
|||||||
// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
|
// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
|
||||||
intellijPlatform {
|
intellijPlatform {
|
||||||
pluginConfiguration {
|
pluginConfiguration {
|
||||||
version = properties("pluginVersion")
|
version = providers.gradleProperty("pluginVersion")
|
||||||
|
|
||||||
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
|
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
|
||||||
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
|
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
|
||||||
@ -74,7 +71,7 @@ intellijPlatform {
|
|||||||
|
|
||||||
val changelog = project.changelog // local variable for configuration cache compatibility
|
val changelog = project.changelog // local variable for configuration cache compatibility
|
||||||
// Get the latest available change notes from the changelog file
|
// Get the latest available change notes from the changelog file
|
||||||
changeNotes = properties("pluginVersion").map { pluginVersion ->
|
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
|
||||||
with(changelog) {
|
with(changelog) {
|
||||||
renderItem(
|
renderItem(
|
||||||
(getOrNull(pluginVersion) ?: getUnreleased())
|
(getOrNull(pluginVersion) ?: getUnreleased())
|
||||||
@ -86,23 +83,23 @@ intellijPlatform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ideaVersion {
|
ideaVersion {
|
||||||
sinceBuild = properties("pluginSinceBuild")
|
sinceBuild = providers.gradleProperty("pluginSinceBuild")
|
||||||
untilBuild = properties("pluginUntilBuild")
|
untilBuild = providers.gradleProperty("pluginUntilBuild")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signing {
|
signing {
|
||||||
certificateChain = environment("CERTIFICATE_CHAIN")
|
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
|
||||||
privateKey = environment("PRIVATE_KEY")
|
privateKey = providers.environmentVariable("PRIVATE_KEY")
|
||||||
password = environment("PRIVATE_KEY_PASSWORD")
|
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
token = environment("PUBLISH_TOKEN")
|
token = providers.environmentVariable("PUBLISH_TOKEN")
|
||||||
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
|
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
|
||||||
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
|
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
|
||||||
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
|
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
|
||||||
channels = properties("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
|
channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyPlugin {
|
verifyPlugin {
|
||||||
@ -115,7 +112,7 @@ intellijPlatform {
|
|||||||
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
|
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
|
||||||
changelog {
|
changelog {
|
||||||
groups.empty()
|
groups.empty()
|
||||||
repositoryUrl = properties("pluginRepositoryUrl")
|
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
|
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
|
||||||
@ -131,7 +128,7 @@ kover {
|
|||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
wrapper {
|
wrapper {
|
||||||
gradleVersion = properties("gradleVersion").get()
|
gradleVersion = providers.gradleProperty("gradleVersion").get()
|
||||||
}
|
}
|
||||||
|
|
||||||
publishPlugin {
|
publishPlugin {
|
||||||
|
Loading…
Reference in New Issue
Block a user