1- import io.gitlab.arturbosch.detekt.Detekt
1+ import org.jetbrains.changelog.Changelog
22import org.jetbrains.changelog.markdownToHTML
3- import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
43
54fun properties (key : String ) = project.findProperty(key).toString()
65
76plugins {
87 // Java support
98 id(" java" )
109 // Kotlin support
11- id(" org.jetbrains.kotlin.jvm" ) version " 1.6.10"
12- // gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
13- id(" org.jetbrains.intellij" ) version " 1.0"
14- // gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
15- id(" org.jetbrains.changelog" ) version " 1.1.2"
16- // detekt linter - read more: https://detekt.github.io/detekt/gradle.html
17- id(" io.gitlab.arturbosch.detekt" ) version " 1.17.1"
18- // ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
19- id(" org.jlleitschuh.gradle.ktlint" ) version " 10.0.0"
20- }
21-
22- ktlint {
23- // See https://github.com/pinterest/ktlint/issues/527
24- disabledRules.add(" import-ordering" )
10+ id(" org.jetbrains.kotlin.jvm" ) version " 1.8.0"
11+ // Gradle IntelliJ Plugin
12+ id(" org.jetbrains.intellij" ) version " 1.12.0"
13+ // Gradle Changelog Plugin
14+ id(" org.jetbrains.changelog" ) version " 2.0.0"
15+ // Gradle Qodana Plugin
16+ id(" org.jetbrains.qodana" ) version " 0.1.13"
17+ // Gradle Kover Plugin
18+ id(" org.jetbrains.kotlinx.kover" ) version " 0.6.1"
2519}
2620
2721group = properties(" pluginGroup" )
@@ -31,55 +25,44 @@ version = properties("pluginVersion")
3125repositories {
3226 mavenCentral()
3327}
34- dependencies {
35- detektPlugins(" io.gitlab.arturbosch.detekt:detekt-formatting:1.19.0" )
28+
29+ // Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
30+ kotlin {
31+ jvmToolchain(11 )
3632}
3733
38- // Configure gradle-intellij-plugin plugin.
39- // Read more: https://github.com/JetBrains/gradle-intellij-plugin
34+ // Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
4035intellij {
4136 pluginName.set(properties(" pluginName" ))
4237 version.set(properties(" platformVersion" ))
4338 type.set(properties(" platformType" ))
44- downloadSources.set(properties(" platformDownloadSources" ).toBoolean())
45- updateSinceUntilBuild.set(true )
4639
4740 // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
4841 plugins.set(properties(" platformPlugins" ).split(' ,' ).map(String ::trim).filter(String ::isNotEmpty))
4942}
5043
51- // Configure gradle-changelog-plugin plugin.
52- // Read more: https://github.com/JetBrains/gradle-changelog-plugin
44+ // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
5345changelog {
54- version = properties( " pluginVersion " )
55- groups = emptyList( )
46+ groups.set(emptyList() )
47+ repositoryUrl.set(properties( " pluginRepositoryUrl " ) )
5648}
5749
58- // Configure detekt plugin.
59- // Read more: https://detekt.github.io/detekt/kotlindsl.html
60- detekt {
61- config = files(" ./detekt-config.yml" )
62- buildUponDefaultConfig = true
50+ // Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
51+ qodana {
52+ cachePath.set(file(" .qodana" ).canonicalPath)
53+ reportPath.set(file(" build/reports/inspections" ).canonicalPath)
54+ saveReport.set(true )
55+ showReport.set(System .getenv(" QODANA_SHOW_REPORT" )?.toBoolean() ? : false )
56+ }
6357
64- reports {
65- html.enabled = false
66- xml.enabled = false
67- txt.enabled = false
68- }
58+ // Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
59+ kover.xmlReport {
60+ onCheck.set(true )
6961}
7062
7163tasks {
72- // Set the compatibility versions to 1.8
73- withType<JavaCompile > {
74- sourceCompatibility = " 1.8"
75- targetCompatibility = " 1.8"
76- }
77- withType<KotlinCompile > {
78- kotlinOptions.jvmTarget = " 1.8"
79- }
80-
81- withType<Detekt > {
82- jvmTarget = " 1.8"
64+ wrapper {
65+ gradleVersion = properties(" gradleVersion" )
8366 }
8467
8568 patchPluginXml {
@@ -89,41 +72,50 @@ tasks {
8972
9073 // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
9174 pluginDescription.set(
92- File (projectDir, " README.md" ).readText().lines().run {
75+ file( " README.md" ).readText().lines().run {
9376 val start = " <!-- Plugin description -->"
9477 val end = " <!-- Plugin description end -->"
9578
9679 if (! containsAll(listOf (start, end))) {
9780 throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
9881 }
9982 subList(indexOf(start) + 1 , indexOf(end))
100- }.joinToString(" \n " ).run { markdownToHTML(this ) }
83+ }.joinToString(" \n " ).let { markdownToHTML(it ) }
10184 )
10285
10386 // Get the latest available change notes from the changelog file
104- changeNotes.set(provider { changelog.getLatest().toHTML() })
87+ changeNotes.set(provider {
88+ with (changelog) {
89+ renderItem(
90+ getOrNull(properties(" pluginVersion" ))
91+ ? : runCatching { getLatest() }.getOrElse { getUnreleased() },
92+ Changelog .OutputType .HTML ,
93+ )
94+ }
95+ })
96+ }
97+
98+ // Configure UI tests plugin
99+ // Read more: https://github.com/JetBrains/intellij-ui-test-robot
100+ runIdeForUiTests {
101+ systemProperty(" robot-server.port" , " 8082" )
102+ systemProperty(" ide.mac.message.dialogs.as.sheets" , " false" )
103+ systemProperty(" jb.privacy.policy.text" , " <!--999.999-->" )
104+ systemProperty(" jb.consents.confirmation.enabled" , " false" )
105105 }
106106
107- runPluginVerifier {
108- ideVersions.set(properties(" pluginVerifierIdeVersions" ).split(' ,' ).map(String ::trim).filter(String ::isNotEmpty))
107+ signPlugin {
108+ certificateChain.set(System .getenv(" CERTIFICATE_CHAIN" ))
109+ privateKey.set(System .getenv(" PRIVATE_KEY" ))
110+ password.set(System .getenv(" PRIVATE_KEY_PASSWORD" ))
109111 }
110112
111113 publishPlugin {
112114 dependsOn(" patchChangelog" )
113115 token.set(System .getenv(" PUBLISH_TOKEN" ))
114- // pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
116+ // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
115117 // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
116118 // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
117119 channels.set(listOf (properties(" pluginVersion" ).split(' -' ).getOrElse(1 ) { " default" }.split(' .' ).first()))
118120 }
119-
120- runIde {
121- autoReloadPlugins.set(true )
122- }
123-
124- buildSearchableOptions {
125- // disable when is local development
126- // see: https://plugins.jetbrains.com/docs/intellij/ide-development-instance.html#enabling-auto-reload
127- enabled = System .getenv(" CI" ) != null
128- }
129121}
0 commit comments