From c1fbf872e06a430cf5c9939c0624a024feec994b Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sat, 4 Feb 2017 19:36:37 -0500 Subject: [PATCH 1/2] fix: gyp allows spaces in action names. ninja doesn't --- lib/gyp/generator/ninja/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gyp/generator/ninja/index.js b/lib/gyp/generator/ninja/index.js index d02d360..0961f71 100644 --- a/lib/gyp/generator/ninja/index.js +++ b/lib/gyp/generator/ninja/index.js @@ -395,7 +395,7 @@ Ninja.prototype.actions = function actions() { let res = []; list.forEach((action) => { - const actionRule = action.action_name + '_' + this.index; + const actionRule = action.action_name.replace(/\s/g, '_') + '_' + this.index; const base = gyp.common.cachedRelative(this.configDir, this.srcDir); const toBase = gyp.common.cachedRelative(this.srcDir, this.configDir); From 7e0d7c953cca68c75cc4306bfee25e4d722f7c5d Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sun, 5 Feb 2017 17:48:28 -0500 Subject: [PATCH 2/2] ninja: less rule name suffixes --- lib/gyp/generator/ninja/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/gyp/generator/ninja/index.js b/lib/gyp/generator/ninja/index.js index 0961f71..4d63134 100644 --- a/lib/gyp/generator/ninja/index.js +++ b/lib/gyp/generator/ninja/index.js @@ -395,7 +395,11 @@ Ninja.prototype.actions = function actions() { let res = []; list.forEach((action) => { - const actionRule = action.action_name.replace(/\s/g, '_') + '_' + this.index; + const safeActionName = action.action_name.replace(/\s/g, '_'); + global.action_names = (global.action_names || {}); + const counterRef = global.action_names[safeActionName] || (global.action_names[safeActionName] = {counter: 0}); + const actionRule = safeActionName + (counterRef.counter || ''); + counterRef.counter++; const base = gyp.common.cachedRelative(this.configDir, this.srcDir); const toBase = gyp.common.cachedRelative(this.srcDir, this.configDir); @@ -660,6 +664,7 @@ NinjaMain.prototype.hostVars = function hostVars(target) { main.declare('ld_host', ld); main.declare('ldxx_host', ldxx); main.declare('ar_host', ar); + }; NinjaMain.prototype.rulesAndTargets = function rulesAndTargets() {