1
- /*
1
+ /* *
2
+ * ****************************************************************************
2
3
* The MIT License (MIT)
3
4
*
4
- * Copyright (c) 2021 Elior "Mallowigi" Boukhobza
5
+ * Copyright (c) 2015-2024 Elior "Mallowigi" Boukhobza
5
6
*
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
7
+ * Permission is hereby granted, free of charge, to any person obtaining
8
+ * a copy of this software and associated documentation files (the
9
+ * "Software"), to deal in the Software without restriction, including
10
+ * without limitation the rights to use, copy, modify, merge, publish,
11
+ * distribute, sublicense, and/or sell copies of the Software, and to
12
+ * permit persons to whom the Software is furnished to do so, subject to
13
+ * the following conditions:
12
14
*
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
+ * The above copyright notice and this permission notice shall be included
16
+ * in all copies or substantial portions of the Software.
15
17
*
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
22
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ * ****************************************************************************
23
26
*/
27
+
24
28
@file:Suppress(" SpellCheckingInspection" , " HardCodedStringLiteral" )
25
29
26
30
import io.gitlab.arturbosch.detekt.Detekt
31
+ import kotlinx.coroutines.runBlocking
27
32
import org.jetbrains.changelog.Changelog
33
+ import org.jetbrains.changelog.markdownToHTML
34
+ import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform
35
+ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
36
+
37
+ fun properties (key : String ) = providers.gradleProperty(key).get()
38
+ fun environment (key : String ) = providers.environmentVariable(key)
39
+ fun fileContents (filePath : String ) = providers.fileContents(layout.projectDirectory.file(filePath)).asText
40
+
41
+ val platformVersion: String by project
42
+
43
+ val pluginName: String by project
44
+ val pluginID: String by project
45
+ val pluginVersion: String by project
46
+ val pluginDescription: String by project
47
+ val pluginSinceBuild: String by project
48
+ val pluginUntilBuild: String by project
28
49
29
- fun properties (key : String ) = project.findProperty(key).toString()
50
+ val pluginVendorName: String by project
51
+ val pluginVendorEmail: String by project
52
+ val pluginVendorUrl: String by project
53
+
54
+ val pluginChannels: String by project
55
+
56
+ val javaVersion: String by project
57
+ val gradleVersion: String by project
30
58
31
59
plugins {
32
- // Java support
33
60
id(" java" )
34
- // Kotlin support
35
- id(" org.jetbrains.kotlin.jvm" ) version " 1.9.22"
36
- // gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
37
- id(" org.jetbrains.intellij" ) version " 1.17.0"
38
- // gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
39
- id(" org.jetbrains.changelog" ) version " 2.2.0"
40
- // Gradle Qodana Plugin
41
- id(" org.jetbrains.qodana" ) version " 2023.2.1"
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 " 12.1.0"
61
+
62
+ alias(libs.plugins.kotlin)
63
+ alias(libs.plugins.gradleIntelliJPlugin)
64
+ alias(libs.plugins.changelog)
65
+ alias(libs.plugins.detekt)
66
+ alias(libs.plugins.ktlint)
46
67
}
47
68
48
- group = properties( " pluginGroup " )
49
- version = properties( " pluginVersion" )
69
+ group = pluginID
70
+ version = pluginVersion
50
71
51
- // Configure project's dependencies
52
72
repositories {
53
73
mavenCentral()
54
- maven(url = " https://maven-central.storage-download.googleapis.com/repos/central/data/" )
55
- maven(url = " https://repo.eclipse.org/content/groups/releases/" )
56
- maven(url = " https://www.jetbrains.com/intellij-repository/releases" )
57
- maven(url = " https://www.jetbrains.com/intellij-repository/snapshots" )
74
+ mavenLocal()
75
+ gradlePluginPortal()
76
+
77
+ intellijPlatform {
78
+ defaultRepositories()
79
+ }
58
80
}
59
81
60
82
dependencies {
61
- detektPlugins(" io.gitlab.arturbosch.detekt:detekt-formatting:1.23.4" )
62
- implementation(" com.jgoodies:jgoodies-forms:1.9.0" )
63
- implementation(" com.thoughtworks.xstream:xstream:1.4.20" )
64
- implementation(" org.javassist:javassist:3.30.2-GA" )
65
- implementation(" com.mixpanel:mixpanel-java:1.5.2" )
83
+ intellijPlatform {
84
+ intellijIdeaUltimate(platformVersion, useInstaller = false )
85
+ instrumentationTools()
86
+ // local(properties("idePath"))
87
+
88
+ pluginVerifier()
89
+ zipSigner()
90
+ }
91
+
92
+ detektPlugins(" io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6" )
66
93
}
67
94
68
- // Configure gradle-intellij-plugin plugin.
69
- // Read more: https://github.com/JetBrains/gradle-intellij-plugin
70
- intellij {
71
- pluginName.set(properties(" pluginName" ))
72
- version.set(properties(" platformVersion" ))
73
- type.set(properties(" platformType" ))
74
- downloadSources.set(true )
75
- instrumentCode.set(true )
76
- updateSinceUntilBuild.set(true )
77
- // localPath.set(properties("idePath"))
78
-
79
- // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
80
- plugins.set(listOf (" java" ))
95
+ intellijPlatform {
96
+ buildSearchableOptions = false
97
+ instrumentCode = true
98
+
99
+ projectName = pluginName
100
+
101
+ pluginConfiguration {
102
+ id = pluginID
103
+ name = pluginName
104
+ version = pluginVersion
105
+ description = pluginDescription
106
+
107
+ // Get the latest available change notes from the changelog file
108
+ val changelog = project.changelog // local variable for configuration cache compatibility
109
+ // Get the latest available change notes from the changelog file
110
+ val pluginVersion = pluginVersion
111
+ changeNotes.set(provider {
112
+ with (changelog) {
113
+ renderItem(
114
+ (getOrNull(pluginVersion) ? : getUnreleased()).withHeader(false ).withEmptySections(false ),
115
+ Changelog .OutputType .HTML ,
116
+ )
117
+ }
118
+ })
119
+
120
+ ideaVersion {
121
+ sinceBuild = pluginSinceBuild
122
+ untilBuild = pluginUntilBuild
123
+ }
124
+
125
+ vendor {
126
+ name = pluginVendorName
127
+ email = pluginVendorEmail
128
+ url = pluginVendorUrl
129
+ }
130
+ }
131
+
132
+ publishing {
133
+ token = environment(" INTELLIJ_PUBLISH_TOKEN" )
134
+ channels = pluginChannels.split(' ,' ).map { it.trim() }
135
+ }
136
+
137
+ signing {
138
+ certificateChain = fileContents(" ./chain.crt" )
139
+ privateKey = fileContents(" ./private.pem" )
140
+ password = fileContents(" ./private_encrypted.pem" )
141
+ }
142
+
143
+ pluginVerification {
144
+ ides {
145
+ recommended()
146
+ select {
147
+ sinceBuild = pluginSinceBuild
148
+ untilBuild = pluginUntilBuild
149
+ }
150
+ }
151
+ }
81
152
}
82
- // Configure gradle-changelog-plugin plugin.
83
- // Read more: https://github.com/JetBrains/gradle-changelog-plugin
153
+
84
154
changelog {
85
155
path.set(" ${project.projectDir} /docs/CHANGELOG.md" )
86
- version.set(properties( " pluginVersion" ) )
87
- header.set(provider { version.get() })
156
+ version.set(pluginVersion)
157
+ // header.set(provider { version })
88
158
itemPrefix.set(" -" )
89
159
keepUnreleasedSection.set(true )
90
160
unreleasedTerm.set(" Changelog" )
91
161
groups.set(listOf (" Features" , " Fixes" , " Removals" , " Other" ))
92
162
}
93
163
94
- // Configure detekt plugin.
95
- // Read more: https://detekt.github.io/detekt/kotlindsl.html
96
164
detekt {
97
- config = files(" ./detekt-config.yml" )
165
+ config.from( files(" ./detekt-config.yml" ) )
98
166
buildUponDefaultConfig = true
99
167
autoCorrect = true
100
168
}
101
169
102
-
103
170
tasks {
104
- properties( " javaVersion" ) .let {
171
+ javaVersion.let {
105
172
// Set the compatibility versions to 1.8
106
173
withType<JavaCompile > {
107
174
sourceCompatibility = it
108
175
targetCompatibility = it
109
176
}
110
- withType< org.jetbrains.kotlin.gradle.tasks. KotlinCompile > {
177
+ withType<KotlinCompile > {
111
178
kotlinOptions.jvmTarget = it
112
179
kotlinOptions.freeCompilerArgs + = listOf (" -Xskip-prerelease-check" , " -Xjvm-default=all" )
113
180
}
@@ -118,7 +185,7 @@ tasks {
118
185
}
119
186
120
187
withType<Detekt > {
121
- jvmTarget = properties( " javaVersion" )
188
+ jvmTarget = javaVersion
122
189
reports.xml.required.set(true )
123
190
}
124
191
@@ -133,61 +200,10 @@ tasks {
133
200
}
134
201
}
135
202
136
- patchPluginXml {
137
- version.set(properties(" pluginVersion" ))
138
- sinceBuild.set(properties(" pluginSinceBuild" ))
139
- untilBuild.set(properties(" pluginUntilBuild" ))
140
-
141
- // Get the latest available change notes from the changelog file
142
- changeNotes.set(provider {
143
- changelog.renderItem(
144
- changelog
145
- .getUnreleased()
146
- .withHeader(false )
147
- .withEmptySections(false ),
148
- Changelog .OutputType .HTML
149
- )
150
- })
151
- }
152
-
153
- runPluginVerifier {
154
- ideVersions.set(properties(" pluginVerifierIdeVersions" ).split(' ,' ).map { it.trim() }.toList())
155
- }
156
-
157
- buildSearchableOptions {
158
- enabled = false
159
- }
160
-
161
- // Configure UI tests plugin
162
- // Read more: https://github.com/JetBrains/intellij-ui-test-robot
163
- runIdeForUiTests {
164
- systemProperty(" robot-server.port" , " 8082" )
165
- systemProperty(" ide.mac.message.dialogs.as.sheets" , " false" )
166
- systemProperty(" jb.privacy.policy.text" , " <!--999.999-->" )
167
- systemProperty(" jb.consents.confirmation.enabled" , " false" )
168
- }
169
-
170
- // runIde {
171
- // jvmArgs = properties("jvmArgs").split("")
172
- // systemProperty("jb.service.configuration.url", properties("salesUrl"))
173
- // }
174
-
175
- signPlugin {
176
- certificateChain.set(System .getenv(" CERTIFICATE_CHAIN" ))
177
- privateKey.set(System .getenv(" PRIVATE_KEY" ))
178
- password.set(System .getenv(" PRIVATE_KEY_PASSWORD" ))
179
- }
180
-
181
- publishPlugin {
182
- // dependsOn("patchChangelog")
183
- token.set(System .getenv(" INTELLIJ_PUBLISH_TOKEN" ) ? : file(" ./publishToken" ).readText().trim())
184
- channels.set(listOf (properties(" pluginVersion" ).split(' -' ).getOrElse(1 ) { " default" }.split(' .' ).first()))
185
- }
186
-
187
203
register(" markdownToHtml" ) {
188
204
val input = File (" ./docs/CHANGELOG.md" )
189
205
File (" ./docs/CHANGELOG.html" ).run {
190
- writeText(org.jetbrains.changelog. markdownToHTML(input.readText()))
206
+ writeText(markdownToHTML(input.readText()))
191
207
}
192
208
}
193
209
}
0 commit comments