first steps towards deploying and running language servers in exloded format directly from a dir-shaped bundle
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -30,6 +30,7 @@ eclipse-language-servers/**/*.jar
|
||||
# virtual machine crash logs, see https://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
servers/
|
||||
target/
|
||||
bin/
|
||||
*.log
|
||||
|
||||
@@ -32,3 +32,4 @@ Import-Package: com.google.gson;version="2.7.0",
|
||||
org.osgi.framework
|
||||
Bundle-Activator: org.springframework.tooling.boot.ls.BootLanguageServerPlugin
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Eclipse-BundleShape: dir
|
||||
|
||||
@@ -18,8 +18,8 @@ mean the Content.</p>
|
||||
<h3>Third Party Content</h3>
|
||||
<p>
|
||||
The exact license information of the contained language server can be found at
|
||||
META-INF/third-party-open-source-licenses.txt (for an overview of used open-source components) and
|
||||
META-INF/third-party-open-source-licenses/
|
||||
servers/spring-boot-language-server/META-INF/third-party-open-source-licenses.txt (for an overview of used open-source components) and
|
||||
servers/spring-boot-language-server/META-INF/third-party-open-source-licenses/
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -15,14 +15,6 @@
|
||||
<version>1.7.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ide.vscode</groupId>
|
||||
<artifactId>spring-boot-language-server</artifactId>
|
||||
<version>1.7.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -31,27 +23,7 @@
|
||||
<version>3.1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.springframework.ide.vscode</groupId>
|
||||
<artifactId>spring-boot-language-server</artifactId>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${project.build.directory}/../servers</outputDirectory>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<overWriteReleases>true</overWriteReleases>
|
||||
<overWriteSnapshots>true</overWriteSnapshots>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<execution>
|
||||
<id>unpack</id>
|
||||
<id>unpack-server</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
@@ -61,11 +33,13 @@
|
||||
<artifactItem>
|
||||
<groupId>org.springframework.ide.vscode</groupId>
|
||||
<artifactId>spring-boot-language-server</artifactId>
|
||||
<!-- <includes>META-INF/third-party-open-source-licenses*</includes> -->
|
||||
<version>1.7.0-SNAPSHOT</version>
|
||||
<overWrite>true</overWrite>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<includes>META-INF/third-party-open-source-licenses.txt,META-INF/third-party-open-source-licenses/**.*</includes>
|
||||
<outputDirectory>${project.build.directory}/../</outputDirectory>
|
||||
<overWriteReleases>true</overWriteReleases>
|
||||
<overWriteSnapshots>true</overWriteSnapshots>
|
||||
<outputDirectory>${project.build.directory}/../servers/spring-boot-language-server</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
@@ -12,11 +12,18 @@ package org.springframework.tooling.boot.ls;
|
||||
|
||||
import static org.springframework.tooling.ls.eclipse.commons.preferences.LanguageServerConsolePreferenceConstants.SPRING_BOOT_SERVER;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.springframework.tooling.ls.eclipse.commons.JRE;
|
||||
import org.springframework.tooling.ls.eclipse.commons.JRE.MissingJDKException;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import org.springframework.tooling.ls.eclipse.commons.STS4LanguageServerProcessStreamConnector;
|
||||
|
||||
/**
|
||||
@@ -26,8 +33,43 @@ public class SpringBootLanguageServer extends STS4LanguageServerProcessStreamCon
|
||||
|
||||
public SpringBootLanguageServer() {
|
||||
super(SPRING_BOOT_SERVER);
|
||||
setCommands(getJRE().jarLaunchCommand(getLanguageServerJARLocation(),
|
||||
getJVMArgs()));
|
||||
|
||||
try {
|
||||
ImmutableList.Builder<String> command = ImmutableList.builder();
|
||||
JRE runtime = getJRE();
|
||||
|
||||
command.add(runtime.getJavaExecutable());
|
||||
command.add("-cp");
|
||||
|
||||
Bundle bundle = Platform.getBundle(getPluginId());
|
||||
File bundleFile = FileLocator.getBundleFile(bundle);
|
||||
|
||||
String bundleRoot = bundleFile.getAbsoluteFile().toString();
|
||||
String languageServerRoot = bundleRoot + File.separator + "servers" + File.separator + "spring-boot-language-server" + File.separator;
|
||||
|
||||
StringBuilder classpath = new StringBuilder(languageServerRoot);
|
||||
classpath.append("BOOT-INF" + File.separator + "classes");
|
||||
classpath.append(File.pathSeparator);
|
||||
classpath.append(languageServerRoot);
|
||||
classpath.append("BOOT-INF" + File.separator + "lib" + File.separator + "*");
|
||||
|
||||
if (runtime.toolsJar != null) {
|
||||
classpath.append(File.pathSeparator);
|
||||
classpath.append(runtime.toolsJar);
|
||||
}
|
||||
|
||||
command.add(classpath.toString());
|
||||
|
||||
command.addAll(getJVMArgs());
|
||||
|
||||
command.add("org.springframework.ide.vscode.boot.app.BootLanguagServerBootApp");
|
||||
setCommands(command.build());
|
||||
}
|
||||
catch (Exception e) {
|
||||
// error
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
setWorkingDirectory(getWorkingDirLocation());
|
||||
}
|
||||
|
||||
@@ -39,6 +81,7 @@ public class SpringBootLanguageServer extends STS4LanguageServerProcessStreamCon
|
||||
args.add("-Dsts.lsp.client=eclipse");
|
||||
args.add("-Dlsp.completions.indentation.enable=true");
|
||||
args.add("-Xmx1024m");
|
||||
args.add("-noverify");
|
||||
|
||||
addCustomJVMArgs(args);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user