Skip to content

Revert gateway changes #11222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ tasks:
read -r -p "Press enter to continue Java gradle task"
fi
leeway exec --package components/supervisor-api/java:lib --package components/gitpod-protocol/java:lib -- ./gradlew --build-cache build
leeway exec --package components/ide/jetbrains/backend-plugin:plugin-latest --package components/ide/jetbrains/gateway-plugin:publish --parallel -- ./gradlew --build-cache buildPlugin
leeway exec --package components/ide/jetbrains/backend-plugin:plugin --package components/ide/jetbrains/gateway-plugin:publish --parallel -- ./gradlew --build-cache buildPlugin
- name: TypeScript
before: scripts/branch-namespace.sh
init: yarn --network-timeout 100000 && yarn build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,17 @@

package io.gitpod.gitpodprotocol.api;

import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.HttpProxy;
import org.eclipse.jetty.client.Socks4Proxy;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.websocket.jsr356.ClientContainer;
import org.eclipse.lsp4j.jsonrpc.Launcher;
import org.eclipse.lsp4j.jsonrpc.MessageConsumer;
import org.eclipse.lsp4j.jsonrpc.MessageIssueHandler;
import org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler;
import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints;
import org.eclipse.lsp4j.websocket.WebSocketMessageHandler;

import javax.net.ssl.SSLContext;
import javax.websocket.*;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.SocketAddress;
import java.io.IOException;
import java.net.URI;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
Expand Down Expand Up @@ -56,60 +47,10 @@ public GitpodServerConnection listen(
String userAgent,
String clientVersion,
String token
) throws Exception {
return listen(apiUrl, origin, userAgent, clientVersion, token, Collections.emptyList(), null);
}

public GitpodServerConnection listen(
String apiUrl,
String origin,
String userAgent,
String clientVersion,
String token,
List<Proxy> proxies,
SSLContext sslContext
) throws Exception {
) throws DeploymentException, IOException {
String gitpodHost = URI.create(apiUrl).getHost();
HttpClient httpClient;
if (sslContext == null) {
httpClient = new HttpClient();
} else {
SslContextFactory ssl = new SslContextFactory.Client();
ssl.setSslContext(sslContext);
httpClient = new HttpClient(ssl);
}
for (Proxy proxy : proxies) {
if (proxy.type().equals(Proxy.Type.DIRECT)) {
continue;
}
SocketAddress proxyAddress = proxy.address();
if (!(proxyAddress instanceof InetSocketAddress)) {
GitpodServerConnectionImpl.LOG.log(Level.WARNING, gitpodHost + ": unexpected proxy:", proxy);
continue;
}
String hostName = ((InetSocketAddress) proxyAddress).getHostString();
int port = ((InetSocketAddress) proxyAddress).getPort();
if (proxy.type().equals(Proxy.Type.HTTP)) {
httpClient.getProxyConfiguration().getProxies().add(new HttpProxy(hostName, port));
} else if (proxy.type().equals(Proxy.Type.SOCKS)) {
httpClient.getProxyConfiguration().getProxies().add(new Socks4Proxy(hostName, port));
}
}
ClientContainer container = new ClientContainer(httpClient);
// allow clientContainer to own httpClient (for start/stop lifecycle)
container.getClient().addManaged(httpClient);
container.start();

GitpodServerConnectionImpl connection = new GitpodServerConnectionImpl(gitpodHost);
connection.whenComplete((input, exception) -> {
try {
container.stop();
} catch (Throwable t) {
GitpodServerConnectionImpl.LOG.log(Level.WARNING, gitpodHost + ": failed to stop websocket container:", t);
}
});

connection.setSession(container.connectToServer(new Endpoint() {
connection.setSession(ContainerProvider.getWebSocketContainer().connectToServer(new Endpoint() {
@Override
public void onOpen(Session session, EndpointConfig config) {
session.addMessageHandler(new WebSocketMessageHandler(messageReader, jsonHandler, remoteEndpoint));
Expand Down
1 change: 0 additions & 1 deletion components/ide/jetbrains/backend-plugin/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
.vscode
bin
build
gradle-local.properties
27 changes: 3 additions & 24 deletions components/ide/jetbrains/backend-plugin/BUILD.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
packages:
- name: plugin-stable
- name: plugin
type: generic
deps:
- components/supervisor-api/java:lib
Expand All @@ -8,32 +8,11 @@ packages:
- "**/*.kt"
- "build.gradle.kts"
- "gradle.properties"
- "gradle-stable.properties"
- "gradle/wrapper/*"
- "gradlew"
- "settings.gradle.kts"
- "src/main/resources/*"
- "src/main/resources-stable/*"
config:
commands:
- ["./gradlew", "-PsupervisorApiProjectPath=components-supervisor-api-java--lib/", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "-PenvironmentName=stable", "runPluginVerifier"]
- ["./gradlew", "-PsupervisorApiProjectPath=components-supervisor-api-java--lib/", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "-PenvironmentName=stable", "buildPlugin"]
- name: plugin-latest
type: generic
deps:
- components/supervisor-api/java:lib
- components/gitpod-protocol/java:lib
srcs:
- "**/*.kt"
- "build.gradle.kts"
- "gradle.properties"
- "gradle-latest.properties"
- "gradle/wrapper/*"
- "gradlew"
- "settings.gradle.kts"
- "src/main/resources/*"
- "src/main/resources-latest/*"
config:
commands:
- ["./gradlew", "-PsupervisorApiProjectPath=components-supervisor-api-java--lib/", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "-PenvironmentName=latest", "runPluginVerifier"]
- ["./gradlew", "-PsupervisorApiProjectPath=components-supervisor-api-java--lib/", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "-PenvironmentName=latest", "buildPlugin"]
- ["./gradlew", "-PsupervisorApiProjectPath=components-supervisor-api-java--lib/", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "runPluginVerifier"]
- ["./gradlew", "-PsupervisorApiProjectPath=components-supervisor-api-java--lib/", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "buildPlugin"]
24 changes: 3 additions & 21 deletions components/ide/jetbrains/backend-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,19 @@ fun properties(key: String) = project.findProperty(key).toString()
plugins {
// Java support
id("java")
// Kotlin support - check the latest version at https://plugins.gradle.org/plugin/org.jetbrains.kotlin.jvm
id("org.jetbrains.kotlin.jvm") version "1.7.0"
// Kotlin support
id("org.jetbrains.kotlin.jvm") version "1.5.10"
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
id("org.jetbrains.intellij") version "1.6.0"
id("org.jetbrains.intellij") version "1.0"
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
id("io.gitlab.arturbosch.detekt") version "1.17.1"
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
// Gradle Properties Plugin - read more: https://github.com/stevesaliman/gradle-properties-plugin
id("net.saliman.properties") version "1.5.2"
}

group = properties("pluginGroup")
version = properties("version")

val environmentName = properties("environmentName")

project(":") {
kotlin {
var excludedPackage = "stable"
if (environmentName == excludedPackage) excludedPackage = "latest"
sourceSets["main"].kotlin.exclude("io/gitpod/jetbrains/remote/${excludedPackage}/**")
}

sourceSets {
main {
resources.srcDirs("src/main/resources-${environmentName}")
}
}
}

// Configure project's dependencies
repositories {
mavenCentral()
Expand Down

This file was deleted.

This file was deleted.

12 changes: 9 additions & 3 deletions components/ide/jetbrains/backend-plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
version=0.0.1
# Supported environments: stable, latest (via https://github.com/stevesaliman/gradle-properties-plugin)
environmentName=latest
# IntelliJ Platform Artifacts Repositories
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
pluginGroup=io.gitpod.jetbrains
pluginName=gitpod-remote
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-type
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
pluginSinceBuild=213
pluginUntilBuild=221.*
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
# See https://jb.gg/intellij-platform-builds-list for available build versions.
pluginVerifierIdeVersions=2021.3, 2022.1
# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
platformType=IU
platformVersion=221-EAP-SNAPSHOT
platformDownloadSources=true
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the GNU Affero General Public License (AGPL).
// See License-AGPL.txt in the project root for license information.

package io.gitpod.jetbrains.remote.stable
package io.gitpod.jetbrains.remote

import com.intellij.openapi.Disposable
import com.intellij.openapi.application.runInEdt
Expand All @@ -24,7 +24,7 @@ import org.jetbrains.plugins.terminal.TerminalToolWindowFactory
import org.jetbrains.plugins.terminal.TerminalView
import java.util.concurrent.CompletableFuture

@Suppress("UnstableApiUsage", "EXPERIMENTAL_IS_NOT_ENABLED")
@Suppress("UnstableApiUsage", "EXPERIMENTAL_IS_NOT_ENABLED", "OPT_IN_IS_NOT_ENABLED")
@OptIn(DelicateCoroutinesApi::class)
class GitpodTerminalService(private val project: Project) : Disposable {
private val lifetime = Lifetime.Eternal.createNested()
Expand Down
Loading