diff --git a/build.gradle.kts b/build.gradle.kts index 3025733a..ae988eef 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,9 +3,6 @@ import org.jetbrains.changelog.markdownToHTML import org.jetbrains.intellij.platform.gradle.Constants.Constraints import org.jetbrains.intellij.platform.gradle.TestFrameworkType -fun properties(key: String) = providers.gradleProperty(key) -fun environment(key: String) = providers.environmentVariable(key) - plugins { id("java") // Java support alias(libs.plugins.kotlin) // Kotlin support @@ -15,8 +12,8 @@ plugins { alias(libs.plugins.kover) // Gradle Kover Plugin } -group = properties("pluginGroup").get() -version = properties("pluginVersion").get() +group = providers.gradleProperty("pluginGroup").get() +version = providers.gradleProperty("pluginVersion").get() // Set the JVM language level used to build the project. 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 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. - 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. - plugins(properties("platformPlugins").map { it.split(',') }) + plugins(providers.gradleProperty("platformPlugins").map { it.split(',') }) instrumentationTools() 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 intellijPlatform { pluginConfiguration { - version = properties("pluginVersion") + version = providers.gradleProperty("pluginVersion") // Extract the section from README.md and provide for the plugin's manifest 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 // Get the latest available change notes from the changelog file - changeNotes = properties("pluginVersion").map { pluginVersion -> + changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion -> with(changelog) { renderItem( (getOrNull(pluginVersion) ?: getUnreleased()) @@ -86,23 +83,23 @@ intellijPlatform { } ideaVersion { - sinceBuild = properties("pluginSinceBuild") - untilBuild = properties("pluginUntilBuild") + sinceBuild = providers.gradleProperty("pluginSinceBuild") + untilBuild = providers.gradleProperty("pluginUntilBuild") } } signing { - certificateChain = environment("CERTIFICATE_CHAIN") - privateKey = environment("PRIVATE_KEY") - password = environment("PRIVATE_KEY_PASSWORD") + certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN") + privateKey = providers.environmentVariable("PRIVATE_KEY") + password = providers.environmentVariable("PRIVATE_KEY_PASSWORD") } 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 // 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 - channels = properties("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) } + channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) } } verifyPlugin { @@ -115,7 +112,7 @@ intellijPlatform { // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin changelog { groups.empty() - repositoryUrl = properties("pluginRepositoryUrl") + repositoryUrl = providers.gradleProperty("pluginRepositoryUrl") } // Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration @@ -131,7 +128,7 @@ kover { tasks { wrapper { - gradleVersion = properties("gradleVersion").get() + gradleVersion = providers.gradleProperty("gradleVersion").get() } publishPlugin {