1
- import org.apache.tools.ant.filters.ReplaceTokens
2
1
import org.jetbrains.changelog.Changelog
3
-
4
- fun properties ( key : String ) = providers.gradleProperty(key)
2
+ import org.jetbrains.changelog.markdownToHTML
3
+ import org.jetbrains.intellij.platform.gradle.TestFrameworkType
5
4
6
5
plugins {
7
6
id(" java" ) // Java support
8
7
alias(libs.plugins.kotlin) // Kotlin support
9
- alias(libs.plugins.gradleIntelliJPlugin ) // Gradle IntelliJ Plugin
8
+ alias(libs.plugins.intelliJPlatform ) // IntelliJ Platform Gradle Plugin
10
9
alias(libs.plugins.changelog) // Gradle Changelog Plugin
11
- alias(libs.plugins.kotlinSerialization) // Kotlinx serialization
12
10
alias(libs.plugins.gradleDetektPlugin) // Gradle Detekt Plugin
13
11
alias(libs.plugins.gradleDiktatPlugin) // Gradle Diktat Plugin
14
12
}
15
13
16
- group = properties(" pluginGroup" ).get()
17
- version = properties(" pluginVersion" ).get()
14
+ group = providers.gradleProperty(" pluginGroup" ).get()
15
+ version = providers.gradleProperty(" pluginVersion" ).get()
16
+
17
+ // Set the JVM language level used to build the project.
18
+ kotlin {
19
+ jvmToolchain(17 )
20
+ }
18
21
19
22
// Configure project's dependencies
20
23
repositories {
21
24
mavenCentral()
22
- }
23
25
24
- // Set the JVM language level used to build the project.
25
- kotlin {
26
- jvmToolchain(17 )
26
+ // IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
27
+ intellijPlatform {
28
+ defaultRepositories()
29
+ }
27
30
}
28
31
29
32
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
@@ -33,22 +36,58 @@ dependencies {
33
36
implementation(libs.kotlinxSerializationJson)
34
37
implementation(libs.markdown)
35
38
implementation(libs.sentry)
39
+
40
+ // IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
41
+ intellijPlatform {
42
+ create(providers.gradleProperty(" platformType" ), providers.gradleProperty(" platformVersion" ))
43
+
44
+ // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
45
+ bundledPlugins(providers.gradleProperty(" platformBundledPlugins" ).map { it.split(' ,' ) })
46
+
47
+ // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
48
+ plugins(providers.gradleProperty(" platformPlugins" ).map { it.split(' ,' ) })
49
+
50
+ instrumentationTools()
51
+ pluginVerifier()
52
+ zipSigner()
53
+ }
36
54
}
37
55
38
- // Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
39
- intellij {
40
- pluginName = properties(" pluginName" )
41
- version = properties(" platformVersion" )
42
- type = properties(" platformType" )
56
+ // Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
57
+ intellijPlatform {
58
+ pluginConfiguration {
59
+ version = providers.gradleProperty(" pluginVersion" )
60
+
61
+ val changelog = project.changelog // local variable for configuration cache compatibility
62
+ // Get the latest available change notes from the changelog file
63
+ changeNotes = providers.gradleProperty(" pluginVersion" ).map { pluginVersion ->
64
+ with (changelog) {
65
+ renderItem(
66
+ (getOrNull(pluginVersion) ? : getUnreleased())
67
+ .withHeader(false )
68
+ .withEmptySections(false ),
69
+ Changelog .OutputType .HTML ,
70
+ )
71
+ }
72
+ }
73
+
74
+ ideaVersion {
75
+ sinceBuild = providers.gradleProperty(" pluginSinceBuild" )
76
+ untilBuild = providers.gradleProperty(" pluginUntilBuild" )
77
+ }
78
+ }
43
79
44
- // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
45
- plugins = properties(" platformPlugins" ).map { it.split(' ,' ).map(String ::trim).filter(String ::isNotEmpty) }
80
+ pluginVerification {
81
+ ides {
82
+ recommended()
83
+ }
84
+ }
46
85
}
47
86
48
87
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
49
88
changelog {
50
89
groups.empty()
51
- repositoryUrl = properties (" pluginRepositoryUrl" )
90
+ repositoryUrl = providers.gradleProperty (" pluginRepositoryUrl" )
52
91
}
53
92
54
93
// Configure detekt plugin.
@@ -59,42 +98,12 @@ detekt {
59
98
}
60
99
61
100
tasks {
62
- processResources {
63
- val tokens = mapOf (
64
- " sentry_dsn" to (System .getenv(" SENTRY_DSN" ) ? : " " ),
65
- )
66
-
67
- filesMatching(" plugin_config.json" ) {
68
- filteringCharset = " UTF-8"
69
- filter<ReplaceTokens >(" tokens" to tokens)
70
- }
71
- }
72
-
73
101
wrapper {
74
- gradleVersion = properties(" gradleVersion" ).get()
75
- }
76
-
77
- patchPluginXml {
78
- version = properties(" pluginVersion" )
79
- sinceBuild = properties(" pluginSinceBuild" )
80
- untilBuild = properties(" pluginUntilBuild" )
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 = properties(" 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
- }
102
+ gradleVersion = providers.gradleProperty(" gradleVersion" ).get()
94
103
}
95
104
96
- runIde {
97
- maxHeapSize = " 8g "
105
+ publishPlugin {
106
+ dependsOn(patchChangelog)
98
107
}
99
108
100
109
detekt.configure {
0 commit comments