-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Jean Pierre <[email protected]>
- Loading branch information
1 parent
8f643e7
commit 726ab09
Showing
39 changed files
with
2,542 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# Linux start script should use lf | ||
/gradlew text eol=lf | ||
|
||
# These are Windows script files and should use crlf | ||
*.bat text eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Gradle | ||
.gradle | ||
build | ||
|
||
# IntelliJ IDEA | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Gitpod Toolbox Plugin | ||
|
||
To load plugin into the provided Toolbox App, run `./gradlew build copyPlugin` | ||
|
||
or put files in the following directory: | ||
|
||
* Windows: `%LocalAppData%/JetBrains/Toolbox/cache/plugins/plugin-id` | ||
* macOS: `~/Library/Caches/JetBrains/Toolbox/plugins/plugin-id` | ||
* Linux: `~/.local/share/JetBrains/Toolbox/plugins/plugin-id` | ||
|
||
|
||
## How to Develop | ||
|
||
- Open the Toolbox App in debug mode | ||
```bash | ||
TOOLBOX_DEV_DEBUG_SUSPEND=true && open /Applications/JetBrains\ Toolbox.app | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
import com.github.jk1.license.filter.ExcludeTransitiveDependenciesFilter | ||
import com.github.jk1.license.render.JsonReportRenderer | ||
import org.jetbrains.intellij.pluginRepository.PluginRepositoryFactory | ||
import org.jetbrains.kotlin.com.intellij.openapi.util.SystemInfoRt | ||
import java.nio.file.Path | ||
import kotlin.io.path.div | ||
|
||
plugins { | ||
alias(libs.plugins.kotlin) | ||
alias(libs.plugins.serialization) | ||
`java-library` | ||
alias(libs.plugins.dependency.license.report) | ||
id("com.github.johnrengelman.shadow") version "8.1.1" | ||
} | ||
|
||
buildscript { | ||
dependencies { | ||
classpath(libs.marketplace.client) | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
maven("https://packages.jetbrains.team/maven/p/tbx/gateway") | ||
} | ||
|
||
dependencies { | ||
implementation(project(":supervisor-api")) | ||
implementation(project(":gitpod-publicapi")) | ||
|
||
// connect rpc dependencies | ||
implementation("com.squareup.okhttp3:okhttp:4.12.0") | ||
implementation("com.connectrpc:connect-kotlin-okhttp:0.6.0") | ||
implementation("com.connectrpc:connect-kotlin:0.6.0") | ||
// Java specific dependencies. | ||
implementation("com.connectrpc:connect-kotlin-google-java-ext:0.6.0") | ||
implementation("com.google.protobuf:protobuf-java:4.26.0") | ||
// WebSocket | ||
compileOnly("javax.websocket:javax.websocket-api:1.1") | ||
compileOnly("org.eclipse.jetty.websocket:websocket-api:9.4.54.v20240208") | ||
implementation("org.eclipse.jetty.websocket:javax-websocket-client-impl:9.4.54.v20240208") | ||
// RD-Core | ||
implementation("com.jetbrains.rd:rd-core:2024.1.1") | ||
|
||
implementation(libs.gateway.api) | ||
implementation(libs.slf4j) | ||
implementation(libs.bundles.serialization) | ||
implementation(libs.coroutines.core) | ||
implementation(libs.okhttp) | ||
} | ||
|
||
|
||
val pluginId = "io.gitpod.toolbox.gateway" | ||
val pluginVersion = "0.0.1" | ||
|
||
tasks.shadowJar { | ||
archiveBaseName.set(pluginId) | ||
archiveVersion.set(pluginVersion) | ||
|
||
val excludedGroups = listOf( | ||
"com.jetbrains.toolbox.gateway", | ||
"com.jetbrains", | ||
"org.jetbrains", | ||
"com.squareup.okhttp3", | ||
"org.slf4j", | ||
"org.jetbrains.intellij", | ||
"com.squareup.okio", | ||
"kotlin." | ||
) | ||
|
||
val includeGroups = listOf( | ||
"com.jetbrains.rd" | ||
) | ||
|
||
dependencies { | ||
exclude { | ||
excludedGroups.any { group -> | ||
if (includeGroups.any { includeGroup -> it.name.startsWith(includeGroup) }) { | ||
return@any false | ||
} | ||
it.name.startsWith(group) | ||
} | ||
} | ||
} | ||
} | ||
|
||
licenseReport { | ||
renderers = arrayOf(JsonReportRenderer("dependencies.json")) | ||
filters = arrayOf(ExcludeTransitiveDependenciesFilter()) | ||
// jq script to convert to our format: | ||
// `jq '[.dependencies[] | {name: .moduleName, version: .moduleVersion, url: .moduleUrl, license: .moduleLicense, licenseUrl: .moduleLicenseUrl}]' < build/reports/dependency-license/dependencies.json > src/main/resources/dependencies.json` | ||
} | ||
|
||
tasks.compileKotlin { | ||
kotlinOptions.freeCompilerArgs += listOf( | ||
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi", | ||
) | ||
} | ||
|
||
val restartToolbox by tasks.creating { | ||
group = "01.Gitpod" | ||
description = "Restarts the JetBrains Toolbox app." | ||
|
||
doLast { | ||
when { | ||
SystemInfoRt.isMac -> { | ||
exec { | ||
commandLine("sh", "-c", "pkill -f 'JetBrains Toolbox' || true") | ||
} | ||
Thread.sleep(3000) | ||
exec { | ||
commandLine("sh", "-c", "echo debugClean > ~/Library/Logs/JetBrains/Toolbox/toolbox.log") | ||
} | ||
exec { | ||
commandLine("open", "/Applications/JetBrains Toolbox.app") | ||
} | ||
} | ||
else -> { | ||
println("restart Toolbox to make plugin works.") | ||
} | ||
} | ||
} | ||
} | ||
|
||
val copyPlugin by tasks.creating(Sync::class.java) { | ||
group = "01.Gitpod" | ||
|
||
dependsOn(tasks.named("shadowJar")) | ||
from(tasks.named("shadowJar").get().outputs.files) | ||
|
||
val userHome = System.getProperty("user.home").let { Path.of(it) } | ||
val toolboxCachesDir = when { | ||
SystemInfoRt.isWindows -> System.getenv("LOCALAPPDATA")?.let { Path.of(it) } ?: (userHome / "AppData" / "Local") | ||
// currently this is the location that TBA uses on Linux | ||
SystemInfoRt.isLinux -> System.getenv("XDG_DATA_HOME")?.let { Path.of(it) } ?: (userHome / ".local" / "share") | ||
SystemInfoRt.isMac -> userHome / "Library" / "Caches" | ||
else -> error("Unknown os") | ||
} / "JetBrains" / "Toolbox" | ||
|
||
val pluginsDir = when { | ||
SystemInfoRt.isWindows -> toolboxCachesDir / "cache" | ||
SystemInfoRt.isLinux || SystemInfoRt.isMac -> toolboxCachesDir | ||
else -> error("Unknown os") | ||
} / "plugins" | ||
|
||
val targetDir = pluginsDir / pluginId | ||
|
||
from("src/main/resources") { | ||
include("extension.json") | ||
include("dependencies.json") | ||
include("icon.svg") | ||
} | ||
|
||
into(targetDir) | ||
|
||
finalizedBy(restartToolbox) | ||
} | ||
|
||
val pluginZip by tasks.creating(Zip::class) { | ||
dependsOn(tasks.named("shadowJar")) | ||
from(tasks.named("shadowJar").get().outputs.files) | ||
|
||
from("src/main/resources") { | ||
include("extension.json") | ||
include("dependencies.json") | ||
} | ||
from("src/main/resources") { | ||
include("icon.svg") | ||
rename("icon.svg", "pluginIcon.svg") | ||
} | ||
archiveBaseName.set("$pluginId-$pluginVersion") | ||
} | ||
|
||
val uploadPlugin by tasks.creating { | ||
dependsOn(pluginZip) | ||
|
||
doLast { | ||
val instance = PluginRepositoryFactory.create( | ||
"https://plugins.jetbrains.com", | ||
project.property("pluginMarketplaceToken").toString() | ||
) | ||
|
||
// first upload | ||
// instance.uploader.uploadNewPlugin(pluginZip.outputs.files.singleFile, listOf("toolbox", "gateway"), LicenseUrl.APACHE_2_0, ProductFamily.TOOLBOX) | ||
|
||
// subsequent updates | ||
instance.uploader.upload(pluginId, pluginZip.outputs.files.singleFile) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pluginVersion=0.0.1 | ||
environmentName=latest | ||
supervisorApiProjectPath=../../../supervisor-api/java | ||
gitpodPublicApiProjectPath=../../../public-api/java |
29 changes: 29 additions & 0 deletions
29
components/ide/jetbrains/toolbox/gradle/libs.versions.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[versions] | ||
gateway = "2.4.0.30948" | ||
kotlin = "1.9.0" | ||
coroutines = "1.7.3" | ||
serialization = "1.5.0" | ||
okhttp = "4.10.0" | ||
slf4j = "2.0.3" | ||
dependency-license-report = "2.5" | ||
marketplace-client = "2.0.38" | ||
|
||
[libraries] | ||
kotlin-stdlib = { module = "com.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } | ||
gateway-api = { module = "com.jetbrains.toolbox.gateway:gateway-api", version.ref = "gateway" } | ||
coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } | ||
serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialization" } | ||
serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" } | ||
serialization-json-okio = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-okio", version.ref = "serialization" } | ||
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } | ||
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } | ||
|
||
marketplace-client = { module = "org.jetbrains.intellij:plugin-repository-rest-client", version.ref = "marketplace-client" } | ||
|
||
[bundles] | ||
serialization = [ "serialization-core", "serialization-json", "serialization-json-okio" ] | ||
|
||
[plugins] | ||
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } | ||
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } | ||
dependency-license-report = { id = "com.github.jk1.dependency-license-report", version.ref = "dependency-license-report" } |
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
components/ide/jetbrains/toolbox/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.