-
Notifications
You must be signed in to change notification settings - Fork 4
/
ms-build
executable file
·51 lines (46 loc) · 1.38 KB
/
ms-build
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
#!/usr/bin/env node
const path = require("path");
const Platform = require('./lib/Platform');
const Utils = require("./lib/Utils");
const CommandLine = require('./lib/CommandLine');
const optionDeclarations = [
{
name: "arch",
shortName: "a",
type: "string",
description: "Specify the arch of the Command Prompt for VS. Supported archs: [\"x86\", \"x64\"]."
},
{
name: "help",
shortName: "h",
type: "boolean",
description: "Print help message."
}
];
function printHelp(cmd) {
let output = "";
output += "Syntax: " + cmd + " [-a x86|x64] [msbuild options]\n";
output += "Examples: " + cmd + " -a x64 win/Win32Demo.sln /p:Configuration=Debug /p:Platform=x64\n";
output += CommandLine.printOptions(optionDeclarations);
Utils.log(output);
}
let args = process.argv;
let cmd = "node " + path.basename(args[1]);
args = args.slice(2);
let options = CommandLine.parse(args, optionDeclarations);
if (options.help) {
printHelp(cmd);
if (options.errors.length > 0) {
process.exit(1);
}
return;
}
let platform = Platform.Create("win", false, true);
if (!options.arch) {
options.arch = "x64";
} else {
options.arch = options.arch.toLowerCase();
}
let msBuild = platform.getCommandPath("msbuild", options.arch);
let command = msBuild + " " + options.targets.join(" ");
Utils.exec(command);