Skip to content

Commit acee903

Browse files
atduarteroboquat
authored andcommitted
Create intellij-backend-plugin
1 parent 6bf6485 commit acee903

File tree

22 files changed

+720
-33
lines changed

22 files changed

+720
-33
lines changed

.gitpod.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ ports:
3737
onOpen: ignore
3838
tasks:
3939
- name: Java
40-
init: leeway exec --package components/supervisor-api/java:lib --package components/gitpod-protocol/java:lib -- ./gradlew jar
40+
init: |
41+
leeway exec --package components/supervisor-api/java:lib --package components/gitpod-protocol/java:lib -- ./gradlew build
42+
leeway exec --package components/ide/jetbrains/backend-plugin:plugin -- ./gradlew buildPlugin
4143
- name: TypeScript
4244
before: scripts/branch-namespace.sh
4345
init: yarn --network-timeout 100000 && yarn build
@@ -59,3 +61,4 @@ vscode:
5961
- heptio.jsonnet
6062
- timonwong.shellcheck
6163
- vscjava.vscode-java-pack
64+
- fwcd.kotlin

components/BUILD.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ packages:
2020
- components/supervisor-api/typescript-grpcweb:publish
2121
- components/supervisor-api/java:lib
2222
- installer:app
23+
- components/ide/jetbrains/backend-plugin:plugin
2324
- name: docker-versions
2425
type: docker
2526
config:

components/gitpod-protocol/java/BUILD.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ packages:
1212
- JAVA_HOME=/home/gitpod/.sdkman/candidates/java/current
1313
config:
1414
commands:
15-
- ["./gradlew", "jar"]
15+
- ["./gradlew", "build"]

components/gitpod-protocol/java/build.gradle

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

30-
// Set env vars GITHUB_GPR_USERNAME and GITHUB_GPR_TOKEN and run:
31-
// ./gradlew publish
30+
3231
publishing {
33-
repositories {
34-
maven {
35-
name = "GitHubPackages"
36-
url = uri("https://maven.pkg.github.com/gitpod-io/gitpod")
37-
credentials {
38-
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_GPR_USERNAME")
39-
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_GPR_TOKEN")
40-
}
41-
}
42-
}
4332
publications {
44-
gpr(MavenPublication) {
45-
from(components.java)
33+
mavenJava(MavenPublication) {
34+
from components.java
4635
}
47-
}
36+
}
4837
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.gradle
2+
.settings
3+
.vscode
4+
bin
5+
build
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
env:
15+
- JAVA_HOME=/home/gitpod/.sdkman/candidates/java/current
16+
config:
17+
commands:
18+
- ["./gradlew", "-PsupervisorApiProjectPath=components-supervisor-api-java--lib/", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "buildPlugin"]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Jetbrains IDE Backend Plugin
2+
3+
<!-- Plugin description -->
4+
Jetbrains IDE backend plugin to provide support for Gitpod.
5+
6+
When installed in the headless Jetbrains IDE running in a Gitpod workspace, this plugin monitors user activity of the client IntelliJ and sends heartbeats accordingly. Avoiding the workspace timing out.
7+
<!-- Plugin description end -->
8+
9+
**Warning**: Currently, given the challenge of mimicking user activity in a local Jetbrains IDE, there are no automated integration tests testing the functionality of this plugin. Please be particularly careful and manually test your changes.
10+
11+
## Usage
12+
13+
1. Produce the plugin by running `./gradlew buildPlugin`.
14+
2. Unzip `build/distributions/jetbrains-backend-plugin-1.0-SNAPSHOT.zip` to the `plugins/` folder of the headless Jetbrains IDE.
15+
3. Start the headless Jetbrains IDE.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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.kotlin.gradle.tasks.KotlinCompile
7+
8+
fun properties(key: String) = project.findProperty(key).toString()
9+
10+
plugins {
11+
// Java support
12+
id("java")
13+
// Kotlin support
14+
id("org.jetbrains.kotlin.jvm") version "1.5.10"
15+
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
16+
id("org.jetbrains.intellij") version "1.0"
17+
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
18+
id("io.gitlab.arturbosch.detekt") version "1.17.1"
19+
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
20+
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
21+
}
22+
23+
group = properties("pluginGroup")
24+
version = properties("version")
25+
26+
// Configure project's dependencies
27+
repositories {
28+
mavenCentral()
29+
}
30+
31+
dependencies {
32+
implementation(project(":supervisor-api"))
33+
implementation(project(":gitpod-protocol"))
34+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
35+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.5.2")
36+
implementation("io.ktor:ktor-client-core:1.6.3")
37+
implementation("io.ktor:ktor-client-cio:1.6.3")
38+
implementation("io.ktor:ktor-client-jackson:1.6.3")
39+
40+
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.18.1")
41+
42+
testImplementation(kotlin("test"))
43+
}
44+
45+
// Configure gradle-intellij-plugin plugin.
46+
// Read more: https://github.com/JetBrains/gradle-intellij-plugin
47+
intellij {
48+
pluginName.set(properties("pluginName"))
49+
version.set(System.getenv("INTELLIJ_PLUGIN_PLATFORM_VERSION"))
50+
type.set(properties("platformType"))
51+
instrumentCode.set(false)
52+
downloadSources.set(properties("platformDownloadSources").toBoolean())
53+
updateSinceUntilBuild.set(true)
54+
55+
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
56+
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
57+
}
58+
59+
// Configure detekt plugin.
60+
// Read more: https://detekt.github.io/detekt/kotlindsl.html
61+
detekt {
62+
autoCorrect = true
63+
buildUponDefaultConfig = true
64+
65+
reports {
66+
html.enabled = false
67+
xml.enabled = false
68+
txt.enabled = false
69+
}
70+
}
71+
72+
tasks {
73+
withType<JavaCompile> {
74+
sourceCompatibility = "11"
75+
targetCompatibility = "11"
76+
}
77+
withType<KotlinCompile> {
78+
kotlinOptions.jvmTarget = "11"
79+
}
80+
81+
withType<Detekt> {
82+
jvmTarget = "11"
83+
}
84+
85+
test {
86+
useJUnitPlatform()
87+
}
88+
89+
runPluginVerifier {
90+
ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty))
91+
}
92+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version=1.0-SNAPSHOT
2+
3+
# IntelliJ Platform Artifacts Repositories
4+
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
5+
6+
pluginGroup = io.gitpod.ide.jetbrains.backend
7+
pluginName = jetbrains-backend-plugin
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 = IU
19+
platformDownloadSources = true
20+
21+
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
22+
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
23+
platformPlugins =
24+
25+
# Opt-out flag for bundling Kotlin standard library.
26+
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
27+
kotlin.stdlib.default.dependency = false
28+
29+
supervisorApiProjectPath = ../../../supervisor-api/java
30+
gitpodProtocolProjectPath = ../../../gitpod-protocol/java
Binary file not shown.

0 commit comments

Comments
 (0)