1
1
import org.jetbrains.changelog.Changelog
2
2
import org.jetbrains.changelog.markdownToHTML
3
3
import org.jetbrains.intellij.platform.gradle.Constants.Constraints
4
+ import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
4
5
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
6
+ import org.jetbrains.intellij.platform.gradle.tasks.PrepareSandboxTask
5
7
import java.net.URI
6
8
import java.net.http.HttpClient
7
9
import java.net.http.HttpRequest
@@ -29,7 +31,7 @@ kotlin {
29
31
// Configure project's dependencies
30
32
repositories {
31
33
mavenCentral()
32
-
34
+
33
35
// IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
34
36
intellijPlatform {
35
37
defaultRepositories()
@@ -41,39 +43,19 @@ dependencies {
41
43
compileOnly(libs.kotlinxSerialization)
42
44
testImplementation(kotlin(" test" ))
43
45
testImplementation(libs.junit)
44
-
46
+
45
47
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
46
48
intellijPlatform {
47
49
create(
48
50
providers.gradleProperty(" platformType" ),
49
51
providers.gradleProperty(" platformVersion" ),
50
52
useInstaller = false
51
53
)
52
-
54
+
53
55
// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
54
56
bundledPlugins(providers.gradleProperty(" platformBundledPlugins" ).map { it.split(' ,' ) })
55
-
56
- // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
57
- // plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
58
-
59
- val platformPlugins = ArrayList <String >()
60
- // val localLsp4ij = file("../lsp4ij.old/build/idea-sandbox/plugins/LSP4IJ").absoluteFile
61
- // if (localLsp4ij.isDirectory) {
62
- // // In case Gradle fails to build because it can't find some missing jar, try deleting
63
- // // ~/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/unzipped.com.jetbrains.plugins/com.redhat.devtools.lsp4ij*
64
- // localPlugin(localLsp4ij.toString())
65
- // } else {
66
- // // When running on CI or when there's no local lsp4ij
67
- // val latestLsp4ijNightlyVersion = fetchLatestLsp4ijNightlyVersion()
68
- // platformPlugins.add("com.redhat.devtools.lsp4ij:$latestLsp4ijNightlyVersion@nightly")
69
- // }
70
-
71
- platformPlugins.add(" com.redhat.devtools.lsp4ij:0.9.0" )
72
- // Uses `platformPlugins` property from the gradle.properties file.
73
- platformPlugins.addAll(providers.gradleProperty(" platformPlugins" ).map { it.split(' ,' ).map(String ::trim).filter(String ::isNotEmpty) }.get())
74
-
75
- plugins(platformPlugins)
76
-
57
+ plugins(providers.gradleProperty(" platformPlugins" ).map { it.split(' ,' ) })
58
+
77
59
pluginVerifier()
78
60
zipSigner()
79
61
testFramework(TestFrameworkType .Platform )
@@ -85,20 +67,20 @@ intellijPlatform {
85
67
pluginConfiguration {
86
68
name = providers.gradleProperty(" pluginName" )
87
69
version = providers.gradleProperty(" pluginVersion" )
88
-
70
+
89
71
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
90
72
description = providers.fileContents(layout.projectDirectory.file(" README.md" )).asText.map {
91
73
val start = " <!-- Plugin description -->"
92
74
val end = " <!-- Plugin description end -->"
93
-
75
+
94
76
with (it.lines()) {
95
77
if (! containsAll(listOf (start, end))) {
96
78
throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
97
79
}
98
80
subList(indexOf(start) + 1 , indexOf(end)).joinToString(" \n " ).let (::markdownToHTML)
99
81
}
100
82
}
101
-
83
+
102
84
val changelog = project.changelog // local variable for configuration cache compatibility
103
85
// Get the latest available change notes from the changelog file
104
86
changeNotes = providers.gradleProperty(" pluginVersion" ).map { pluginVersion ->
@@ -111,19 +93,19 @@ intellijPlatform {
111
93
)
112
94
}
113
95
}
114
-
96
+
115
97
ideaVersion {
116
98
sinceBuild = providers.gradleProperty(" pluginSinceBuild" )
117
99
untilBuild = providers.gradleProperty(" pluginUntilBuild" )
118
100
}
119
101
}
120
-
102
+
121
103
signing {
122
104
certificateChain = providers.environmentVariable(" CERTIFICATE_CHAIN" )
123
105
privateKey = providers.environmentVariable(" PRIVATE_KEY" )
124
106
password = providers.environmentVariable(" PRIVATE_KEY_PASSWORD" )
125
107
}
126
-
108
+
127
109
publishing {
128
110
token = providers.environmentVariable(" PUBLISH_TOKEN" )
129
111
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
@@ -132,7 +114,7 @@ intellijPlatform {
132
114
channels = providers.gradleProperty(" pluginVersion" )
133
115
.map { listOf (it.substringAfter(' -' , " " ).substringBefore(' .' ).ifEmpty { " default" }) }
134
116
}
135
-
117
+
136
118
pluginVerification {
137
119
ides {
138
120
recommended()
@@ -158,6 +140,15 @@ kover {
158
140
}
159
141
}
160
142
143
+ val prepareSandboxConfig: PrepareSandboxTask .() -> Unit = {
144
+ from(" .." ) {
145
+ include(" package.json" , " language-configuration.json" , " syntaxes/**/*" , " bundled/**/*" )
146
+ exclude(" **/bin" )
147
+ exclude(" **/__pycache__" )
148
+ into(" robotcode4ij/data" )
149
+ }
150
+ }
151
+
161
152
tasks {
162
153
runIde {
163
154
// From https://app.slack.com/client/T5P9YATH9/C5U8BM1MK
@@ -166,25 +157,20 @@ tasks {
166
157
// systemProperty("terminal.new.ui", "false")
167
158
// systemProperty("ide.tree.painter.compact.default", "true")
168
159
}
169
-
160
+
170
161
wrapper {
171
162
gradleVersion = providers.gradleProperty(" gradleVersion" ).get()
172
163
}
173
-
164
+
174
165
publishPlugin {
175
166
dependsOn(patchChangelog)
176
167
}
177
- prepareSandbox {
178
- from(" .." ) {
179
- include(" package.json" , " language-configuration.json" , " syntaxes/**/*" , " bundled/**/*" )
180
-
181
- exclude(" **/bin" )
182
- exclude(" **/__pycache__" )
183
- into(" robotcode4ij/data" )
184
- }
185
- }
168
+
169
+ prepareSandbox(prepareSandboxConfig)
186
170
}
187
171
172
+
173
+
188
174
// Configure UI tests plugin
189
175
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
190
176
val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
@@ -198,12 +184,26 @@ val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
198
184
)
199
185
}
200
186
}
201
-
187
+
188
+ prepareSandboxTask(prepareSandboxConfig)
189
+
202
190
plugins {
203
191
robotServerPlugin(Constraints .LATEST_VERSION )
204
192
}
205
193
}
206
194
195
+ val runIdePyCharmProf by intellijPlatformTesting.runIde.registering {
196
+ type = IntelliJPlatformType .PyCharmProfessional
197
+
198
+ prepareSandboxTask(prepareSandboxConfig)
199
+ }
200
+
201
+ val runIdeIntellijIdeaC by intellijPlatformTesting.runIde.registering {
202
+ type = IntelliJPlatformType .IntellijIdeaCommunity
203
+
204
+ prepareSandboxTask(prepareSandboxConfig)
205
+ }
206
+
207
207
fun fetchLatestLsp4ijNightlyVersion (): String {
208
208
val client = HttpClient .newBuilder().build();
209
209
var onlineVersion = " "
@@ -220,10 +220,10 @@ fun fetchLatestLsp4ijNightlyVersion(): String {
220
220
onlineVersion = matcher.group(1 )
221
221
println (" Latest approved nightly build: $onlineVersion " )
222
222
}
223
- } catch (e: Exception ) {
223
+ } catch (e: Exception ) {
224
224
println (" Failed to fetch LSP4IJ nightly build version: ${e.message} " )
225
225
}
226
-
226
+
227
227
val minVersion = " 0.0.1-20231213-012910"
228
228
return if (minVersion < onlineVersion) onlineVersion else minVersion
229
229
}
0 commit comments