Switch vscode-spring-boot to properties launcher
This commit is contained in:
@@ -103,7 +103,10 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>1.4.1.RELEASE</version>
|
||||
<version>2.0.0.RELEASE</version>
|
||||
<configuration>
|
||||
<layout>ZIP</layout>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"prepack": "node ./node_modules/vscode/bin/install && tsc -p ./"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pivotal-tools/jvm-launch-utils": "0.0.9",
|
||||
"@pivotal-tools/jvm-launch-utils": "0.0.10",
|
||||
"portfinder": "^0.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -32,10 +32,9 @@ export interface ActivatorOptions {
|
||||
TRACE?: boolean;
|
||||
extensionId: string;
|
||||
clientOptions: LanguageClientOptions;
|
||||
launcher: (context: VSCode.ExtensionContext) => string;
|
||||
jvmHeap?: string;
|
||||
workspaceOptions?: VSCode.WorkspaceConfiguration;
|
||||
classpath?: (context: VSCode.ExtensionContext, jvm: JVM) => string[];
|
||||
checkjvm?: (context: VSCode.ExtensionContext, jvm: JVM) => any;
|
||||
preferJdk?: boolean;
|
||||
}
|
||||
|
||||
@@ -81,7 +80,7 @@ export function activate(options: ActivatorOptions, context: VSCode.ExtensionCon
|
||||
VSCode.window.showErrorMessage("Error trying to find JVM: "+error);
|
||||
return Promise.reject(error);
|
||||
})
|
||||
.then(jvm => {
|
||||
.then((jvm) => {
|
||||
if (!jvm) {
|
||||
VSCode.window.showErrorMessage("Couldn't locate java in $JAVA_HOME or $PATH");
|
||||
return;
|
||||
@@ -111,7 +110,6 @@ export function activate(options: ActivatorOptions, context: VSCode.ExtensionCon
|
||||
let processLaunchoptions = {
|
||||
cwd: VSCode.workspace.rootPath
|
||||
};
|
||||
let child: ChildProcess.ChildProcess;
|
||||
let logfile = Path.join(tmpdir(), options.extensionId + '-' + Date.now()+'.log');
|
||||
log('Redirecting server logs to ' + logfile);
|
||||
const args = [
|
||||
@@ -119,28 +117,19 @@ export function activate(options: ActivatorOptions, context: VSCode.ExtensionCon
|
||||
'-Dsts.lsp.client=vscode',
|
||||
'-Dsts.log.file=' + logfile
|
||||
];
|
||||
if (options.classpath) {
|
||||
const classpath = options.classpath(context, jvm);
|
||||
if (classpath) {
|
||||
args.push('-cp');
|
||||
args.push(classpath.join(Path.delimiter));
|
||||
}
|
||||
if (options.checkjvm) {
|
||||
options.checkjvm(context, jvm);
|
||||
}
|
||||
const launcher = options.launcher(context);
|
||||
if (launcher.endsWith('.jar')) {
|
||||
args.push('-jar');
|
||||
}
|
||||
args.push(options.launcher(context));
|
||||
if (jvmHeap) {
|
||||
args.unshift("-Xmx"+jvmHeap);
|
||||
}
|
||||
if (DEBUG) {
|
||||
args.unshift(DEBUG_ARG);
|
||||
}
|
||||
log("CMD = " + javaExecutablePath + ' ' + args.join(' '));
|
||||
|
||||
// Start the child java process
|
||||
child = ChildProcess.execFile(javaExecutablePath, args, processLaunchoptions);
|
||||
let launcher = findServerJar(Path.resolve(context.extensionPath, 'jars'));
|
||||
let child = jvm.jarLaunch(launcher, args, processLaunchoptions);
|
||||
child.stdout.on('data', (data) => {
|
||||
log("" + data);
|
||||
});
|
||||
@@ -156,6 +145,21 @@ export function activate(options: ActivatorOptions, context: VSCode.ExtensionCon
|
||||
}
|
||||
}
|
||||
|
||||
function findServerJar(jarsDir) : string {
|
||||
let serverJars = FS.readdirSync(jarsDir).filter(jar =>
|
||||
jar.indexOf('language-server')>=0 &&
|
||||
jar.endsWith(".jar")
|
||||
);
|
||||
if (serverJars.length==0) {
|
||||
throw new Error("Server jar not found in "+jarsDir);
|
||||
}
|
||||
if (serverJars.length>1) {
|
||||
throw new Error("Multiple server jars found in "+jarsDir);
|
||||
}
|
||||
return Path.resolve(jarsDir, serverJars[0]);
|
||||
}
|
||||
|
||||
|
||||
function connectToLS(context: VSCode.ExtensionContext, options: ActivatorOptions): Promise<LanguageClient> {
|
||||
let connectionInfo = {
|
||||
port: 5007
|
||||
|
||||
@@ -1,31 +1,22 @@
|
||||
// A launch configuration that compiles the extension and then opens it inside a new window
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"name": "Launch Extension",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceRoot}"
|
||||
],
|
||||
"sourceMaps": true,
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "npm"
|
||||
},
|
||||
{
|
||||
"name": "Launch Tests",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outDir": "${workspaceRoot}/out/test",
|
||||
"preLaunchTask": "npm"
|
||||
}
|
||||
]
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Extension",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}"
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "npm: watch"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,30 +1,20 @@
|
||||
// Available variables which can be used inside of strings.
|
||||
// ${workspaceRoot}: the root folder of the team
|
||||
// ${file}: the current opened file
|
||||
// ${fileBasename}: the current opened file's basename
|
||||
// ${fileDirname}: the current opened file's dirname
|
||||
// ${fileExtname}: the current opened file's extension
|
||||
// ${cwd}: the current working directory of the spawned process
|
||||
|
||||
// A task runner that calls a custom npm script that compiles the extension.
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
{
|
||||
"version": "0.1.0",
|
||||
|
||||
// we want to run npm
|
||||
"command": "npm",
|
||||
|
||||
// the command is a shell script
|
||||
"isShellCommand": true,
|
||||
|
||||
// show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
|
||||
// we run the custom script "compile" as defined in package.json
|
||||
"args": ["run", "compile"], //, "--loglevel", "silent"],
|
||||
|
||||
// The tsc compiler is started in watching mode
|
||||
"isWatching": true,
|
||||
|
||||
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
|
||||
"problemMatcher": "$tsc-watch"
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch",
|
||||
"problemMatcher": "$tsc-watch",
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -23,19 +23,10 @@ export function activate(context: VSCode.ExtensionContext) {
|
||||
CONNECT_TO_LS: false,
|
||||
extensionId: 'vscode-spring-boot',
|
||||
preferJdk: true,
|
||||
launcher: (context: VSCode.ExtensionContext) => 'org.springframework.boot.loader.JarLauncher',
|
||||
classpath: (context: VSCode.ExtensionContext, jvm: commons.JVM) => {
|
||||
const classpath = [
|
||||
Path.resolve(context.extensionPath, 'jars/language-server.jar')
|
||||
];
|
||||
checkjvm: (context: VSCode.ExtensionContext, jvm: commons.JVM) => {
|
||||
if (!jvm.isJdk()) {
|
||||
VSCode.window.showWarningMessage('JAVA_HOME or PATH environment variable seems to point to a JRE. A JDK is required, hence Boot Hints are unavailable.');
|
||||
}
|
||||
const toolsJar = jvm.getToolsJar();
|
||||
if (toolsJar) {
|
||||
classpath.unshift(toolsJar);
|
||||
}
|
||||
return classpath;
|
||||
},
|
||||
clientOptions: {
|
||||
documentSelector: [ PROPERTIES_LANGUAGE_ID, YAML_LANGUAGE_ID, JAVA_LANGUAGE_ID ],
|
||||
|
||||
@@ -73,9 +73,9 @@
|
||||
"vscode:prepublish": "npm run compile",
|
||||
"compile": "tsc -p ./",
|
||||
"watch": "tsc -watch -p ./",
|
||||
"clean": "rm -fr node_modules out *.vsix package-lock.json",
|
||||
"preinstall": "./scripts/preinstall.sh",
|
||||
"postinstall": "node ./node_modules/vscode/bin/install",
|
||||
"test": "npm run compile && node ./node_modules/vscode/bin/test",
|
||||
"preinstall": "./scripts/preinstall.sh",
|
||||
"vsce-package": "vsce package"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -84,8 +84,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"vsce": "^1.36.1",
|
||||
"typescript": "2.6.1",
|
||||
"@types/node": "^7.0.43",
|
||||
"typescript": "2.7.2",
|
||||
"@types/node": "^9.4.6",
|
||||
"vscode": "^1.1.10"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ curl https://raw.githubusercontent.com/textmate/java.tmbundle/master/Syntaxes/Ja
|
||||
cd ../../headless-services/spring-boot-language-server
|
||||
./build.sh
|
||||
|
||||
rm -fr ${workdir}/jars
|
||||
mkdir -p ${workdir}/jars
|
||||
cp target/*.jar ${workdir}/jars/language-server.jar
|
||||
cp target/*.jar ${workdir}/jars
|
||||
|
||||
|
||||
Reference in New Issue
Block a user