1
1
import io.gitlab.arturbosch.detekt.Detekt
2
2
import org.jetbrains.changelog.Changelog
3
3
import org.jetbrains.changelog.markdownToHTML
4
+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4
5
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
5
6
6
7
fun properties (key : String ) = project.findProperty(key).toString()
@@ -9,21 +10,22 @@ plugins {
9
10
// Java support
10
11
id(" java" )
11
12
// Kotlin support
12
- id( " org.jetbrains.kotlin. jvm" ) version " 2.0.20"
13
+ kotlin( " jvm" ) version " 2.0.20"
13
14
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
14
- id(" org.jetbrains.intellij" ) version " 1.17.4 "
15
+ id(" org.jetbrains.intellij.platform " ) version " 2.1.0 "
15
16
// gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
16
17
id(" org.jetbrains.changelog" ) version " 2.2.1"
17
18
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
18
19
id(" io.gitlab.arturbosch.detekt" ) version " 1.23.7"
19
20
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
20
- id(" org.jlleitschuh.gradle.ktlint" ) version " 11.6.1 "
21
+ id(" org.jlleitschuh.gradle.ktlint" ) version " 12.1.0 "
21
22
// google-java-format
22
23
id(" com.github.sherter.google-java-format" ) version " 0.9"
23
24
// license header
24
25
id(" com.github.hierynomus.license" ) version " 0.16.1"
25
26
// Sonar support
26
27
id(" org.sonarqube" ) version " 5.1.0.4882"
28
+ // plugin verifier
27
29
}
28
30
29
31
group = properties(" pluginGroup" )
@@ -32,23 +34,58 @@ version = properties("pluginVersion")
32
34
// Configure project's dependencies
33
35
repositories {
34
36
mavenCentral()
37
+ intellijPlatform {
38
+ defaultRepositories()
39
+ }
35
40
}
36
41
37
42
dependencies {
38
43
detektPlugins(" io.gitlab.arturbosch.detekt:detekt-formatting:1.23.7" )
44
+ intellijPlatform {
45
+ create(properties(" platformType" ), properties(" platformVersion" ))
46
+ bundledPlugins(providers.gradleProperty(" platformBundledPlugins" ).map { it.split(' ,' ) })
47
+ }
48
+ runtimeOnly(" org.jetbrains.intellij.plugins:verifier-cli:1.379" )
39
49
}
40
50
41
51
// Configure gradle-intellij-plugin plugin.
42
- // Read more: https://github.com/JetBrains/gradle-intellij-plugin
43
- intellij {
44
- pluginName.set(properties(" pluginName" ))
45
- version.set(properties(" platformVersion" ))
46
- type.set(properties(" platformType" ))
47
- downloadSources.set(properties(" platformDownloadSources" ).toBoolean())
48
- updateSinceUntilBuild.set(true )
49
-
50
- // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
51
- plugins.set(properties(" platformPlugins" ).split(' ,' ).map(String ::trim).filter(String ::isNotEmpty))
52
+ intellijPlatform {
53
+ buildSearchableOptions = true
54
+ instrumentCode = false
55
+ projectName = project.name
56
+ pluginConfiguration {
57
+ id = " cookiecode-stepbuilder-plugin"
58
+ name = " Stepbuilder Codegen"
59
+ ideaVersion {
60
+ sinceBuild = properties(" pluginSinceBuild" )
61
+ untilBuild = properties(" pluginUntilBuild" )
62
+ }
63
+ vendor {
64
+ name = " Sebastien Vermeille"
65
+
66
+ url = " https://cookiecode.dev"
67
+ }
68
+ }
69
+ pluginVerification {
70
+ cliPath = file(" build/libs/verifier-cli-1.379.jar" )
71
+
72
+ ides {
73
+ recommended()
74
+ // select {
75
+ // types = listOf(IntelliJPlatformType.IntellijIdeaCommunity)
76
+ // channels = listOf(ProductRelease.Channel.RELEASE)
77
+ // sinceBuild = properties("pluginSinceBuild")
78
+ // untilBuild = properties("pluginUntilBuild")
79
+ // }
80
+ }
81
+ }
82
+ publishing {
83
+ host = " https://plugins.jetbrains.com"
84
+ token = System .getenv(" PUBLISH_TOKEN" )
85
+ channels = listOf (" default" )
86
+ ideServices = false
87
+ hidden = false
88
+ }
52
89
}
53
90
54
91
sonarqube {
@@ -69,14 +106,8 @@ changelog {
69
106
// Configure detekt plugin.
70
107
// Read more: https://detekt.github.io/detekt/kotlindsl.html
71
108
detekt {
72
- config = files(" ./detekt-config.yml" )
109
+ config.setFrom( files(" ./detekt-config.yml" ) )
73
110
buildUponDefaultConfig = true
74
-
75
- reports {
76
- html.enabled = false
77
- xml.enabled = false
78
- txt.enabled = false
79
- }
80
111
}
81
112
82
113
googleJavaFormat {
@@ -91,21 +122,29 @@ license {
91
122
tasks {
92
123
// Set the compatibility versions to 17
93
124
withType<JavaCompile > {
94
- sourceCompatibility = " 17 "
95
- targetCompatibility = " 17 "
125
+ sourceCompatibility = properties( " targetJdk " )
126
+ targetCompatibility = properties( " targetJdk " )
96
127
}
97
128
withType<KotlinCompile > {
98
- kotlinOptions.jvmTarget = " 17"
129
+ compilerOptions {
130
+ jvmTarget.set(JvmTarget .JVM_17 )
131
+ }
99
132
}
100
133
101
134
withType<Detekt > {
102
- jvmTarget = " 17"
135
+ jvmTarget = properties(" targetJdk" )
136
+ }
137
+
138
+ withType<Detekt >().configureEach {
139
+ reports {
140
+ html.required.set(true )
141
+ xml.required.set(true )
142
+ txt.required.set(false )
143
+ }
103
144
}
104
145
105
146
patchPluginXml {
106
- version.set(properties(" pluginVersion" ))
107
- sinceBuild.set(properties(" pluginSinceBuild" ))
108
- untilBuild.set(properties(" pluginUntilBuild" ))
147
+ version = properties(" pluginVersion" )
109
148
110
149
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
111
150
pluginDescription.set(
@@ -117,23 +156,30 @@ tasks {
117
156
throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
118
157
}
119
158
subList(indexOf(start) + 1 , indexOf(end))
120
- }.joinToString(" \n " ).run { markdownToHTML(this ) }
159
+ }.joinToString(" \n " ).run {
160
+ markdownToHTML(this )
161
+ },
121
162
)
122
163
123
164
// Get the latest available change notes from the changelog file
124
165
changeNotes.set(provider { changelog.renderItem(changelog.getLatest(), Changelog .OutputType .HTML ) })
125
166
}
167
+ }
126
168
127
- runPluginVerifier {
128
- ideVersions.set(properties(" pluginVerifierIdeVersions" ).split(' ,' ).map(String ::trim).filter(String ::isNotEmpty))
129
- }
169
+ tasks.register<Copy >(" downloadVerifierCli" ) {
170
+ val outputDir = layout.buildDirectory.dir(" libs" ).get().asFile
171
+
172
+ from(
173
+ configurations.create(" verifierCli" ).apply {
174
+ dependencies.add(
175
+ project.dependencies.create(" org.jetbrains.intellij.plugins:verifier-cli:1.379" ),
176
+ )
177
+ },
178
+ )
179
+
180
+ into(outputDir)
130
181
131
- publishPlugin {
132
- dependsOn(" patchChangelog" )
133
- token.set(System .getenv(" PUBLISH_TOKEN" ))
134
- // pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
135
- // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
136
- // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
137
- channels.set(listOf (properties(" pluginVersion" ).split(' -' ).getOrElse(1 ) { " default" }.split(' .' ).first()))
182
+ doLast {
183
+ println (" Dependency downloaded to: ${outputDir.absolutePath} " )
138
184
}
139
185
}
0 commit comments