1
- import io.gitlab.arturbosch.detekt.Detekt
2
- import org.jetbrains.changelog.markdownToHTML
3
- import org.jetbrains.intellij.tasks.RunPluginVerifierTask.FailureLevel
4
- import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
5
-
6
- fun properties (key : String ) = project.findProperty(key).toString()
1
+ import org.jetbrains.intellij.platform.gradle.TestFrameworkType
7
2
8
3
plugins {
9
- // Kotlin support
10
- kotlin(" jvm" ) version " 2.0.0"
11
- // gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
12
- id(" org.jetbrains.intellij" ) version " 1.13.3"
13
- // gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
14
- id(" org.jetbrains.changelog" ) version " 2.0.0"
15
- // detekt linter - read more: https://detekt.github.io/detekt/gradle.html
16
- id(" io.gitlab.arturbosch.detekt" ) version " 1.22.0"
17
- // ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
18
- id(" org.jlleitschuh.gradle.ktlint" ) version " 11.3.2"
4
+ id(" java" ) // Java support
5
+ alias(libs.plugins.kotlin) // Kotlin support
6
+ alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
19
7
}
20
8
21
- // Import variables from gradle.properties file
22
- val pluginGroup: String by project
23
- // `pluginName_` variable ends with `_` because of the collision with Kotlin magic getter in the `intellij` closure.
24
- // Read more about the issue: https://github.com/JetBrains/intellij-platform-plugin-template/issues/29
25
- val pluginName_: String by project
26
- val pluginVersion: String by project
27
- val pluginSinceBuild: String by project
28
- val pluginUntilBuild: String by project
29
- val pluginVerifierIdeVersions: String by project
30
-
31
- val platformType: String by project
32
- val platformVersion: String by project
33
- val platformPlugins: String by project
34
- val platformDownloadSources: String by project
35
- val idePath: String by project
36
-
37
- group = pluginGroup
38
- version = pluginVersion
9
+ group = providers.gradleProperty(" pluginGroup" ).get()
10
+ version = providers.gradleProperty(" pluginVersion" ).get()
11
+
12
+ // Set the JVM language level used to build the project.
13
+ kotlin {
14
+ jvmToolchain(21 )
15
+ }
39
16
40
17
// Configure project's dependencies
41
18
repositories {
42
19
mavenCentral()
43
- maven(" https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven" )
20
+
21
+ // IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
22
+ intellijPlatform {
23
+ defaultRepositories()
24
+ }
44
25
}
26
+
27
+ // Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
45
28
dependencies {
46
- detektPlugins( " io.gitlab.arturbosch.detekt:detekt-formatting:1.21.0 " )
47
- implementation(" commons-io:commons-io:2.11.0 " )
29
+ implementation( " commons-io:commons-io:2.15.1 " )
30
+ implementation(" org.javassist:javassist:3.29.2-GA " )
48
31
implementation(" com.googlecode.soundlibs:mp3spi:1.9.5.4" )
49
- implementation(" io.sentry:sentry:6.4.2" )
32
+ implementation(" io.sentry:sentry:6.28.0" )
33
+ testImplementation(" org.assertj:assertj-core:3.25.3" )
34
+ testImplementation(" io.mockk:mockk:1.13.8" )
50
35
compileOnly(files(" lib/instrumented-doki-theme-jetbrains-88.5-1.11.0.jar" ))
51
- testImplementation(" org.assertj:assertj-core:3.23.1" )
52
- testImplementation(" io.mockk:mockk:1.12.8" )
36
+ testImplementation(libs.junit)
37
+ testImplementation(libs.opentest4j)
38
+
39
+ // IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
40
+ intellijPlatform {
41
+ create(providers.gradleProperty(" platformType" ), providers.gradleProperty(" platformVersion" ))
42
+
43
+ // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
44
+ bundledPlugins(providers.gradleProperty(" platformBundledPlugins" ).map { it.split(' ,' ) })
45
+
46
+ // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
47
+ plugins(providers.gradleProperty(" platformPlugins" ).map { it.split(' ,' ) })
48
+
49
+ testFramework(TestFrameworkType .Platform )
50
+ }
53
51
}
54
52
55
53
configurations {
@@ -60,93 +58,66 @@ configurations {
60
58
}
61
59
}
62
60
63
- // Configure gradle-intellij-plugin plugin.
64
- // Read more: https://github.com/JetBrains/gradle-intellij-plugin
65
- intellij {
66
- pluginName.set(pluginName_)
67
- version.set(platformVersion)
68
- type.set(platformType)
69
- downloadSources.set(platformDownloadSources.toBoolean())
70
- updateSinceUntilBuild.set(true )
71
-
72
- // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
73
- plugins.set(
74
- platformPlugins.split(' ,' )
75
- .map(String ::trim)
76
- .filter(String ::isNotEmpty)
77
- )
78
- }
61
+ // Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
62
+ intellijPlatform {
63
+ pluginConfiguration {
64
+ name = providers.gradleProperty(" pluginName" )
65
+ version = providers.gradleProperty(" pluginVersion" )
79
66
80
- // Configure detekt plugin.
81
- // Read more: https://detekt.github.io/detekt/kotlindsl.html
82
- detekt {
83
- config = files(" ./detekt-config.yml" )
84
- buildUponDefaultConfig = true
85
- autoCorrect = true
86
-
87
- reports {
88
- html.enabled = false
89
- xml.enabled = false
90
- txt.enabled = false
67
+ ideaVersion {
68
+ sinceBuild = providers.gradleProperty(" pluginSinceBuild" )
69
+ untilBuild = providers.gradleProperty(" pluginUntilBuild" )
70
+ }
91
71
}
92
- }
93
72
94
- tasks {
95
- withType<JavaCompile > {
96
- sourceCompatibility = " 17"
97
- targetCompatibility = " 17"
98
- }
99
- withType<KotlinCompile > {
100
- kotlinOptions.jvmTarget = " 17"
73
+ signing {
74
+ certificateChain = providers.environmentVariable(" CERTIFICATE_CHAIN" )
75
+ privateKey = providers.environmentVariable(" PRIVATE_KEY" )
76
+ password = providers.environmentVariable(" PRIVATE_KEY_PASSWORD" )
101
77
}
102
78
103
- withType<Detekt > {
104
- jvmTarget = " 17"
79
+ publishing {
80
+ token = providers.environmentVariable(" PUBLISH_TOKEN" )
81
+ // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
82
+ // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
83
+ // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
84
+ channels = providers.gradleProperty(" pluginVersion" ).map { listOf (it.substringAfter(' -' , " " ).substringBefore(' .' ).ifEmpty { " default" }) }
105
85
}
106
86
107
- runIde {
108
- maxHeapSize = " 2g"
109
- autoReloadPlugins.set(false )
110
- enabled = environment.getOrDefault(" SHOULD_DOKI_THEME_RUN" , " true" ) == " true"
111
- val idePath = properties(" idePath" )
112
- if (idePath.isNotEmpty()) {
113
- ideDir.set(file(idePath))
87
+ pluginVerification {
88
+ ides {
89
+ recommended()
114
90
}
115
91
}
92
+ }
93
+
94
+ tasks {
95
+ wrapper {
96
+ gradleVersion = providers.gradleProperty(" gradleVersion" ).get()
97
+ }
116
98
117
99
buildSearchableOptions {
118
- enabled = true
100
+ enabled = false
119
101
}
102
+ }
120
103
121
- patchPluginXml {
122
- version.set(pluginVersion)
123
- sinceBuild.set(pluginSinceBuild)
124
- untilBuild.set(pluginUntilBuild)
125
-
126
- // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
127
- pluginDescription.set(
128
- provider {
129
- File (" ${project.projectDir} /README.md" ).readText().lines().run {
130
- val start = " <!-- Plugin description -->"
131
- val end = " <!-- Plugin description end -->"
132
-
133
- if (! containsAll(listOf (start, end))) {
134
- throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
135
- }
136
- subList(indexOf(start) + 1 , indexOf(end))
137
- }.joinToString(" \n " ).run { markdownToHTML(this ) }
104
+ intellijPlatformTesting {
105
+ runIde {
106
+ register(" runIdeForUiTests" ) {
107
+ task {
108
+ jvmArgumentProviders + = CommandLineArgumentProvider {
109
+ listOf (
110
+ " -Drobot-server.port=8082" ,
111
+ " -Dide.mac.message.dialogs.as.sheets=false" ,
112
+ " -Djb.privacy.policy.text=<!--999.999-->" ,
113
+ " -Djb.consents.confirmation.enabled=false" ,
114
+ )
115
+ }
138
116
}
139
- )
140
117
141
- changeNotes.set(
142
- provider {
143
- markdownToHTML(File (" ${project.projectDir} /docs/RELEASE-NOTES.md" ).readText())
118
+ plugins {
119
+ robotServerPlugin()
144
120
}
145
- )
146
- }
147
-
148
- runPluginVerifier {
149
- failureLevel.set(listOf (FailureLevel .COMPATIBILITY_PROBLEMS ))
150
- ideVersions.set(pluginVerifierIdeVersions.split(" ," ).filter { it.isNotEmpty() })
121
+ }
151
122
}
152
123
}
0 commit comments