-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: support vs2022 * feat: build with config.gypi from node headers
- Loading branch information
Showing
10 changed files
with
117 additions
and
37 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
6 changes: 6 additions & 0 deletions
6
node_modules/node-gyp/test/fixtures/nodedir/include/node/config.gypi
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,6 @@ | ||
# Test configuration | ||
{ | ||
'variables': { | ||
'build_with_electron': true | ||
} | ||
} |
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 |
---|---|---|
@@ -1,37 +1,70 @@ | ||
'use strict' | ||
|
||
const path = require('path') | ||
const { test } = require('tap') | ||
const gyp = require('../lib/node-gyp') | ||
const createConfigGypi = require('../lib/create-config-gypi') | ||
const { getCurrentConfigGypi } = createConfigGypi.test | ||
const { parseConfigGypi, getCurrentConfigGypi } = createConfigGypi.test | ||
|
||
test('config.gypi with no options', function (t) { | ||
test('config.gypi with no options', async function (t) { | ||
t.plan(2) | ||
|
||
const prog = gyp() | ||
prog.parseArgv([]) | ||
|
||
const config = getCurrentConfigGypi({ gyp: prog, vsInfo: {} }) | ||
const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} }) | ||
t.equal(config.target_defaults.default_configuration, 'Release') | ||
t.equal(config.variables.target_arch, process.arch) | ||
}) | ||
|
||
test('config.gypi with --debug', function (t) { | ||
test('config.gypi with --debug', async function (t) { | ||
t.plan(1) | ||
|
||
const prog = gyp() | ||
prog.parseArgv(['_', '_', '--debug']) | ||
|
||
const config = getCurrentConfigGypi({ gyp: prog, vsInfo: {} }) | ||
const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} }) | ||
t.equal(config.target_defaults.default_configuration, 'Debug') | ||
}) | ||
|
||
test('config.gypi with custom options', function (t) { | ||
test('config.gypi with custom options', async function (t) { | ||
t.plan(1) | ||
|
||
const prog = gyp() | ||
prog.parseArgv(['_', '_', '--shared-libxml2']) | ||
|
||
const config = getCurrentConfigGypi({ gyp: prog, vsInfo: {} }) | ||
const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} }) | ||
t.equal(config.variables.shared_libxml2, true) | ||
}) | ||
|
||
test('config.gypi with nodedir', async function (t) { | ||
t.plan(1) | ||
|
||
const nodeDir = path.join(__dirname, 'fixtures', 'nodedir') | ||
|
||
const prog = gyp() | ||
prog.parseArgv(['_', '_', `--nodedir=${nodeDir}`]) | ||
|
||
const config = await getCurrentConfigGypi({ gyp: prog, nodeDir, vsInfo: {} }) | ||
t.equal(config.variables.build_with_electron, true) | ||
}) | ||
|
||
test('config.gypi with --force-process-config', async function (t) { | ||
t.plan(1) | ||
|
||
const nodeDir = path.join(__dirname, 'fixtures', 'nodedir') | ||
|
||
const prog = gyp() | ||
prog.parseArgv(['_', '_', '--force-process-config', `--nodedir=${nodeDir}`]) | ||
|
||
const config = await getCurrentConfigGypi({ gyp: prog, nodeDir, vsInfo: {} }) | ||
t.equal(config.variables.build_with_electron, undefined) | ||
}) | ||
|
||
test('config.gypi parsing', function (t) { | ||
t.plan(1) | ||
|
||
const str = "# Some comments\n{'variables': {'multiline': 'A'\n'B'}}" | ||
const config = parseConfigGypi(str) | ||
t.deepEqual(config, { variables: { multiline: 'AB' } }) | ||
}) |
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