forked from microsoft/vscode-java-debug
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-vsix-dependencies.js
More file actions
59 lines (52 loc) · 1.87 KB
/
Copy pathinstall-vsix-dependencies.js
File metadata and controls
59 lines (52 loc) · 1.87 KB
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
58
59
#!/usr/bin/env node
const path = require('path');
const shell = require('shelljs');
const glob = require('glob');
// Installs a list of extensions passed on the command line
var version = process.env.CODE_VERSION || '*';
var isInsiders = version === 'insiders';
const testRunFolder = path.join(
'.vscode-test',
isInsiders ? 'insiders' : 'stable'
);
const testRunFolderAbsolute = path.join(process.cwd(), testRunFolder);
const codeExecutives = glob.sync('./.vscode-test/**/bin/code');
const windowsExecutable = codeExecutives[0].replace(/\//g, '\\');
const darwinExecutable = codeExecutives[0] || path.join(
testRunFolderAbsolute,
'Visual Studio Code.app',
'Contents',
'Resources',
'app',
'bin',
'code'
);
const linuxExecutable = codeExecutives[0] || path.join(
testRunFolderAbsolute,
'VSCode-linux-x64',
'bin',
'code'
);
const extensionsDir = path.join(__dirname, '..', 'packages');
const executable =
process.platform === 'darwin'
? darwinExecutable
: process.platform === 'win32' ? windowsExecutable : linuxExecutable;
if (process.platform === 'linux') {
// Somehow the code executable doesn't have +x set on the autobuilds -- set it here
shell.chmod('+x', `${executable}`);
}
// We always invoke this script with 'node install-vsix-dependencies arg'
// so position2 is where the first argument is
for (let arg = 2; arg < process.argv.length; arg++) {
if (process.platform === 'win32') {
// Windows Powershell doesn't like the single quotes around the executable
shell.exec(
`${executable} --extensions-dir ${extensionsDir} --install-extension ${process.argv[arg]}`
);
} else {
shell.exec(
`'${executable}' --extensions-dir ${extensionsDir} --install-extension ${process.argv[arg]}`
);
}
}