mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2024-10-27 20:44:05 +00:00
properties
shorthand function for accessing gradle.properties
in a cleaner way (#92)
This commit is contained in:
parent
b812e459d4
commit
507b055937
2
.github/template-cleanup/gradle.properties
vendored
2
.github/template-cleanup/gradle.properties
vendored
@ -2,7 +2,7 @@
|
|||||||
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
|
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
|
||||||
|
|
||||||
pluginGroup = %GROUP%
|
pluginGroup = %GROUP%
|
||||||
pluginName_ = %NAME%
|
pluginName = %NAME%
|
||||||
pluginVersion = 0.0.1
|
pluginVersion = 0.0.1
|
||||||
pluginSinceBuild = 202
|
pluginSinceBuild = 202
|
||||||
pluginUntilBuild = 203.*
|
pluginUntilBuild = 203.*
|
||||||
|
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -114,7 +114,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
PROPERTIES="$(./gradlew properties --console=plain -q)"
|
PROPERTIES="$(./gradlew properties --console=plain -q)"
|
||||||
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
|
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
|
||||||
NAME="$(echo "$PROPERTIES" | grep "^pluginName_:" | cut -f2- -d ' ')"
|
NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
|
||||||
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
|
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
|
||||||
CHANGELOG="${CHANGELOG//'%'/'%25'}"
|
CHANGELOG="${CHANGELOG//'%'/'%25'}"
|
||||||
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
|
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
# IntelliJ Platform Plugin Template Changelog
|
# IntelliJ Platform Plugin Template Changelog
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- `properties` shorthand function for accessing `gradle.properties` in a cleaner way
|
||||||
|
|
||||||
## [0.8.3]
|
## [0.8.3]
|
||||||
### Changed
|
### Changed
|
||||||
- Dependencies - upgrade `org.jetbrains.intellij` to `0.7.2`
|
- Dependencies - upgrade `org.jetbrains.intellij` to `0.7.2`
|
||||||
|
@ -3,6 +3,8 @@ import org.jetbrains.changelog.closure
|
|||||||
import org.jetbrains.changelog.markdownToHTML
|
import org.jetbrains.changelog.markdownToHTML
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
|
fun properties(key: String) = project.findProperty(key).toString()
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
// Java support
|
// Java support
|
||||||
id("java")
|
id("java")
|
||||||
@ -18,23 +20,8 @@ plugins {
|
|||||||
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
|
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import variables from gradle.properties file
|
group = properties("pluginGroup")
|
||||||
val pluginGroup: String by project
|
version = properties("projectVersion")
|
||||||
// `pluginName_` variable ends with `_` because of the collision with Kotlin magic getter in the `intellij` closure.
|
|
||||||
// Read more about the issue: https://github.com/JetBrains/intellij-platform-plugin-template/issues/29
|
|
||||||
val pluginName_: String by project
|
|
||||||
val pluginVersion: String by project
|
|
||||||
val pluginSinceBuild: String by project
|
|
||||||
val pluginUntilBuild: String by project
|
|
||||||
val pluginVerifierIdeVersions: String by project
|
|
||||||
|
|
||||||
val platformType: String by project
|
|
||||||
val platformVersion: String by project
|
|
||||||
val platformPlugins: String by project
|
|
||||||
val platformDownloadSources: String by project
|
|
||||||
|
|
||||||
group = pluginGroup
|
|
||||||
version = pluginVersion
|
|
||||||
|
|
||||||
// Configure project's dependencies
|
// Configure project's dependencies
|
||||||
repositories {
|
repositories {
|
||||||
@ -48,20 +35,20 @@ dependencies {
|
|||||||
// Configure gradle-intellij-plugin plugin.
|
// Configure gradle-intellij-plugin plugin.
|
||||||
// Read more: https://github.com/JetBrains/gradle-intellij-plugin
|
// Read more: https://github.com/JetBrains/gradle-intellij-plugin
|
||||||
intellij {
|
intellij {
|
||||||
pluginName = pluginName_
|
pluginName = properties("pluginName")
|
||||||
version = platformVersion
|
version = properties("platformVersion")
|
||||||
type = platformType
|
type = properties("platformType")
|
||||||
downloadSources = platformDownloadSources.toBoolean()
|
downloadSources = properties("platformDownloadSources").toBoolean()
|
||||||
updateSinceUntilBuild = true
|
updateSinceUntilBuild = true
|
||||||
|
|
||||||
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
|
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
|
||||||
setPlugins(*platformPlugins.split(',').map(String::trim).filter(String::isNotEmpty).toTypedArray())
|
setPlugins(*properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty).toTypedArray())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure gradle-changelog-plugin plugin.
|
// Configure gradle-changelog-plugin plugin.
|
||||||
// Read more: https://github.com/JetBrains/gradle-changelog-plugin
|
// Read more: https://github.com/JetBrains/gradle-changelog-plugin
|
||||||
changelog {
|
changelog {
|
||||||
version = pluginVersion
|
version = properties("pluginVersion")
|
||||||
groups = emptyList()
|
groups = emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,9 +80,9 @@ tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version(pluginVersion)
|
version(properties("pluginVersion"))
|
||||||
sinceBuild(pluginSinceBuild)
|
sinceBuild(properties("pluginSinceBuild"))
|
||||||
untilBuild(pluginUntilBuild)
|
untilBuild(properties("pluginUntilBuild"))
|
||||||
|
|
||||||
// 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
|
||||||
pluginDescription(
|
pluginDescription(
|
||||||
@ -121,7 +108,7 @@ tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
runPluginVerifier {
|
runPluginVerifier {
|
||||||
ideVersions(pluginVerifierIdeVersions)
|
ideVersions(properties("pluginVerifierIdeVersions"))
|
||||||
}
|
}
|
||||||
|
|
||||||
publishPlugin {
|
publishPlugin {
|
||||||
@ -130,6 +117,6 @@ tasks {
|
|||||||
// pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
|
// 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(pluginVersion.split('-').getOrElse(1) { "default" }.split('.').first())
|
channels(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
|
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
|
||||||
|
|
||||||
pluginGroup = org.jetbrains.plugins.template
|
pluginGroup = org.jetbrains.plugins.template
|
||||||
pluginName_ = IntelliJ Platform Plugin Template
|
pluginName = IntelliJ Platform Plugin Template
|
||||||
pluginVersion = 0.8.3
|
pluginVersion = 0.8.3
|
||||||
pluginSinceBuild = 202
|
pluginSinceBuild = 202
|
||||||
pluginUntilBuild = 203.*
|
pluginUntilBuild = 203.*
|
||||||
|
Loading…
Reference in New Issue
Block a user