Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: reduce one level of spawning in node_gyp #12653

Merged
merged 2 commits into from
May 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import nodedownload
# imports in tools/
sys.path.insert(0, os.path.join(root_dir, 'tools'))
import getmoduleversion
from gyp_node import run_gyp

# parse our options
parser = optparse.OptionParser()
Expand Down Expand Up @@ -1380,7 +1381,7 @@ config = '\n'.join(map('='.join, config.iteritems())) + '\n'

write('config.mk', do_not_edit + config)

gyp_args = [sys.executable, 'tools/gyp_node.py', '--no-parallel']
gyp_args = ['--no-parallel']

if options.use_xcode:
gyp_args += ['-f', 'xcode']
Expand All @@ -1399,4 +1400,4 @@ gyp_args += args
if warn.warned:
warn('warnings were emitted in the configure phase')

sys.exit(subprocess.call(gyp_args))
run_gyp(gyp_args)
33 changes: 13 additions & 20 deletions tools/gyp_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,14 @@
output_dir = os.path.join(os.path.abspath(node_root), 'out')

def run_gyp(args):
rc = gyp.main(args)
if rc != 0:
print 'Error running GYP'
sys.exit(rc)

if __name__ == '__main__':
args = sys.argv[1:]

# GYP bug.
# On msvs it will crash if it gets an absolute path.
# On Mac/make it will crash if it doesn't get an absolute path.
if sys.platform == 'win32':
args.append(os.path.join(node_root, 'node.gyp'))
common_fn = os.path.join(node_root, 'common.gypi')
options_fn = os.path.join(node_root, 'config.gypi')
options_fips_fn = os.path.join(node_root, 'config_fips.gypi')
else:
args.append(os.path.join(os.path.abspath(node_root), 'node.gyp'))
common_fn = os.path.join(os.path.abspath(node_root), 'common.gypi')
options_fn = os.path.join(os.path.abspath(node_root), 'config.gypi')
options_fips_fn = os.path.join(os.path.abspath(node_root), 'config_fips.gypi')
a_path = node_root if sys.platform == 'win32' else os.path.abspath(node_root)
args.append(os.path.join(a_path, 'node.gyp'))
common_fn = os.path.join(a_path, 'common.gypi')
options_fn = os.path.join(a_path, 'config.gypi')
options_fips_fn = os.path.join(a_path, 'config_fips.gypi')

if os.path.exists(common_fn):
args.extend(['-I', common_fn])
Expand Down Expand Up @@ -63,5 +50,11 @@ def run_gyp(args):
args.append('-Dlinux_use_bundled_gold=0')
args.append('-Dlinux_use_gold_flags=0')

gyp_args = list(args)
run_gyp(gyp_args)
rc = gyp.main(args)
if rc != 0:
print 'Error running GYP'
sys.exit(rc)


if __name__ == '__main__':
run_gyp(sys.argv[1:])