From 6dd4a077c0fd2bcd964dd6195b80fef66b5e4c3b Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sun, 30 Sep 2018 13:44:55 -0400 Subject: build: reduce chance of unneeded rebuild Run `node_js2c` and `mkssldef` as actions and not as targets makes sure they are run only once, just before processing the rest of `node_lib`. This helps `make` based dependency change detection be more accurate. Add comments with tagrget names for readability. Use `process_outputs_as_sources` for automatic inclution of outputs. PR-URL: https://github.com/nodejs/node/pull/23156 Reviewed-By: Richard Lau Reviewed-By: Joyee Cheung --- node.gyp | 89 +++++++++++++++++++++++++--------------------------------------- 1 file changed, 35 insertions(+), 54 deletions(-) (limited to 'node.gyp') diff --git a/node.gyp b/node.gyp index e1adf8cd12..c7e55c3ddb 100644 --- a/node.gyp +++ b/node.gyp @@ -288,7 +288,7 @@ 'sources': [ 'tools/msvs/genfiles/node_etw_provider.rc' ], - }] + }], ], }], ], @@ -305,16 +305,11 @@ 'product_name': '<(node_core_target_name)-win', }], ], - }, + }, # node_core_target_name { 'target_name': '<(node_lib_target_name)', 'type': '<(node_intermediate_lib_type)', 'product_name': '<(node_core_target_name)', - - 'dependencies': [ - 'node_js2c#host', - ], - 'includes': [ 'node.gypi' ], @@ -460,7 +455,6 @@ '<@(library_files)', # node.gyp is added to the project by default. 'common.gypi', - '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc', ], 'variables': { @@ -618,15 +612,9 @@ 'src/tls_wrap.h' ], }], - ], - }, - { - 'target_name': 'mkssldef', - 'type': 'none', - # TODO(bnoordhuis) Make all platforms export the same list of symbols. - # Teach mkssldef.py to generate linker maps that UNIX linkers understand. - 'conditions': [ [ 'use_openssl_def==1', { + # TODO(bnoordhuis) Make all platforms export the same list of symbols. + # Teach mkssldef.py to generate linker maps that UNIX linkers understand. 'variables': { 'mkssldef_flags': [ # Categories to export. @@ -656,6 +644,7 @@ 'deps/openssl/openssl/util/libssl.num', ], 'outputs': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'], + 'process_outputs_as_sources': 1, 'action': [ 'python', 'tools/mkssldef.py', @@ -668,39 +657,12 @@ ], }], ], - }, - # generate ETW header and resource files - { - 'target_name': 'node_etw', - 'type': 'none', - 'conditions': [ - [ 'node_use_etw=="true"', { - 'actions': [ - { - 'action_name': 'node_etw', - 'inputs': [ 'src/res/node_etw_provider.man' ], - 'outputs': [ - 'tools/msvs/genfiles/node_etw_provider.rc', - 'tools/msvs/genfiles/node_etw_provider.h', - 'tools/msvs/genfiles/node_etw_providerTEMP.BIN', - ], - 'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ] - } - ] - } ] - ] - }, - { - 'target_name': 'node_js2c', - 'type': 'none', - 'toolsets': ['host'], 'actions': [ { 'action_name': 'node_js2c', 'process_outputs_as_sources': 1, 'inputs': [ '<@(library_files)', - './config.gypi', 'tools/check_macros.py' ], 'outputs': [ @@ -718,14 +680,34 @@ }] ], 'action': [ - 'python', - 'tools/js2c.py', + 'python', 'tools/js2c.py', '<@(_outputs)', - '<@(_inputs)', + '<@(_inputs)', 'config.gypi', ], }, ], - }, # end node_js2c + }, # node_lib_target_name + { + # generate ETW header and resource files + 'target_name': 'node_etw', + 'type': 'none', + 'conditions': [ + [ 'node_use_etw=="true"', { + 'actions': [ + { + 'action_name': 'node_etw', + 'inputs': [ 'src/res/node_etw_provider.man' ], + 'outputs': [ + 'tools/msvs/genfiles/node_etw_provider.rc', + 'tools/msvs/genfiles/node_etw_provider.h', + 'tools/msvs/genfiles/node_etw_providerTEMP.BIN', + ], + 'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ] + } + ] + } ] + ] + }, # node_etw { 'target_name': 'node_dtrace_header', 'type': 'none', @@ -753,7 +735,7 @@ ] } ], ] - }, + }, # node_dtrace_header { 'target_name': 'node_dtrace_provider', 'type': 'none', @@ -788,7 +770,7 @@ ], }], ] - }, + }, # node_dtrace_provider { 'target_name': 'node_dtrace_ustack', 'type': 'none', @@ -836,7 +818,7 @@ ] } ], ] - }, + }, # node_dtrace_ustack { 'target_name': 'specialize_node_d', 'type': 'none', @@ -862,7 +844,7 @@ ], } ], ] - }, + }, # specialize_node_d { # When using shared lib to build executable in Windows, in order to avoid # filename collision, the executable name is node-win.exe. Need to rename @@ -890,7 +872,7 @@ ], } ], ] - }, + }, # rename_node_bin_win { 'target_name': 'cctest', 'type': 'executable', @@ -899,7 +881,6 @@ '<(node_lib_target_name)', 'rename_node_bin_win', 'deps/gtest/gtest.gyp:gtest', - 'node_js2c#host', 'node_dtrace_header', 'node_dtrace_ustack', 'node_dtrace_provider', @@ -957,7 +938,7 @@ 'type': 'none', }], ], - } + }, # cctest ], # end targets 'conditions': [ -- cgit v1.2.3