23
23
*/
24
24
@file:Suppress(" SpellCheckingInspection" , " HardCodedStringLiteral" )
25
25
26
+ import io.gitlab.arturbosch.detekt.Detekt
27
+ import org.jetbrains.changelog.Changelog
28
+ import org.jetbrains.changelog.markdownToHTML
26
29
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
27
30
28
31
fun properties (key : String ) = project.findProperty(key).toString()
29
32
33
+ fun environment (key : String ) = providers.environmentVariable(key)
34
+
30
35
fun fileProperties (key : String ) = project.findProperty(key).toString().let { if (it.isNotEmpty()) file(it) else null }
31
36
32
37
33
38
plugins {
39
+ signing
34
40
// Java support
35
41
id(" java" )
36
- // Kotlin support
37
- id(" org.jetbrains.kotlin.jvm" ) version " 1.9.21"
38
- // gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
39
- id(" org.jetbrains.intellij" ) version " 1.16.0"
40
- // gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
41
- id(" org.jetbrains.changelog" ) version " 2.2.0"
42
- // detekt linter - read more: https://detekt.github.io/detekt/gradle.html
43
- id(" io.gitlab.arturbosch.detekt" ) version " 1.23.4"
44
- // ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
45
- id(" org.jlleitschuh.gradle.ktlint" ) version " 11.6.1"
42
+ alias(libs.plugins.kotlin)
43
+ alias(libs.plugins.gradleIntelliJPlugin)
44
+ alias(libs.plugins.changelog)
45
+ alias(libs.plugins.qodana)
46
+ alias(libs.plugins.detekt)
47
+ alias(libs.plugins.ktlint)
48
+ alias(libs.plugins.kover)
46
49
}
47
50
48
51
group = properties(" pluginGroup" )
@@ -64,8 +67,12 @@ java {
64
67
}
65
68
}
66
69
70
+ kotlin {
71
+ jvmToolchain(17 )
72
+ }
73
+
67
74
dependencies {
68
- // detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.20.0 ")
75
+ detektPlugins(" io.gitlab.arturbosch.detekt:detekt-formatting:1.23.4 " )
69
76
implementation(" com.twelvemonkeys.imageio:imageio-core:$depsTwelveMonkeys " )
70
77
implementation(" com.twelvemonkeys.imageio:imageio-metadata:$depsTwelveMonkeys " )
71
78
implementation(" com.twelvemonkeys.imageio:imageio-sgi:$depsTwelveMonkeys " )
@@ -114,13 +121,18 @@ changelog {
114
121
115
122
// Configure detekt plugin.
116
123
// Read more: https://detekt.github.io/detekt/kotlindsl.html
117
- // detekt {
118
- // config = files("./detekt-config.yml")
119
- // buildUponDefaultConfig = true
120
- // autoCorrect = true
121
- // }
124
+ detekt {
125
+ config.setFrom(" ./detekt-config.yml" )
126
+ buildUponDefaultConfig = true
127
+ autoCorrect = true
128
+ ignoreFailures = true
129
+ }
122
130
123
131
tasks {
132
+ wrapper {
133
+ gradleVersion = properties(" gradleVersion" )
134
+ }
135
+
124
136
properties(" javaVersion" ).let {
125
137
// Set the compatibility versions to 1.8
126
138
withType<JavaCompile > {
@@ -133,10 +145,10 @@ tasks {
133
145
}
134
146
}
135
147
136
- // withType<Detekt> {
137
- // jvmTarget = properties("javaVersion")
138
- // reports.xml.required.set( true)
139
- // }
148
+ withType<Detekt > {
149
+ jvmTarget = properties(" javaVersion" )
150
+ reports.xml.required = true
151
+ }
140
152
141
153
withType<Copy > {
142
154
duplicatesStrategy = DuplicatesStrategy .INCLUDE
@@ -150,14 +162,12 @@ tasks {
150
162
}
151
163
152
164
patchPluginXml {
153
- version.set( properties(" pluginVersion" ) )
154
- sinceBuild.set( properties(" pluginSinceBuild" ) )
155
- untilBuild.set( properties(" pluginUntilBuild" ) )
165
+ version = properties(" pluginVersion" )
166
+ sinceBuild = properties(" pluginSinceBuild" )
167
+ untilBuild = properties(" pluginUntilBuild" )
156
168
157
169
// Get the latest available change notes from the changelog file
158
- changeNotes.set(
159
- changelog.getLatest().toHTML()
160
- )
170
+ changeNotes = changelog.renderItem(changelog.getLatest(), Changelog .OutputType .HTML )
161
171
}
162
172
163
173
runPluginVerifier {
@@ -174,18 +184,24 @@ tasks {
174
184
// }
175
185
176
186
signPlugin {
177
- certificateChain.set( System .getenv( " CERTIFICATE_CHAIN" ) )
178
- privateKey.set( System .getenv( " PRIVATE_KEY" ) )
179
- password.set( System .getenv( " PRIVATE_KEY_PASSWORD" ) )
187
+ certificateChain = environment( " CERTIFICATE_CHAIN" )
188
+ privateKey = environment( " PRIVATE_KEY" )
189
+ password = environment( " PRIVATE_KEY_PASSWORD" )
180
190
}
181
191
182
192
publishPlugin {
183
- // dependsOn("patchChangelog")
184
- token.set(System .getenv(" INTELLIJ_PUBLISH_TOKEN" ) ? : file(" ./publishToken" ).readText().trim())
185
- channels.set(listOf (properties(" pluginVersion" ).split(' -' ).getOrElse(1 ) { " default" }.split(' .' ).first()))
193
+ token = environment(" PUBLISH_TOKEN" )
194
+ channels = listOf (properties(" pluginVersion" ).split(' -' ).getOrElse(1 ) { " default" }.split(' .' ).first())
186
195
}
187
196
188
197
runIde {
189
- ideDir.set(fileProperties(" idePath" ))
198
+ ideDir = fileProperties(" idePath" )
199
+ }
200
+
201
+ register(" markdownToHtml" ) {
202
+ val input = File (" ${project.projectDir} /docs/CHANGELOG.md" )
203
+ File (" ${project.projectDir} /docs/CHANGELOG.html" ).run {
204
+ writeText(markdownToHTML(input.readText()))
205
+ }
190
206
}
191
207
}
0 commit comments