Skip to content

Commit 30e875e

Browse files
committed
style
1 parent 90a903e commit 30e875e

3 files changed

Lines changed: 21 additions & 13 deletions

File tree

lib/gyp/generator/ninja/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ Ninja.prototype.actionCmd = function actionCmd(base, toBase, cmds) {
353353
if (this.flavor !== 'win32')
354354
return res;
355355

356-
// TODO(indutny): escape quotes in res
357-
return `${gyp.platform.win.ninjaWrap} powershell -Command ${res.replace(/ & /g, ' ; ')}`;
356+
const wrap = gyp.platform.win.ninjaWrap;
357+
return `${wrap} powershell -Command ${res.replace(/ & /g, ' ; ')}`;
358358
};
359359

360360
Ninja.prototype.copies = function copies() {
@@ -420,7 +420,9 @@ Ninja.prototype.actions = function actions() {
420420
res = res.concat(outputs);
421421

422422
if (action.process_outputs_as_sources === '1') {
423-
this.targetDict.sources = (this.targetDict.sources || []).concat(action.outputs);
423+
let trg = this.targetDict;
424+
trg.sources = trg.sources || [];
425+
trg.sources = trg.sources.concat(action.outputs);
424426
}
425427

426428
this.n.build(actionRule, outputs, inputs, {

lib/gyp/platform/win.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -396,15 +396,17 @@ win.getOSBits = function getOSBits() {
396396

397397
function tryVS7(hostBits, target_arch) {
398398
try {
399-
const psFile = path.join(__dirname, '..', '..', '..', 'tools', 'Get-VSConfig.ps1');
399+
const psFile = path.join(__dirname,
400+
'..', '..', '..', 'tools', 'Get-VSConfig.ps1');
400401
const vsSetupRaw = gyp.bindings.execSync(`powershell ${psFile}`).toString();
401402
if (!vsSetupRaw) return;
402403
const vsSetup = vsSetupRaw.split(/[\r|\n]/g).reduce((s, l) => {
403404
const lParts = l.split(': ');
404405
if (lParts.length > 1) s[lParts[0]] = lParts[1];
405406
return s;
406407
}, {});
407-
const VsDevCmd = path.join(vsSetup.InstallationPath, 'Common7', 'Tools', 'VsDevCmd.bat');
408+
const VsDevCmd = path.join(vsSetup.InstallationPath,
409+
'Common7', 'Tools', 'VsDevCmd.bat');
408410
const argArch = target_arch === 'x64' ? 'amd64' : 'x86';
409411
const argHost = hostBits === 64 ? 'amd64' : 'x86';
410412
return `${VsDevCmd} -arch=${argArch} -host_arch=${argHost} -no_logo`;
@@ -446,7 +448,9 @@ function findOldVcVarsFile(hostBits, target_arch) {
446448
if (hostBits === 64)
447449
vcEnvCmd = '"' + path.join(tools, 'VC', 'vcvarsall.bat') + '" amd64_x86';
448450
else
449-
vcEnvCmd = '"' + path.join(tools, 'Common7', 'Tools', 'vsvars32.bat') + '"';
451+
vcEnvCmd = '"'
452+
+ path.join(tools, 'Common7', 'Tools', 'vsvars32.bat')
453+
+ '"';
450454
} else if (target_arch === 'x64') {
451455
let arg;
452456
if (hostBits === 64)
@@ -463,8 +467,8 @@ function findOldVcVarsFile(hostBits, target_arch) {
463467
win.resolveDevEnvironment = function resolveDevEnvironment(target_arch) {
464468
const hostBits = win.getOSBits();
465469

466-
const vcEnvCmd = tryVS7(hostBits, target_arch)
467-
|| findOldVcVarsFile(hostBits, target_arch);
470+
const vcEnvCmd = tryVS7(hostBits, target_arch) ||
471+
findOldVcVarsFile(hostBits, target_arch);
468472
let lines = [];
469473
try {
470474
lines = gyp.bindings.execSync(`${vcEnvCmd} & set`, {env: {}}).toString()
@@ -481,8 +485,8 @@ win.resolveDevEnvironment = function resolveDevEnvironment(target_arch) {
481485
return env;
482486
};
483487

484-
const IMPORTANT_VARS =
485-
/^include|lib|libpath|path|pathext|systemroot|temp|tmp$/i;
488+
// const IMPORTANT_VARS =
489+
// /^include|lib|libpath|path|pathext|systemroot|temp|tmp$/i;
486490

487491
win.genEnvironment = function genEnvironment(outDir, target_arch) {
488492
const env = win.resolveDevEnvironment(target_arch);

test/platform-win-test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,11 @@ describe('gyp.platform.win', () => {
233233
assert(env, 'didn\'t get ENVIRONMENT :(');
234234
const COMNTOOLS = Object.keys(env).find(k => k.includes('COMNTOOLS'));
235235
assert(COMNTOOLS, 'didn\'t get COMNTOOLS :(');
236-
if (COMNTOOLS === 'VS150COMNTOOLS'){
236+
if (COMNTOOLS === 'VS150COMNTOOLS') {
237237
assert.equal(env['VSCMD_ARG_TGT_ARCH'], 'x64');
238238
assert.equal(env['VisualStudioVersion'], '15.0');
239-
assert(env['__VSCMD_PREINIT_PATH'], 'Last env var should be __VSCMD_PREINIT_PATH');
239+
assert(env['__VSCMD_PREINIT_PATH'],
240+
'Last env var should be __VSCMD_PREINIT_PATH');
240241
}
241242
});
242243

@@ -248,7 +249,8 @@ describe('gyp.platform.win', () => {
248249
if (COMNTOOLS === 'VS150COMNTOOLS') {
249250
assert.equal(env['VSCMD_ARG_TGT_ARCH'], 'x86');
250251
assert.equal(env['VisualStudioVersion'], '15.0');
251-
assert(env['__VSCMD_PREINIT_PATH'], 'Last env var should be __VSCMD_PREINIT_PATH');
252+
assert(env['__VSCMD_PREINIT_PATH'],
253+
'Last env var should be __VSCMD_PREINIT_PATH');
252254
}
253255
});
254256
});

0 commit comments

Comments
 (0)