@@ -3,12 +3,13 @@ plugins {
3
3
id ' idea'
4
4
id ' checkstyle'
5
5
id ' pmd'
6
- id ' org.jetbrains.intellij' version ' 1.17.4 '
6
+ id ' org.jetbrains.intellij.platform ' version ' 2.0.1 '
7
7
id ' org.sonarqube' version ' 5.1.0.4882'
8
8
}
9
9
10
10
ext {
11
11
checkstyleVersion = ' 10.18.1'
12
+ pmdVersion = ' 7.5.0'
12
13
}
13
14
14
15
def properties (String key ) {
@@ -19,7 +20,7 @@ def environment(String key) {
19
20
return providers. environmentVariable(key)
20
21
}
21
22
22
- apply plugin : ' org.jetbrains.intellij'
23
+ apply plugin : ' org.jetbrains.intellij.platform '
23
24
apply plugin : ' java'
24
25
apply plugin : ' checkstyle'
25
26
@@ -30,6 +31,10 @@ version = properties("pluginVersion").get()
30
31
// Add build script repository to maven central
31
32
repositories {
32
33
mavenCentral()
34
+ intellijPlatform {
35
+ defaultRepositories()
36
+ jetbrainsRuntime()
37
+ }
33
38
}
34
39
35
40
// https://github.com/gradle/gradle/issues/27035
@@ -41,7 +46,17 @@ configurations.checkstyle {
41
46
42
47
// Add dependencies to test, junit5 api (annotations) and engine (runtime)
43
48
dependencies {
49
+ intellijPlatform {
50
+ create(properties(" platformType" ), properties(" platformVersion" ))
51
+ bundledPlugins(properties(" platformBundledPlugins" ). map { it. split(" ," ). collect { it. trim() }. findAll { ! it. empty } })
52
+ plugins(properties(" platformPlugins" ). map { it. split(" ," ). collect { it. trim() }. findAll { ! it. empty } })
53
+ pluginVerifier()
54
+ zipSigner()
55
+ instrumentationTools()
56
+ }
44
57
checkstyle " com.puppycrawl.tools:checkstyle:${ checkstyleVersion} "
58
+ pmd " net.sourceforge.pmd:pmd-ant:${ pmdVersion} " ,
59
+ " net.sourceforge.pmd:pmd-java:${ pmdVersion} "
45
60
testImplementation platform(' org.junit:junit-bom:5.11.0' ),
46
61
' org.junit.jupiter:junit-jupiter' ,
47
62
' org.junit.jupiter:junit-jupiter-engine' ,
@@ -55,21 +70,36 @@ dependencies {
55
70
// This needs to fit the tag <idea-version since-build="xxx"> in plugin.xml
56
71
// See https://www.jetbrains.com/intellij-repository/snapshots
57
72
// See https://www.jetbrains.com/intellij-repository/releases
58
- intellij {
59
- pluginName = properties(" pluginName" )
60
-
61
- version = properties(" platformVersion" )
62
- type = properties(" platformType" )
63
-
64
- // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
65
- plugins = properties(" platformPlugins" ). map { it. split(" ," ). collect { it. trim() }. findAll { ! it. empty } }
66
-
67
- updateSinceUntilBuild = false
68
- }
69
-
70
-
71
- listProductsReleases {
72
- sinceBuild = " 241.*"
73
+ intellijPlatform {
74
+ pluginConfiguration {
75
+ name = properties(" pluginName" )
76
+ version = properties(" pluginVersion" )
77
+ }
78
+ patchPluginXml {
79
+ pluginId = properties(" pluginGroup" )
80
+ pluginName = properties(" pluginName" )
81
+ pluginVersion = properties(" pluginVersion" )
82
+ sinceBuild = properties(" platformSinceBuild" )
83
+ untilBuild = provider { null }
84
+ }
85
+ pluginVerification {
86
+ ides {
87
+ recommended()
88
+ }
89
+ }
90
+ signPlugin {
91
+ certificateChain = environment(" CERTIFICATE_CHAIN" )
92
+ privateKey = environment(" PRIVATE_KEY" )
93
+ password = environment(" PRIVATE_KEY_PASSWORD" )
94
+ }
95
+ publishPlugin {
96
+ token = environment(" PUBLISH_TOKEN" )
97
+ // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
98
+ // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
99
+ // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
100
+ channels = properties(" pluginVersion" )
101
+ .map { [((it. split(' -' ) as List )[1 ] ?: " default" ). split(' \\ .' ). find { true }. toLowerCase()] }
102
+ }
73
103
}
74
104
75
105
checkstyle {
@@ -82,18 +112,23 @@ checkstyle {
82
112
pmd {
83
113
consoleOutput = true
84
114
ruleSetFiles = files(" .config/pmd/ruleset.xml" )
115
+ toolVersion = pmdVersion
85
116
}
86
117
87
118
tasks. withType(Checkstyle ). configureEach {
88
119
enabled = project. hasProperty(" checkstyleEnabled" );
89
120
}
90
121
122
+ tasks. withType(Pmd ). configureEach {
123
+ enabled = ! project. hasProperty(" skipPMD" )
124
+ }
125
+
91
126
// Configure compileJava AND compileTestJava
92
127
// https://docs.gradle.org/current/dsl/org.gradle.api.tasks.compile.JavaCompile.html
93
128
tasks. withType(JavaCompile ). configureEach {
94
129
// JAVA compatibility
95
- sourceCompatibility = JavaVersion . VERSION_17
96
- targetCompatibility = JavaVersion . VERSION_17
130
+ sourceCompatibility = JavaVersion . VERSION_21
131
+ targetCompatibility = JavaVersion . VERSION_21
97
132
}
98
133
99
134
compileJava. options. encoding = ' UTF-8'
@@ -105,6 +140,16 @@ test {
105
140
useJUnitPlatform()
106
141
}
107
142
143
+ sonar {
144
+ properties {
145
+ // Ignore sonar warnings globally
146
+ property ' sonar.issue.ignore.multicriteria' , ' S1948'
147
+ // Ignore serialization waring as it's only relevant for RMI which is not used
148
+ property ' sonar.issue.ignore.multicriteria.S1948.ruleKey' , ' java:S1948'
149
+ property ' sonar.issue.ignore.multicriteria.S1948.resourceKey' , ' **/*.java'
150
+ }
151
+ }
152
+
108
153
// Add resources directory because intellij test framework checks there for test resources (instead of build/resources)
109
154
sourceSets {
110
155
test. output. resourcesDir = " build/classes/java/resources"
@@ -114,23 +159,4 @@ tasks {
114
159
wrapper {
115
160
gradleVersion = properties(" gradleVersion" ). get()
116
161
}
117
-
118
- patchPluginXml {
119
- version = properties(" pluginVersion" )
120
- }
121
-
122
- signPlugin {
123
- certificateChain = environment(" CERTIFICATE_CHAIN" )
124
- privateKey = environment(" PRIVATE_KEY" )
125
- password = environment(" PRIVATE_KEY_PASSWORD" )
126
- }
127
-
128
- publishPlugin {
129
- token = environment(" PUBLISH_TOKEN" )
130
- // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
131
- // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
132
- // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
133
- channels = properties(" pluginVersion" )
134
- .map { [((it. split(' -' ) as List )[1 ] ?: " default" ). split(' \\ .' ). find { true }. toLowerCase()] }
135
- }
136
162
}
0 commit comments