1- import org.jetbrains.changelog.markdownToHTML
1+ import org.jetbrains.intellij.platform.gradle.TestFrameworkType
22
3- fun properties ( key : String ) = project.findProperty(key).toString( )
3+ System .setProperty( " HACK " , " false " )
44
55plugins {
66 // Custom plugin for building all the themes
77 id(" doki-theme-plugin" )
8- // Java support
9- id(" java" )
10- // Kotlin support
11- kotlin(" jvm" ) version " 2.0.0"
12- // Gradle IntelliJ Plugin
13- id(" org.jetbrains.intellij" ) version " 1.16.1"
14- // Gradle Changelog Plugin
15- id(" org.jetbrains.changelog" ) version " 2.0.0"
16- // Gradle Qodana Plugin
17- id(" org.jetbrains.qodana" ) version " 0.1.13"
18- // detekt linter - read more: https://detekt.github.io/detekt/gradle.html
19- id(" io.gitlab.arturbosch.detekt" ) version " 1.23.1"
20- // ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
21- id(" org.jlleitschuh.gradle.ktlint" ) version " 12.0.3"
8+ id(" java" ) // Java support
9+ alias(libs.plugins.kotlin) // Kotlin support
10+ alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
2211}
2312
24- group = properties(" pluginGroup" )
25- version = properties(" pluginVersion" )
13+ group = providers.gradleProperty(" pluginGroup" ).get()
14+ version = providers.gradleProperty(" pluginVersion" ).get()
15+
16+ // Set the JVM language level used to build the project.
17+ kotlin {
18+ jvmToolchain(21 )
19+ }
2620
2721// Configure project's dependencies
2822repositories {
2923 mavenCentral()
24+
25+ // IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
26+ intellijPlatform {
27+ defaultRepositories()
28+ }
3029}
3130
31+ // Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
3232dependencies {
33+ implementation(" commons-io:commons-io:2.15.1" )
3334 implementation(" org.javassist:javassist:3.29.2-GA" )
34- implementation(" commons-io:commons-io:2.11.0" )
35- implementation(" io.sentry:sentry:6.18.1" )
36- testImplementation(" org.assertj:assertj-core:3.24.2" )
37- testImplementation(" io.mockk:mockk:1.13.5" )
38- testImplementation(" org.junit.jupiter:junit-jupiter:5.9.3" )
35+ implementation(" io.sentry:sentry:6.28.0" )
36+ testImplementation(" org.assertj:assertj-core:3.25.3" )
37+ testImplementation(" io.mockk:mockk:1.13.8" )
38+ testImplementation(libs.junit)
39+ testImplementation(libs.opentest4j)
40+
41+ // IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
42+ intellijPlatform {
43+ create(providers.gradleProperty(" platformType" ), providers.gradleProperty(" platformVersion" ))
44+
45+ // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
46+ bundledPlugins(providers.gradleProperty(" platformBundledPlugins" ).map { it.split(' ,' ) })
47+
48+ // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
49+ plugins(providers.gradleProperty(" platformPlugins" ).map { it.split(' ,' ) })
50+
51+ testFramework(TestFrameworkType .Platform )
52+ }
3953}
4054
4155configurations {
@@ -46,131 +60,101 @@ configurations {
4660 }
4761}
4862
49- repositories {
50- mavenCentral()
51- }
63+ // Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
64+ intellijPlatform {
65+ pluginConfiguration {
66+ name = providers.gradleProperty(" pluginName" )
67+ version = providers.gradleProperty(" pluginVersion" )
5268
53- // Set the JVM language level used to compile sources and generate files - Java 11 is required since 2020.3
54- kotlin {
55- jvmToolchain {
56- languageVersion.set(JavaLanguageVersion .of(17 ))
69+ // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
70+ // description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
71+ // val start = "<!-- Plugin description -->"
72+ // val end = "<!-- Plugin description end -->"
73+ //
74+ // with(it.lines()) {
75+ // if (!containsAll(listOf(start, end))) {
76+ // throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
77+ // }
78+ // subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
79+ // }
80+ // }
81+
82+ // val changelog = project.changelog // local variable for configuration cache compatibility
83+ // // Get the latest available change notes from the changelog file
84+ // changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
85+ // with(changelog) {
86+ // renderItem(
87+ // (getOrNull(pluginVersion) ?: getUnreleased())
88+ // .withHeader(false)
89+ // .withEmptySections(false),
90+ // Changelog.OutputType.HTML,
91+ // )
92+ // }
93+ // }
94+
95+ ideaVersion {
96+ sinceBuild = providers.gradleProperty(" pluginSinceBuild" )
97+ untilBuild = providers.gradleProperty(" pluginUntilBuild" )
98+ }
5799 }
58- }
59100
60- // Configure detekt plugin.
61- // Read more: https://detekt.github.io/detekt/kotlindsl.html
62- detekt {
63- config = files(" ./detekt-config.yml" )
64- buildUponDefaultConfig = true
65- autoCorrect = true
66-
67- reports {
68- html.enabled = false
69- xml.enabled = false
70- txt.enabled = false
101+ signing {
102+ certificateChain = providers.environmentVariable(" CERTIFICATE_CHAIN" )
103+ privateKey = providers.environmentVariable(" PRIVATE_KEY" )
104+ password = providers.environmentVariable(" PRIVATE_KEY_PASSWORD" )
71105 }
72- }
73106
74- tasks {
75- buildSearchableOptions {
76- enabled = false
107+ publishing {
108+ token = providers.environmentVariable(" PUBLISH_TOKEN" )
109+ // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
110+ // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
111+ // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
112+ channels = providers.gradleProperty(" pluginVersion" ).map { listOf (it.substringAfter(' -' , " " ).substringBefore(' .' ).ifEmpty { " default" }) }
77113 }
78- }
79-
80- // Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
81- intellij {
82- pluginName.set(properties(" pluginName" ))
83- version.set(properties(" platformVersion" ))
84- type.set(properties(" platformType" ))
85-
86- // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
87- val activePlugins: MutableList <Any > =
88- properties(" platformPlugins" ).split(' ,' ).map(String ::trim).filter(String ::isNotEmpty).toMutableList()
89-
90- // activePlugins.add(
91- // project(":doki-theme")
92- // )
93114
94- plugins.set(activePlugins)
95- }
96-
97- // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
98- changelog {
99- version.set(properties(" pluginVersion" ))
100- groups.set(emptyList())
101- }
102-
103- // Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
104- qodana {
105- cachePath.set(projectDir.resolve(" .qodana" ).canonicalPath)
106- reportPath.set(projectDir.resolve(" build/reports/inspections" ).canonicalPath)
107- saveReport.set(true )
108- showReport.set(System .getenv(" QODANA_SHOW_REPORT" )?.toBoolean() ? : false )
115+ pluginVerification {
116+ ides {
117+ recommended()
118+ }
119+ }
109120}
110121
111122tasks {
112123 wrapper {
113- gradleVersion = properties (" gradleVersion" )
124+ gradleVersion = providers.gradleProperty (" gradleVersion" ).get( )
114125 }
115126
116- compileKotlin {
117- dependsOn( " buildThemes " )
127+ buildSearchableOptions {
128+ environment[ " DOKI_HACK " ] = " false "
118129 }
119130
120131 patchPluginXml {
121- version.set(properties(" pluginVersion" ))
122- sinceBuild.set(properties(" pluginSinceBuild" ))
123- untilBuild.set(properties(" pluginUntilBuild" ))
124-
125- // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
126- pluginDescription.set(
127- projectDir.resolve(" README.md" ).readText().lines().run {
128- val start = " <!-- Plugin description -->"
129- val end = " <!-- Plugin description end -->"
130-
131- if (! containsAll(listOf (start, end))) {
132- throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
133- }
134- subList(indexOf(start) + 1 , indexOf(end))
135- }.joinToString(" \n " ).run { markdownToHTML(this ) },
136- )
137-
138- changeNotes.set(
139- projectDir.resolve(" RELEASE-NOTES.md" ).readText().run { markdownToHTML(this ) },
140- )
132+ dependsOn(" buildThemes" )
141133 }
134+ // publishPlugin {
135+ // dependsOn(patchChangelog)
136+ // }
137+ }
142138
139+ intellijPlatformTesting {
143140 runIde {
144- maxHeapSize = " 2g"
145- systemProperty(" idea.ui.icons.svg.disk.cache" , " false" )
146- systemProperty(" idea.platform.prefix" , properties(" idePrefix" ))
147- val idePath = properties(" idePath" )
148- if (idePath.isNotEmpty()) {
149- ideDir.set(file(idePath))
150- }
151- }
152-
153- // Configure UI tests plugin
154- // Read more: https://github.com/JetBrains/intellij-ui-test-robot
155- runIdeForUiTests {
156- systemProperty(" robot-server.port" , " 8082" )
157- systemProperty(" ide.mac.message.dialogs.as.sheets" , " false" )
158- systemProperty(" jb.privacy.policy.text" , " <!--999.999-->" )
159- systemProperty(" jb.consents.confirmation.enabled" , " false" )
160- }
161-
162- signPlugin {
163- certificateChain.set(System .getenv(" CERTIFICATE_CHAIN" ))
164- privateKey.set(System .getenv(" PRIVATE_KEY" ))
165- password.set(System .getenv(" PRIVATE_KEY_PASSWORD" ))
166- }
141+ // maxHeapSize = "2g"
142+ // systemProperty("idea.ui.icons.svg.disk.cache", "false")
143+ register(" runIdeForUiTests" ) {
144+ task {
145+ jvmArgumentProviders + = CommandLineArgumentProvider {
146+ listOf (
147+ " -Drobot-server.port=8082" ,
148+ " -Dide.mac.message.dialogs.as.sheets=false" ,
149+ " -Djb.privacy.policy.text=<!--999.999-->" ,
150+ " -Djb.consents.confirmation.enabled=false" ,
151+ )
152+ }
153+ }
167154
168- publishPlugin {
169- dependsOn(" patchChangelog" )
170- token.set(System .getenv(" PUBLISH_TOKEN" ))
171- // pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
172- // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
173- // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
174- channels.set(listOf (properties(" pluginVersion" ).split(' -' ).getOrElse(1 ) { " default" }.split(' .' ).first()))
155+ plugins {
156+ robotServerPlugin()
157+ }
158+ }
175159 }
176- }
160+ }
0 commit comments