PT #165890357: Adopt exploded LS jar for all eclipse LSs

This commit is contained in:
BoykoAlex
2019-05-10 13:51:06 -04:00
parent e1c3124e65
commit c29b1043f8
15 changed files with 175 additions and 103 deletions

View File

@@ -75,7 +75,17 @@
</dependency-resolution>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<filesets>
<fileset>
<directory>servers</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>

View File

@@ -12,18 +12,12 @@ 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.nio.file.Paths;
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;
/**
@@ -34,47 +28,12 @@ public class SpringBootLanguageServer extends STS4LanguageServerProcessStreamCon
public SpringBootLanguageServer() {
super(SPRING_BOOT_SERVER);
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());
StringBuilder configLocation = new StringBuilder(languageServerRoot);
configLocation.append("BOOT-INF" + File.separator + "classes");
configLocation.append(File.separator);
configLocation.append("application.properties");
command.add("-Dspring.config.location=file:" + configLocation.toString());
command.add("org.springframework.ide.vscode.boot.app.BootLanguagServerBootApp");
setCommands(command.build());
}
catch (Exception e) {
// error
e.printStackTrace();
}
initExplodedJarCommand(
Paths.get("servers", "spring-boot-language-server"),
"org.springframework.ide.vscode.boot.app.BootLanguagServerBootApp",
"application.properties",
getJVMArgs()
);
setWorkingDirectory(getWorkingDirLocation());
}
@@ -82,7 +41,6 @@ public class SpringBootLanguageServer extends STS4LanguageServerProcessStreamCon
private List<String> getJVMArgs() {
List<String> args = new ArrayList<>();
args.add("-Dsts.lsp.client=eclipse");
args.add("-Dlsp.completions.indentation.enable=true");
args.add("-Xmx1024m");
args.add("-noverify");
@@ -105,7 +63,7 @@ public class SpringBootLanguageServer extends STS4LanguageServerProcessStreamCon
}
}
private JRE getJRE() {
protected JRE getJRE() {
try {
return JRE.findJRE(true);
} catch (MissingJDKException e) {