nodejs / nodejs/node-gyp

Node-gyp don't allow customizing switches for msbuild

Open
#2,309 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.7k
Forks
1.9k
Avg merge
1d 4h
Merged PRs (30d)
5

Description

  • Node Version: Node v12.16.3
  • Platform: Windows
  • Compiler: msbuild/15.9
  • Module: Doesn't matter

This is a feature request.

MSBuild supports various command line switches to control its compile time behavior.
https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-command-line-reference?view=vs-2019

I need to customize command line switches for MSBuild, and I expect it to be done in a way like:

node-gyp configure build /switchA /switchB ......

However, in node-gyp.js,

this.opts = nopt(this.configDefs, this.shorthands, argv)
this.argv = this.opts.argv.remain.slice()

That means if I run node-gyp configure build /switchA /switchB, this.opts.argv.remain turns out to be ['configure', 'build'] and the switch values are gone.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in node-gyp.js, where nopt parses the command-line arguments and the remaining arguments are assigned to this.argv. Trace how the build command reaches MSBuild and determine how additional switches should be preserved and forwarded. Done means user-provided MSBuild switches survive parsing and control the build as requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
build-system, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.