11import io.gitlab.arturbosch.detekt.Detekt
2- import org.jetbrains.changelog.closure
3- import org.jetbrains.changelog.date
42import org.jetbrains.changelog.markdownToHTML
53import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
64
75fun properties (key : String ) = project.findProperty(key).toString()
86
97plugins {
10- // Java support
118 id(" java" )
12- // Kotlin support
139 id(" org.jetbrains.kotlin.jvm" ) version " 1.5.0"
14- // gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
1510 id(" org.jetbrains.intellij" ) version " 0.7.3"
16- // gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
1711 id(" org.jetbrains.changelog" ) version " 1.1.2"
18- // detekt linter - read more: https://detekt.github.io/detekt/gradle.html
1912 id(" io.gitlab.arturbosch.detekt" ) version " 1.16.0"
20- // ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
2113 id(" org.jlleitschuh.gradle.ktlint" ) version " 10.0.0"
2214}
2315
2416group = properties(" pluginGroup" )
2517version = properties(" pluginVersion" )
2618
27- // Configure project's dependencies
2819repositories {
2920 mavenCentral()
3021 jcenter()
@@ -33,33 +24,21 @@ dependencies {
3324 detektPlugins(" io.gitlab.arturbosch.detekt:detekt-formatting:1.16.0" )
3425}
3526
36- // Configure gradle-intellij-plugin plugin.
37- // Read more: https://github.com/JetBrains/gradle-intellij-plugin
3827intellij {
3928 pluginName = properties(" pluginName" )
4029 version = properties(" platformVersion" )
4130 type = properties(" platformType" )
4231 downloadSources = properties(" platformDownloadSources" ).toBoolean()
4332 updateSinceUntilBuild = true
4433
45- // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
4634 setPlugins(* properties(" platformPlugins" ).split(' ,' ).map(String ::trim).filter(String ::isNotEmpty).toTypedArray())
4735}
4836
49- // Configure gradle-changelog-plugin plugin.
50- // Read more: https://github.com/JetBrains/gradle-changelog-plugin
5137changelog {
5238 version = properties(" pluginVersion" )
53- path = " ${project.projectDir} /CHANGELOG.md"
54- header = closure { " [$version ] - ${date()} " }
55- itemPrefix = " -"
56- keepUnreleasedSection = true
57- unreleasedTerm = " [Unreleased]"
58- groups = listOf (" Added" , " Changed" , " Deprecated" , " Removed" , " Fixed" , " Security" )
39+ groups = emptyList()
5940}
6041
61- // Configure detekt plugin.
62- // Read more: https://detekt.github.io/detekt/kotlindsl.html
6342detekt {
6443 config = files(" ./detekt-config.yml" )
6544 buildUponDefaultConfig = true
@@ -72,7 +51,6 @@ detekt {
7251}
7352
7453tasks {
75- // Set the compatibility versions to 1.8
7654 withType<JavaCompile > {
7755 sourceCompatibility = " 1.8"
7856 targetCompatibility = " 1.8"
@@ -91,36 +69,27 @@ tasks {
9169 untilBuild(properties(" pluginUntilBuild" ))
9270
9371 pluginDescription(
94- closure {
95- File (" ./README.md" ).readText().lines().run {
96- val start = " <!-- Plugin description -->"
97- val end = " <!-- Plugin description end -->"
98-
99- if (! containsAll(listOf (start, end))) {
100- throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
101- }
102- subList(indexOf(start) + 1 , indexOf(end))
103- }.joinToString(" \n " ).run { markdownToHTML(this ) }
104- }
72+ File (" ./README.md" ).readText().lines().run {
73+ val start = " <!-- Plugin description -->"
74+ val end = " <!-- Plugin description end -->"
75+
76+ if (! containsAll(listOf (start, end))) {
77+ throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
78+ }
79+ subList(indexOf(start) + 1 , indexOf(end))
80+ }.joinToString(" \n " ).run { markdownToHTML(this ) }
10581 )
10682
107- changeNotes(
108- closure {
109- changelog.getUnreleased().toHTML()
110- }
111- )
83+ changeNotes(changelog.getUnreleased().toHTML())
11284 }
11385
11486 runPluginVerifier {
115- ideVersions(properties(" pluginVerifierIdeVersions" ))
87+ ideVersions(properties(" pluginVerifierIdeVersions" ).split( ' , ' ).map( String ::trim).filter( String ::isNotEmpty) )
11688 }
11789
11890 publishPlugin {
11991 dependsOn(" patchChangelog" )
12092 token(System .getenv(" PUBLISH_TOKEN" ))
121- // pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
122- // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
123- // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
12493 channels(properties(" pluginVersion" ).split(' -' ).getOrElse(1 ) { " default" }.split(' .' ).first())
12594 }
12695}
0 commit comments