Skip to content

Commit a803391

Browse files
mustard-mhroboquat
andauthored
Migrate JetBrains Gateway Plugin to 2024.2 (#20074)
* Update Platform Version of JetBrains Gateway Plugin (EAP) to 242.20224-EAP-CANDIDATE-SNAPSHOT * Migrate `latest` platform plugin to `2.0` * Migrate deprecated API * fixup: leeway build * fixup * 1 * 💄 * 1 * Migrate stable version --------- Co-authored-by: Robo Quat <[email protected]>
1 parent 681eb2a commit a803391

File tree

15 files changed

+503
-139
lines changed

15 files changed

+503
-139
lines changed

.idea/gradle.xml

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ide/jetbrains/gateway-plugin/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
build
44
bin
55
gradle-local.properties
6+
.intellijPlatform

components/ide/jetbrains/gateway-plugin/BUILD.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,18 @@ packages:
1717
- publishToJBMarketplace
1818
env:
1919
- DO_PUBLISH=${publishToJBMarketplace}
20+
- SDKMAN_DIR=/home/gitpod/.sdkman
2021
config:
2122
commands:
22-
- [ "./gradlew", "-PpluginVersion=0.0.1-${version}", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "-PenvironmentName=stable", "-Dgradle.user.home=/workspace/.gradle-stable", "-Dplugin.verifier.home.dir=$HOME/.cache/pluginVerifier-stable", "buildFromLeeway" ]
23+
- ["rm", "-rf", "build.gradle.kts"]
24+
- ["mv", "build.gradle-stable.kts", "build.gradle.kts"]
25+
- - bash
26+
- "-c"
27+
- >
28+
echo java=17.0.12.fx-zulu > .sdkmanrc
29+
&& source "$SDKMAN_DIR/bin/sdkman-init.sh"
30+
&& sdk env install
31+
&& ./gradlew "-PpluginVersion=0.0.1-${version}" "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/" "-PenvironmentName=stable" "-Dgradle.user.home=/workspace/.gradle-stable" "-Dplugin.verifier.home.dir=$HOME/.cache/pluginVerifier-stable" "buildFromLeeway"
2332
- name: publish-latest
2433
type: generic
2534
deps:
@@ -38,6 +47,17 @@ packages:
3847
- publishToJBMarketplace
3948
env:
4049
- DO_PUBLISH=${publishToJBMarketplace}
50+
# TODO(hw): remove after `2024.2.*` is stable
51+
- SDKMAN_DIR=/home/gitpod/.sdkman
4152
config:
4253
commands:
43-
- [ "./gradlew", "-PpluginVersion=0.0.1-${version}", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "-PenvironmentName=latest", "-Dgradle.user.home=/workspace/.gradle-latest", "-Dplugin.verifier.home.dir=$HOME/.cache/pluginVerifier-latest", "buildFromLeeway" ]
54+
# TODO(hw): remove after 2024.2.* is stable
55+
- ["rm", "-rf", "build.gradle.kts"]
56+
- ["mv", "build.gradle-latest.kts", "build.gradle.kts"]
57+
- - bash
58+
- "-c"
59+
- >
60+
echo java=21.0.3.fx-zulu > .sdkmanrc
61+
&& source "$SDKMAN_DIR/bin/sdkman-init.sh"
62+
&& sdk env install
63+
&& ./gradlew "-PpluginVersion=0.0.1-${version}" "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/" "-PenvironmentName=latest" "-Dgradle.user.home=/workspace/.gradle-latest" "-Dplugin.verifier.home.dir=$HOME/.cache/pluginVerifier-latest" "buildFromLeeway"
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
// Copyright (c) 2024 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License.AGPL.txt in the project root for license information.
4+
5+
import io.gitlab.arturbosch.detekt.Detekt
6+
import org.jetbrains.changelog.Changelog
7+
import org.jetbrains.changelog.markdownToHTML
8+
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
9+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
10+
11+
fun properties(key: String) = project.findProperty(key).toString()
12+
13+
plugins {
14+
// Java support
15+
id("java")
16+
// Kotlin support - check the latest version at https://plugins.gradle.org/plugin/org.jetbrains.kotlin.jvm
17+
id("org.jetbrains.kotlin.jvm") version "2.0.0"
18+
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
19+
id("org.jetbrains.intellij.platform") version "2.0.0"
20+
// id("org.jetbrains.intellij.platform.migration") version "2.0.0-beta8"
21+
// gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
22+
id("org.jetbrains.changelog") version "1.1.2"
23+
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
24+
id("io.gitlab.arturbosch.detekt") version "1.23.6"
25+
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
26+
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
27+
// Gradle Properties Plugin - read more: https://github.com/stevesaliman/gradle-properties-plugin
28+
id("net.saliman.properties") version "1.5.2"
29+
}
30+
31+
group = properties("pluginGroup")
32+
val environmentName = properties("environmentName")
33+
var pluginVersion = properties("pluginVersion")
34+
35+
if (environmentName.isNotBlank()) {
36+
pluginVersion += "-$environmentName"
37+
}
38+
39+
project(":") {
40+
kotlin {
41+
val excludedPackage = if (environmentName == "latest") "stable" else "latest"
42+
sourceSets["main"].kotlin.exclude("io/gitpod/jetbrains/gateway/${excludedPackage}/**")
43+
}
44+
45+
sourceSets {
46+
main {
47+
resources.srcDirs("src/main/resources-${environmentName}")
48+
}
49+
}
50+
}
51+
52+
repositories {
53+
mavenCentral()
54+
intellijPlatform {
55+
defaultRepositories()
56+
}
57+
}
58+
59+
dependencies {
60+
implementation(project(":gitpod-protocol")) {
61+
artifact {
62+
type = "jar"
63+
}
64+
}
65+
compileOnly("javax.websocket:javax.websocket-api:1.1")
66+
compileOnly("org.eclipse.jetty.websocket:websocket-api:9.4.44.v20210927")
67+
testImplementation(kotlin("test"))
68+
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.18.1")
69+
// https://mvnrepository.com/artifact/org.eclipse.jetty.websocket/javax-websocket-client-impl
70+
implementation("org.eclipse.jetty.websocket:javax-websocket-client-impl:9.4.44.v20210927")
71+
}
72+
73+
dependencies {
74+
intellijPlatform {
75+
// https://www.jetbrains.com/updates/updates.xml
76+
create(IntelliJPlatformType.Gateway, properties("platformVersion"))
77+
// create(IntelliJPlatformType.Gateway)
78+
bundledPlugins(properties("platformBundledPlugins").split(',').map{ it.trim() })
79+
}
80+
}
81+
82+
// Configure gradle-intellij-plugin plugin.
83+
intellijPlatform {
84+
pluginConfiguration {
85+
name = properties("pluginName")
86+
version = pluginVersion
87+
88+
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
89+
val start = "<!-- Plugin description -->"
90+
val end = "<!-- Plugin description end -->"
91+
92+
with(it.lines()) {
93+
if (!containsAll(listOf(start, end))) {
94+
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
95+
}
96+
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
97+
}
98+
}
99+
100+
changeNotes = changelog.getLatest().toHTML()
101+
102+
ideaVersion {
103+
sinceBuild = properties("pluginSinceBuild")
104+
untilBuild = properties("pluginUntilBuild")
105+
}
106+
}
107+
108+
verifyPlugin {
109+
ides {
110+
properties("pluginVerifierIdeVersions").split(',').map(String::trim).forEach { version ->
111+
ide(IntelliJPlatformType.Gateway, version)
112+
}
113+
}
114+
}
115+
116+
publishing {
117+
token = providers.environmentVariable("JB_MARKETPLACE_PUBLISH_TOKEN").getOrElse("")
118+
var pluginChannels = providers.environmentVariable("JB_GATEWAY_GITPOD_PLUGIN_CHANNEL").getOrElse("Dev")
119+
if (pluginChannels.contains("-main-gha.")) {
120+
pluginChannels = "Stable"
121+
}
122+
channels = listOf(pluginChannels)
123+
}
124+
instrumentCode = false
125+
}
126+
127+
changelog {
128+
version = pluginVersion
129+
groups = emptyList()
130+
}
131+
132+
// Configure detekt plugin.
133+
// Read more: https://detekt.github.io/detekt/kotlindsl.html
134+
detekt {
135+
autoCorrect = true
136+
buildUponDefaultConfig = true
137+
}
138+
139+
tasks.withType<Detekt> {
140+
jvmTarget = "21"
141+
}
142+
143+
tasks.withType<KotlinCompile> {
144+
kotlinOptions.jvmTarget = "21"
145+
}
146+
147+
tasks.withType<JavaCompile> {
148+
sourceCompatibility = "21"
149+
targetCompatibility = "21"
150+
}
151+
152+
tasks {
153+
154+
buildSearchableOptions {
155+
enabled = false
156+
}
157+
158+
test {
159+
useJUnitPlatform()
160+
}
161+
162+
register("buildFromLeeway") {
163+
if ("true" == System.getenv("DO_PUBLISH")) {
164+
print("publishing $pluginVersion...")
165+
dependsOn("publishPlugin")
166+
} else {
167+
print("building $pluginVersion...")
168+
dependsOn("buildPlugin")
169+
}
170+
}
171+
}

0 commit comments

Comments
 (0)