Skip to content

Commit 9f47d83

Browse files
committed
[jetbrains] initial gateway plugin
1 parent 6a5a2f5 commit 9f47d83

File tree

21 files changed

+911
-0
lines changed

21 files changed

+911
-0
lines changed

.gitpod.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ tasks:
2929
init: |
3030
leeway exec --package components/supervisor-api/java:lib --package components/gitpod-protocol/java:lib -- ./gradlew build
3131
leeway exec --package components/ide/jetbrains/backend-plugin:plugin -- ./gradlew buildPlugin
32+
leeway exec --package components/ide/jetbrains/gateway-plugin:plugin -- ./gradlew buildPlugin
3233
- name: TypeScript
3334
before: scripts/branch-namespace.sh
3435
init: yarn --network-timeout 100000 && yarn build

components/gitpod-protocol/java/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ java {
2727
withJavadocJar()
2828
}
2929

30+
compileJava {
31+
sourceCompatibility = "11"
32+
targetCompatibility = "11"
33+
}
3034

3135
publishing {
3236
publications {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.gradle
2+
.idea
3+
build
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run Plugin" type="GradleRunConfiguration" factoryName="Gradle">
3+
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
4+
<ExternalSystemSettings>
5+
<option name="executionName" />
6+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
7+
<option name="externalSystemIdString" value="GRADLE" />
8+
<option name="scriptParameters" value="" />
9+
<option name="taskDescriptions">
10+
<list />
11+
</option>
12+
<option name="taskNames">
13+
<list>
14+
<option value="runIde" />
15+
<option value="--args='jetbrains-gateway://connect#gitpod=%7B%22gitpodHost%22%3A%22ak-jb-gateway-plugin.staging.gitpod-dev.com%22%7D'" />
16+
</list>
17+
</option>
18+
<option name="vmOptions" value="" />
19+
</ExternalSystemSettings>
20+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
21+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
22+
<DebugAllEnabled>false</DebugAllEnabled>
23+
<method v="2" />
24+
</configuration>
25+
</component>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run Tests" type="GradleRunConfiguration" factoryName="Gradle">
3+
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
4+
<ExternalSystemSettings>
5+
<option name="executionName" />
6+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
7+
<option name="externalSystemIdString" value="GRADLE" />
8+
<option name="scriptParameters" value="" />
9+
<option name="taskDescriptions">
10+
<list />
11+
</option>
12+
<option name="taskNames">
13+
<list>
14+
<option value="check" />
15+
</list>
16+
</option>
17+
<option name="vmOptions" value="" />
18+
</ExternalSystemSettings>
19+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
20+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
21+
<DebugAllEnabled>false</DebugAllEnabled>
22+
<method v="2" />
23+
</configuration>
24+
</component>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run Verifications" type="GradleRunConfiguration" factoryName="Gradle">
3+
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
4+
<ExternalSystemSettings>
5+
<option name="executionName" />
6+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
7+
<option name="externalSystemIdString" value="GRADLE" />
8+
<option name="scriptParameters" value="" />
9+
<option name="taskDescriptions">
10+
<list />
11+
</option>
12+
<option name="taskNames">
13+
<list>
14+
<option value="runPluginVerifier" />
15+
</list>
16+
</option>
17+
<option name="vmOptions" value="" />
18+
</ExternalSystemSettings>
19+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
20+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
21+
<DebugAllEnabled>false</DebugAllEnabled>
22+
<method v="2">
23+
<option name="Gradle.BeforeRunTask" enabled="true" tasks="clean" externalProjectPath="$PROJECT_DIR$" vmOptions="" scriptParameters="" />
24+
</method>
25+
</configuration>
26+
</component>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
packages:
2+
- name: plugin
3+
type: generic
4+
deps:
5+
- components/supervisor-api/java:lib
6+
- components/gitpod-protocol/java:lib
7+
srcs:
8+
- "**/*.kt"
9+
- "build.gradle.kts"
10+
- "gradle.properties"
11+
- "gradle/wrapper/*"
12+
- "gradlew"
13+
- "settings.gradle.kts"
14+
- "src/main/resources/*"
15+
env:
16+
- JAVA_HOME=/home/gitpod/.sdkman/candidates/java/current
17+
config:
18+
commands:
19+
- ["./gradlew", "-PsupervisorApiProjectPath=components-supervisor-api-java--lib/", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "buildPlugin"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!-- Keep a Changelog guide -> https://keepachangelog.com -->
2+
3+
# intellij-gateway-plugin Changelog
4+
5+
## [Unreleased]
6+
### Added
7+
- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Gitpod Support — IntelliJ Gateway Plugin
2+
3+
<!-- Plugin description -->
4+
IntelliJ gateway plugin to provide support for Gitpod.
5+
6+
When installed in the Jetbrains Gateway running in the users' device, this plugin allows to seamlessly connect to a Gitpod workspace using the server-to-client browser flow.
7+
<!-- Plugin description end -->
8+
9+
## Usage
10+
11+
This project is not yet Gitpodified as testing it requires running the local Gateway app. For now, use IntelliJ idea.
12+
13+
- Run `./gradlew runIde` to start a sandbox Gateway with the plugin installed
14+
- Run `./gradlew check` to run the tests and the static analysis validations
15+
16+
**Note**: Gradle should run with Java 11.
17+
18+
19+
20+
---
21+
Plugin based on the [IntelliJ Platform Plugin Template][template].
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
// Copyright (c) 2021 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.markdownToHTML
7+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
8+
9+
fun properties(key: String) = project.findProperty(key).toString()
10+
11+
plugins {
12+
// Java support
13+
id("java")
14+
// Kotlin support
15+
id("org.jetbrains.kotlin.jvm") version "1.5.10"
16+
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
17+
id("org.jetbrains.intellij") version "1.1.5"
18+
// gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
19+
id("org.jetbrains.changelog") version "1.1.2"
20+
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
21+
id("io.gitlab.arturbosch.detekt") version "1.17.1"
22+
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
23+
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
24+
}
25+
26+
group = properties("pluginGroup")
27+
version = properties("pluginVersion")
28+
29+
// Configure project's dependencies
30+
repositories {
31+
mavenCentral()
32+
}
33+
dependencies {
34+
implementation(project(":supervisor-api")) {
35+
artifact {
36+
type = "jar"
37+
}
38+
}
39+
implementation(project(":gitpod-protocol")) {
40+
artifact {
41+
type = "jar"
42+
}
43+
}
44+
testImplementation(kotlin("test"))
45+
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.18.1")
46+
}
47+
48+
// Configure gradle-intellij-plugin plugin.
49+
// Read more: https://github.com/JetBrains/gradle-intellij-plugin
50+
intellij {
51+
pluginName.set(properties("pluginName"))
52+
version.set(properties("platformVersion"))
53+
type.set(properties("platformType"))
54+
downloadSources.set(properties("platformDownloadSources").toBoolean())
55+
updateSinceUntilBuild.set(true)
56+
instrumentCode.set(false)
57+
58+
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
59+
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
60+
}
61+
62+
// Configure gradle-changelog-plugin plugin.
63+
// Read more: https://github.com/JetBrains/gradle-changelog-plugin
64+
changelog {
65+
version = properties("pluginVersion")
66+
groups = emptyList()
67+
}
68+
69+
// Configure detekt plugin.
70+
// Read more: https://detekt.github.io/detekt/kotlindsl.html
71+
detekt {
72+
autoCorrect = true
73+
buildUponDefaultConfig = true
74+
75+
reports {
76+
html.enabled = false
77+
xml.enabled = false
78+
txt.enabled = false
79+
}
80+
}
81+
82+
tasks {
83+
// Set the compatibility versions to 1.8
84+
withType<JavaCompile> {
85+
sourceCompatibility = "11"
86+
targetCompatibility = "11"
87+
}
88+
withType<KotlinCompile> {
89+
kotlinOptions.jvmTarget = "11"
90+
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=enable")
91+
}
92+
93+
withType<Detekt> {
94+
jvmTarget = "11"
95+
}
96+
97+
test {
98+
useJUnitPlatform()
99+
}
100+
101+
patchPluginXml {
102+
version.set(properties("pluginVersion"))
103+
sinceBuild.set(properties("pluginSinceBuild"))
104+
untilBuild.set(properties("pluginUntilBuild"))
105+
106+
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
107+
pluginDescription.set(
108+
File(projectDir, "README.md").readText().lines().run {
109+
val start = "<!-- Plugin description -->"
110+
val end = "<!-- Plugin description end -->"
111+
112+
if (!containsAll(listOf(start, end))) {
113+
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
114+
}
115+
subList(indexOf(start) + 1, indexOf(end))
116+
}.joinToString("\n").run { markdownToHTML(this) }
117+
)
118+
119+
// Get the latest available change notes from the changelog file
120+
changeNotes.set(provider { changelog.getLatest().toHTML() })
121+
}
122+
123+
runPluginVerifier {
124+
ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty))
125+
}
126+
127+
publishPlugin {
128+
dependsOn("patchChangelog")
129+
token.set(System.getenv("PUBLISH_TOKEN"))
130+
// pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
131+
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
132+
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
133+
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
134+
}
135+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# IntelliJ Platform Artifacts Repositories
2+
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
3+
4+
5+
pluginGroup = io.gitpod.gateway
6+
pluginName = Gitpod Support
7+
pluginVersion = 0.10.1
8+
9+
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
10+
# for insight into build numbers and IntelliJ Platform versions.
11+
pluginSinceBuild = 213
12+
pluginUntilBuild = 213.*
13+
14+
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
15+
# See https://jb.gg/intellij-platform-builds-list for available build versions.
16+
pluginVerifierIdeVersions = 2021.3.1
17+
18+
platformType = GW
19+
platformVersion = 213.6461.21-CUSTOM-SNAPSHOT
20+
platformDownloadSources = true
21+
22+
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
23+
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
24+
platformPlugins =
25+
26+
# Opt-out flag for bundling Kotlin standard library.
27+
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
28+
kotlin.stdlib.default.dependency = false
29+
30+
supervisorApiProjectPath = ../../../supervisor-api/java
31+
gitpodProtocolProjectPath = ../../../gitpod-protocol/java
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)