Skip to content

Commit 9c9b153

Browse files
andreafalzettiroboquat
authored andcommitted
feat(gateway-plugin): allow spearate builds for stable and latest
1 parent 53c1a1f commit 9c9b153

File tree

16 files changed

+227
-32
lines changed

16 files changed

+227
-32
lines changed

.github/workflows/jetbrains-update-plugin-platform.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ jobs:
2020
pluginName: JetBrains Gateway Plugin
2121
pluginId: gateway-plugin
2222
xpath: "(/html/body/table[preceding::h2/text()='com.jetbrains.gateway'][1]/tbody/tr/td[contains(text(),'-CUSTOM-SNAPSHOT') and starts-with(text(),'MAJOR_VERSION_PLACEHOLDER') and not(contains(text(),'-NIGHTLY'))]/text())[1]"
23-
gradlePropertiesPath: components/ide/jetbrains/gateway-plugin/gradle.properties
23+
gradlePropertiesPath: components/ide/jetbrains/gateway-plugin/gradle-latest.properties
2424
secrets:
2525
slackWebhook: ${{ secrets.IDE_SLACK_WEBHOOK }}

.gitpod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ tasks:
5252
read -r -p "Press enter to continue Java gradle task"
5353
fi
5454
leeway exec --package components/supervisor-api/java:lib --package components/gitpod-protocol/java:lib -- ./gradlew build
55-
leeway exec --package components/ide/jetbrains/backend-plugin:plugin-latest --package components/ide/jetbrains/gateway-plugin:publish --parallel -- ./gradlew buildPlugin
55+
leeway exec --package components/ide/jetbrains/backend-plugin:plugin-latest --package components/ide/jetbrains/gateway-plugin:publish-latest --parallel -- ./gradlew buildPlugin
5656
- name: TypeScript
5757
before: scripts/branch-namespace.sh
5858
init: yarn --network-timeout 100000 && yarn build

components/BUILD.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ packages:
9898
- components/local-app-api/typescript-grpcweb:publish
9999
- components/supervisor-api/typescript-grpc:publish
100100
- components/supervisor-api/typescript-grpcweb:publish
101-
- components/ide/jetbrains/gateway-plugin:publish
101+
- components/ide/jetbrains/gateway-plugin:publish-stable
102+
- components/ide/jetbrains/gateway-plugin:publish-latest
102103
- components/public-api/typescript:publish
103104
- name: all-apps
104105
type: generic
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.gradle
22
.idea
33
build
4-
bin
4+
bin
5+
gradle-local.properties
Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
packages:
2-
- name: publish
2+
- name: publish-stable
33
type: generic
44
deps:
55
- components/gitpod-protocol/java:lib
66
srcs:
77
- "gradle.properties"
8+
- "gradle-stable.properties"
89
- "gradle/wrapper/*"
910
- "gradlew"
10-
- "src/*"
11+
- "src/main/kotlin/*"
12+
- "src/main/resources/*"
13+
- "src/main/resources-stable/*"
1114
- "*.kts"
1215
- "*.md"
1316
env:
@@ -17,4 +20,26 @@ packages:
1720
- jbMarketplacePublishTrigger
1821
config:
1922
commands:
20-
- [ "./gradlew", "-PpluginVersion=0.0.1-${version}", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "buildFromLeeway" ]
23+
- [ "./gradlew", "-PpluginVersion=0.0.1-${version}", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "-PenvironmentName=stable", "buildFromLeeway" ]
24+
- name: publish-latest
25+
type: generic
26+
deps:
27+
- components/gitpod-protocol/java:lib
28+
srcs:
29+
- "gradle.properties"
30+
- "gradle-latest.properties"
31+
- "gradle/wrapper/*"
32+
- "gradlew"
33+
- "src/main/kotlin/*"
34+
- "src/main/resources/*"
35+
- "src/main/resources-latest/*"
36+
- "*.kts"
37+
- "*.md"
38+
env:
39+
- JAVA_HOME=/home/gitpod/.sdkman/candidates/java/current
40+
- DO_PUBLISH=${publishToJBMarketplace}
41+
argdeps:
42+
- jbMarketplacePublishTrigger
43+
config:
44+
commands:
45+
- [ "./gradlew", "-PpluginVersion=0.0.1-${version}", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "-PenvironmentName=latest", "buildFromLeeway" ]

components/ide/jetbrains/gateway-plugin/build.gradle.kts

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,40 @@ plugins {
1212
// Java support
1313
id("java")
1414
// Kotlin support - check the latest version at https://plugins.gradle.org/plugin/org.jetbrains.kotlin.jvm
15-
id("org.jetbrains.kotlin.jvm") version "1.7.0"
15+
id("org.jetbrains.kotlin.jvm") version "1.7.20"
1616
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
17-
id("org.jetbrains.intellij") version "1.7.0"
17+
id("org.jetbrains.intellij") version "1.9.0"
1818
// gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
1919
id("org.jetbrains.changelog") version "1.1.2"
2020
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
2121
id("io.gitlab.arturbosch.detekt") version "1.17.1"
2222
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
2323
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
24+
// Gradle Properties Plugin - read more: https://github.com/stevesaliman/gradle-properties-plugin
25+
id("net.saliman.properties") version "1.5.2"
2426
}
2527

2628
group = properties("pluginGroup")
27-
version = properties("pluginVersion")
29+
val environmentName = properties("environmentName")
30+
var pluginVersion = properties("pluginVersion")
31+
32+
if (!environmentName.isNullOrBlank()) {
33+
pluginVersion += "-" + environmentName
34+
}
35+
36+
project(":") {
37+
kotlin {
38+
var excludedPackage = "stable"
39+
if (environmentName == excludedPackage) excludedPackage = "latest"
40+
sourceSets["main"].kotlin.exclude("io/gitpod/jetbrains/gateway/${excludedPackage}/**")
41+
}
42+
43+
sourceSets {
44+
main {
45+
resources.srcDirs("src/main/resources-${environmentName}")
46+
}
47+
}
48+
}
2849

2950
// Configure project's dependencies
3051
repositories {
@@ -59,7 +80,7 @@ intellij {
5980
// Configure gradle-changelog-plugin plugin.
6081
// Read more: https://github.com/JetBrains/gradle-changelog-plugin
6182
changelog {
62-
version = properties("pluginVersion")
83+
version = pluginVersion
6384
groups = emptyList()
6485
}
6586

@@ -77,26 +98,31 @@ detekt {
7798
}
7899

79100
tasks {
101+
// JetBrains Gateway 2022.3+ requires Source Compatibility set to 17.
80102
// Set the compatibility versions to 1.8
81103
withType<JavaCompile> {
82-
sourceCompatibility = "11"
83-
targetCompatibility = "11"
104+
sourceCompatibility = "17"
105+
targetCompatibility = "17"
84106
}
85107
withType<KotlinCompile> {
86-
kotlinOptions.jvmTarget = "11"
108+
kotlinOptions.jvmTarget = "17"
87109
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=enable")
88110
}
89111

90112
withType<Detekt> {
91-
jvmTarget = "11"
113+
jvmTarget = "17"
114+
}
115+
116+
buildSearchableOptions {
117+
enabled = false
92118
}
93119

94120
test {
95121
useJUnitPlatform()
96122
}
97123

98124
patchPluginXml {
99-
version.set(properties("pluginVersion"))
125+
version.set(pluginVersion)
100126
sinceBuild.set(properties("pluginSinceBuild"))
101127
untilBuild.set(properties("pluginUntilBuild"))
102128

@@ -128,7 +154,7 @@ tasks {
128154
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
129155
var pluginChannel: String? = System.getenv("JB_GATEWAY_GITPOD_PLUGIN_CHANNEL")
130156
if (pluginChannel.isNullOrBlank()) {
131-
pluginChannel = if (properties("pluginVersion").matches(".+-main\\..+".toRegex())) {
157+
pluginChannel = if (pluginVersion.contains("-main.")) {
132158
"Nightly"
133159
} else {
134160
"Dev"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
2+
# for insight into build numbers and IntelliJ Platform versions.
3+
pluginSinceBuild=223.4884.79
4+
pluginUntilBuild=223.*
5+
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
6+
# See https://jb.gg/intellij-platform-builds-list for available build versions.
7+
pluginVerifierIdeVersions=2022.3
8+
# Version from "com.jetbrains.gateway" which can be found at https://www.jetbrains.com/intellij-repository/snapshots
9+
platformVersion=223.4884.79-CUSTOM-SNAPSHOT
10+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
2+
# for insight into build numbers and IntelliJ Platform versions.
3+
pluginSinceBuild=222.4167.26
4+
pluginUntilBuild=222.*
5+
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
6+
# See https://jb.gg/intellij-platform-builds-list for available build versions.
7+
pluginVerifierIdeVersions=2022.2
8+
# Version from "com.jetbrains.gateway" which can be found at https://www.jetbrains.com/intellij-repository/snapshots
9+
platformVersion=222.4345.14-CUSTOM-SNAPSHOT
10+

components/ide/jetbrains/gateway-plugin/gradle.properties

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
1+
# Supported environments: stable, latest (via https://github.com/stevesaliman/gradle-properties-plugin)
2+
environmentName=latest
13
# IntelliJ Platform Artifacts Repositories
24
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
35
pluginGroup=io.gitpod.jetbrains
46
pluginName=gitpod-gateway
57
# It is overriden by CI during the build.
68
pluginVersion=0.0.1
7-
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
8-
# for insight into build numbers and IntelliJ Platform versions.
9-
pluginSinceBuild=222.4167.26
10-
pluginUntilBuild=222.*
11-
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
12-
# See https://jb.gg/intellij-platform-builds-list for available build versions.
13-
pluginVerifierIdeVersions=2022.2
149
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-type
1510
platformType=GW
16-
# Version from "com.jetbrains.gateway" which can be found at https://www.jetbrains.com/intellij-repository/snapshots
17-
platformVersion=222.4345.14-CUSTOM-SNAPSHOT
1811
platformDownloadSources=true
1912
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
2013
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22

components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/GitpodConnector.kt renamed to components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/latest/GitpodConnector.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22
// Licensed under the GNU Affero General Public License (AGPL).
33
// See License-AGPL.txt in the project root for license information.
44

5-
package io.gitpod.jetbrains.gateway
5+
package io.gitpod.jetbrains.gateway.latest
66

7+
import com.intellij.ide.BrowserUtil
8+
import com.intellij.ui.components.ActionLink
79
import com.jetbrains.gateway.api.GatewayConnector
810
import com.jetbrains.gateway.api.GatewayConnectorView
911
import com.jetbrains.gateway.api.GatewayRecentConnections
1012
import com.jetbrains.rd.util.lifetime.Lifetime
13+
import io.gitpod.jetbrains.gateway.GitpodRecentConnections
1114
import io.gitpod.jetbrains.icons.GitpodIcons
1215
import java.awt.Component
1316
import javax.swing.Icon
1417
import javax.swing.JComponent
15-
import com.intellij.ui.components.ActionLink
16-
import com.intellij.ide.BrowserUtil
1718

1819
class GitpodConnector : GatewayConnector {
1920
override val icon: Icon
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright (c) 2022 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+
package io.gitpod.jetbrains.gateway.latest
6+
7+
import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreenUIManager
8+
import com.intellij.ui.dsl.builder.BottomGap
9+
import com.intellij.ui.dsl.builder.panel
10+
import com.intellij.ui.dsl.gridLayout.HorizontalAlign
11+
import com.intellij.ui.dsl.gridLayout.VerticalAlign
12+
import com.jetbrains.gateway.api.GatewayConnectorView
13+
import com.jetbrains.gateway.api.GatewayUI
14+
import com.jetbrains.rd.util.lifetime.Lifetime
15+
import io.gitpod.jetbrains.gateway.GitpodWorkspacesView
16+
17+
class GitpodConnectorView(
18+
lifetime: Lifetime
19+
) : GatewayConnectorView {
20+
21+
private val workspaces = GitpodWorkspacesView(lifetime)
22+
23+
override val component = panel {
24+
row {
25+
resizableRow()
26+
cell(workspaces.component)
27+
.resizableColumn()
28+
.horizontalAlign(HorizontalAlign.FILL)
29+
.verticalAlign(VerticalAlign.FILL)
30+
cell()
31+
}
32+
row {
33+
panel {
34+
verticalAlign(VerticalAlign.BOTTOM)
35+
separator(WelcomeScreenUIManager.getSeparatorColor())
36+
indent {
37+
row {
38+
button("Back") {
39+
GatewayUI.getInstance().reset()
40+
}
41+
}
42+
}
43+
}
44+
}.bottomGap(BottomGap.SMALL)
45+
}.apply {
46+
this.background = WelcomeScreenUIManager.getMainAssociatedComponentBackground()
47+
}
48+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Copyright (c) 2022 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+
package io.gitpod.jetbrains.gateway.stable
6+
7+
import com.jetbrains.gateway.api.GatewayConnector
8+
import com.jetbrains.gateway.api.GatewayConnectorView
9+
import com.jetbrains.gateway.api.GatewayRecentConnections
10+
import com.jetbrains.rd.util.lifetime.Lifetime
11+
import io.gitpod.jetbrains.icons.GitpodIcons
12+
import java.awt.Component
13+
import javax.swing.Icon
14+
import javax.swing.JComponent
15+
import com.intellij.ui.components.ActionLink
16+
import com.intellij.ide.BrowserUtil
17+
import io.gitpod.jetbrains.gateway.GitpodRecentConnections
18+
19+
class GitpodConnector : GatewayConnector {
20+
override val icon: Icon
21+
get() = GitpodIcons.Logo
22+
23+
override fun createView(lifetime: Lifetime): GatewayConnectorView {
24+
return GitpodConnectorView(lifetime)
25+
}
26+
27+
override fun getActionText(): String {
28+
return "Connect to Gitpod"
29+
}
30+
31+
override fun getDescription(): String? {
32+
return "Connect to Gitpod workspaces"
33+
}
34+
35+
override fun getDocumentationLink(): ActionLink {
36+
val documentationLink = ActionLink("Documentation") {
37+
BrowserUtil.browse("https://www.gitpod.io/docs/ides-and-editors/jetbrains-gateway")
38+
}
39+
documentationLink.setExternalLinkIcon()
40+
return documentationLink
41+
}
42+
43+
override fun getConnectorId(): String = "gitpod.connector"
44+
45+
override fun getRecentConnections(setContentCallback: (Component) -> Unit): GatewayRecentConnections? {
46+
return GitpodRecentConnections()
47+
}
48+
49+
override fun getTitle(): String {
50+
return "Gitpod"
51+
}
52+
53+
override fun getTitleAdornment(): JComponent? {
54+
return null
55+
}
56+
57+
override fun initProcedure() {}
58+
}

components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/GitpodConnectorView.kt renamed to components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/stable/GitpodConnectorView.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the GNU Affero General Public License (AGPL).
33
// See License-AGPL.txt in the project root for license information.
44

5-
package io.gitpod.jetbrains.gateway
5+
package io.gitpod.jetbrains.gateway.stable
66

77
import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreenUIManager
88
import com.intellij.ui.dsl.builder.BottomGap
@@ -12,6 +12,7 @@ import com.intellij.ui.dsl.gridLayout.VerticalAlign
1212
import com.jetbrains.gateway.api.GatewayConnectorView
1313
import com.jetbrains.gateway.api.GatewayUI
1414
import com.jetbrains.rd.util.lifetime.Lifetime
15+
import io.gitpod.jetbrains.gateway.GitpodWorkspacesView
1516

1617
class GitpodConnectorView(
1718
lifetime: Lifetime
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!--
2+
Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
Licensed under the GNU Affero General Public License (AGPL).
4+
See License-AGPL.txt in the project root for license information.
5+
-->
6+
<idea-plugin>
7+
<extensions defaultExtensionNs="com.jetbrains">
8+
<gatewayConnector implementation="io.gitpod.jetbrains.gateway.latest.GitpodConnector"/>
9+
</extensions>
10+
</idea-plugin>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!--
2+
Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
Licensed under the GNU Affero General Public License (AGPL).
4+
See License-AGPL.txt in the project root for license information.
5+
-->
6+
<idea-plugin>
7+
<extensions defaultExtensionNs="com.jetbrains">
8+
<gatewayConnector implementation="io.gitpod.jetbrains.gateway.stable.GitpodConnector"/>
9+
</extensions>
10+
</idea-plugin>

0 commit comments

Comments
 (0)