-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
57 lines (49 loc) · 1.42 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"use strict";
const gulp = require("gulp");
const decompress = require("gulp-decompress");
const download = require("gulp-download");
const cp = require("child_process");
const glob = require('glob');
const SERVER_HOME = "lsp-java-server";
gulp.task("download-java-server", () => {
const jdt = glob.sync('**/lsp-java-server');
if (jdt.length === 0 || !jdt) {
download(
"http://download.eclipse.org/jdtls/snapshots/jdt-language-server-latest.tar.gz"
)
.pipe(decompress())
.pipe(gulp.dest(`./${SERVER_HOME}`));
} else {
process.stdout.write('jdt-language-server is existed.\n');
}
});
gulp.task("install-py-server", () => {
cp.exec('pyls -h', (err, stdout, stderr) => {
if (err) {
cp.execSync("sudo pip install -i https://pypi.tuna.tsinghua.edu.cn/simple 'python-language-server[all]'", {
stdio: [0, 1, 2],
});
}
process.stdout.write('pyls is existed.\n');
});
});
gulp.task('build_debug_server', () => {
cp.execSync(mvnw() + ' clean package', {
cwd: server_dir,
stdio: [0, 1, 2]
});
gulp.src(server_dir + '/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.*.jar')
.pipe(gulp.dest('./server'));
});
function isWin() {
return /^win/.test(process.platform);
}
function isMac() {
return /^darwin/.test(process.platform);
}
function isLinux() {
return /^linux/.test(process.platform);
}
function mvnw() {
return isWin() ? "mvnw.cmd" : "./mvnw";
}