1+ import org.jetbrains.changelog.Changelog
12import org.jetbrains.changelog.markdownToHTML
2- import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
33
4- fun properties (key : String ) = project.findProperty(key).toString()
4+ fun properties (key : String ) = providers.gradleProperty(key)
5+ fun environment (key : String ) = providers.environmentVariable(key)
56
67plugins {
7- // Java support
8- id(" java" )
9- // Kotlin support
10- id(" org.jetbrains.kotlin.jvm" ) version " 1.6.0"
11- // Gradle IntelliJ Plugin
12- id(" org.jetbrains.intellij" ) version " 1.11.0"
13- // Gradle Changelog Plugin
14- id(" org.jetbrains.changelog" ) version " 1.3.1"
15- // Gradle Qodana Plugin
16- id(" org.jetbrains.qodana" ) version " 0.1.13"
8+ id(" java" ) // Java support
9+ alias(libs.plugins.kotlin) // Kotlin support
10+ alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
11+ alias(libs.plugins.changelog) // Gradle Changelog Plugin
12+ alias(libs.plugins.qodana) // Gradle Qodana Plugin
13+ alias(libs.plugins.kover) // Gradle Kover Plugin
1714}
1815
19- group = properties(" pluginGroup" )
20- version = properties(" pluginVersion" )
16+ group = properties(" pluginGroup" ).get()
17+ version = properties(" pluginVersion" ).get()
2118
2219// Configure project's dependencies
2320repositories {
2421 mavenCentral()
2522}
2623
27- // Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
24+
25+ // Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
26+ dependencies {
27+ // implementation(libs.annotations)
28+ }
29+
30+ // Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
31+ kotlin {
32+ jvmToolchain(17 )
33+ }
34+
35+ // Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
2836intellij {
29- pluginName.set( properties(" pluginName" ) )
30- version.set( properties(" platformVersion" ) )
31- type.set( properties(" platformType" ) )
37+ pluginName = properties(" pluginName" )
38+ version = properties(" platformVersion" )
39+ type = properties(" platformType" )
3240
3341 // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
34- plugins.set( properties(" platformPlugins" ).split(' ,' ).map(String ::trim).filter(String ::isNotEmpty))
42+ plugins = properties(" platformPlugins" ).map { it. split(' ,' ).map(String ::trim).filter(String ::isNotEmpty) }
3543}
3644
45+
3746// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
3847changelog {
39- version.set(properties(" pluginVersion" ))
40- groups.set(emptyList())
48+ groups.empty()
49+ repositoryUrl = properties(" pluginRepositoryUrl" )
50+ }
51+ // Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
52+ qodana {
53+ cachePath = provider { file(" .qodana" ).canonicalPath }
54+ reportPath = provider { file(" build/reports/inspections" ).canonicalPath }
55+ saveReport = true
56+ showReport = environment(" QODANA_SHOW_REPORT" ).map { it.toBoolean() }.getOrElse(false )
4157}
4258
43- tasks {
44- // Set the JVM compatibility versions
45- properties(" javaVersion" ).let {
46- withType<JavaCompile > {
47- sourceCompatibility = it
48- targetCompatibility = it
49- }
50- withType<KotlinCompile > {
51- kotlinOptions.jvmTarget = it
59+
60+ // Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
61+ koverReport {
62+ defaults {
63+ xml {
64+ onCheck = true
5265 }
5366 }
67+ }
5468
69+ tasks {
5570 wrapper {
56- gradleVersion = properties(" gradleVersion" )
71+ gradleVersion = properties(" gradleVersion" ).get()
5772 }
5873
5974 patchPluginXml {
60- version.set( properties(" pluginVersion" ) )
61- sinceBuild.set( properties(" pluginSinceBuild" ) )
62- untilBuild.set( properties(" pluginUntilBuild" ) )
75+ version = properties(" pluginVersion" )
76+ sinceBuild = properties(" pluginSinceBuild" )
77+ untilBuild = properties(" pluginUntilBuild" )
6378
6479 // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
80+ pluginDescription = providers.fileContents(layout.projectDirectory.file(" README.md" )).asText.map {
81+ with (it.lines()) {
82+ joinToString(" \n " ).let (::markdownToHTML)
83+ }
84+ }
6585
66- pluginDescription.set(
67- File (" ./DESCRIPTION.md" )
68- .readText().lines()
69- .joinToString(" \n " )
70- .run { markdownToHTML(this ) }
71- )
72-
86+ val changelog = project.changelog // local variable for configuration cache compatibility
7387 // Get the latest available change notes from the changelog file
74- changeNotes.set(provider {
75- changelog.run {
76- getOrNull(properties(" pluginVersion" )) ? : getLatest()
77- }.toHTML()
78- })
88+ changeNotes = properties(" pluginVersion" ).map { pluginVersion ->
89+ with (changelog) {
90+ renderItem(
91+ (getOrNull(pluginVersion) ? : getUnreleased())
92+ .withHeader(false )
93+ .withEmptySections(false ),
94+ Changelog .OutputType .HTML ,
95+ )
96+ }
97+ }
98+ }
99+
100+ // Configure UI tests plugin
101+ // Read more: https://github.com/JetBrains/intellij-ui-test-robot
102+ runIdeForUiTests {
103+ systemProperty(" robot-server.port" , " 8082" )
104+ systemProperty(" ide.mac.message.dialogs.as.sheets" , " false" )
105+ systemProperty(" jb.privacy.policy.text" , " <!--999.999-->" )
106+ systemProperty(" jb.consents.confirmation.enabled" , " false" )
79107 }
80108
81109 signPlugin {
82- certificateChain.set( System .getenv( " CERTIFICATE_CHAIN" ) )
83- privateKey.set( System .getenv( " PRIVATE_KEY" ) )
84- password.set( System .getenv( " PRIVATE_KEY_PASSWORD" ) )
110+ certificateChain = environment( " CERTIFICATE_CHAIN" )
111+ privateKey = environment( " PRIVATE_KEY" )
112+ password = environment( " PRIVATE_KEY_PASSWORD" )
85113 }
86114
87115 publishPlugin {
88116 dependsOn(" patchChangelog" )
89- token.set( System .getenv( " PUBLISH_TOKEN" ) )
90- // pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
117+ token = environment( " PUBLISH_TOKEN" )
118+ // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
91119 // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
92120 // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
93- channels.set( listOf ( properties(" pluginVersion" ).split(' -' ).getOrElse(1 ) { " default" }.split(' .' ).first()))
121+ channels = properties(" pluginVersion" ).map { listOf (it. split(' -' ).getOrElse(1 ) { " default" }.split(' .' ).first()) }
94122 }
95- }
123+ }
0 commit comments