-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: use worker processes for node-gyp rebuilds (#1080)
* perf: use worker processes for node-gyp rebuilds * refactor: use lib not src in test * build: try parelel * fix: use unique dev dir when not sequential * ...
- Loading branch information
1 parent
509c8eb
commit 8e4c73b
Showing
18 changed files
with
110 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import NodeGypRunner from 'node-gyp'; | ||
import { promisify } from 'util'; | ||
|
||
process.on('message', async ({ | ||
nodeGypArgs, | ||
devDir, | ||
extraNodeGypArgs, | ||
}) => { | ||
const nodeGyp = NodeGypRunner(); | ||
nodeGyp.parseArgv(nodeGypArgs); | ||
nodeGyp.devDir = devDir; | ||
let command = nodeGyp.todo.shift(); | ||
try { | ||
while (command) { | ||
if (command.name === 'configure') { | ||
command.args = command.args.filter((arg: string) => !extraNodeGypArgs.includes(arg)); | ||
} else if (command.name === 'build' && process.platform === 'win32') { | ||
// This is disgusting but it prevents node-gyp from destroying our MSBuild arguments | ||
command.args.map = (fn: (arg: string) => string) => { | ||
return Array.prototype.map.call(command.args, (arg: string) => { | ||
if (arg.startsWith('/p:')) return arg; | ||
return fn(arg); | ||
}); | ||
} | ||
} | ||
await promisify(nodeGyp.commands[command.name])(command.args); | ||
command = nodeGyp.todo.shift(); | ||
} | ||
process.exit(0); | ||
} catch (err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.