Skip to content

Commit 19a30f3

Browse files
bnoordhuisBethGriggs
authored andcommitted
build: fix inspector dependency resolution
It was reported that parallel builds on Windows sometimes error because of missing intermediate files. On closer inspection I noticed that some files are copied from src/ to the intermediate build directory in a way where they don't participate in dependency resolution. Put another way, the build system doesn't know to wait for the copy to complete because we don't tell it to. Fix that by not copying around files but instead making the script that processes them a little smarter about where to find them and where to store the results. PR-URL: #27026 Fixes: #27025 Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Signed-off-by: Beth Griggs <Bethany.Griggs@uk.ibm.com>
1 parent ca7c4f4 commit 19a30f3

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

src/inspector/node_inspector.gypi

+5-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
'variables': {
33
'protocol_tool_path': '../../tools/inspector_protocol',
4-
'node_inspector_path': '../../src/inspector',
54
'node_inspector_generated_sources': [
65
'<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/Forward.h',
76
'<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/Protocol.cpp',
@@ -67,23 +66,14 @@
6766
'<(SHARED_INTERMEDIATE_DIR)',
6867
'<(SHARED_INTERMEDIATE_DIR)/src', # for inspector
6968
],
70-
'copies': [
71-
{
72-
'files': [
73-
'<(node_inspector_path)/node_protocol_config.json',
74-
'<(node_inspector_path)/node_protocol.pdl'
75-
],
76-
'destination': '<(SHARED_INTERMEDIATE_DIR)',
77-
}
78-
],
7969
'actions': [
8070
{
8171
'action_name': 'convert_node_protocol_to_json',
8272
'inputs': [
83-
'<(SHARED_INTERMEDIATE_DIR)/node_protocol.pdl',
73+
'node_protocol.pdl',
8474
],
8575
'outputs': [
86-
'<(SHARED_INTERMEDIATE_DIR)/node_protocol.json',
76+
'<(SHARED_INTERMEDIATE_DIR)/src/node_protocol.json',
8777
],
8878
'action': [
8979
'python',
@@ -95,8 +85,8 @@
9585
{
9686
'action_name': 'node_protocol_generated_sources',
9787
'inputs': [
98-
'<(SHARED_INTERMEDIATE_DIR)/node_protocol_config.json',
99-
'<(SHARED_INTERMEDIATE_DIR)/node_protocol.json',
88+
'node_protocol_config.json',
89+
'<(SHARED_INTERMEDIATE_DIR)/src/node_protocol.json',
10090
'<@(node_protocol_files)',
10191
],
10292
'outputs': [
@@ -108,7 +98,7 @@
10898
'tools/inspector_protocol/code_generator.py',
10999
'--jinja_dir', '<@(protocol_tool_path)/..',
110100
'--output_base', '<(SHARED_INTERMEDIATE_DIR)/src/',
111-
'--config', '<(SHARED_INTERMEDIATE_DIR)/node_protocol_config.json',
101+
'--config', 'src/inspector/node_protocol_config.json',
112102
],
113103
'message': 'Generating node protocol sources from protocol json',
114104
},

tools/inspector_protocol/code_generator.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929

3030
def read_config():
3131
# pylint: disable=W0703
32-
def json_to_object(data, output_base, config_base):
32+
def json_to_object(data, output_base):
3333
def json_object_hook(object_dict):
34-
items = [(k, os.path.join(config_base, v) if k == "path" else v) for (k, v) in object_dict.items()]
34+
items = [(k, os.path.join(output_base, v) if k == "path" else v) for (k, v) in object_dict.items()]
3535
items = [(k, os.path.join(output_base, v) if k == "output" else v) for (k, v) in items]
3636
keys, values = list(zip(*items))
3737
return collections.namedtuple('X', keys)(*values)
@@ -71,7 +71,6 @@ def init_defaults(config_tuple, path, defaults):
7171
if not config_file:
7272
raise Exception("Config file name must be specified")
7373
config_file = config_file.decode('utf8')
74-
config_base = os.path.dirname(config_file)
7574
config_values = arg_options.config_value
7675
if not config_values:
7776
config_values = []
@@ -84,7 +83,7 @@ def init_defaults(config_tuple, path, defaults):
8483
try:
8584
config_json_file = open(config_file, "r")
8685
config_json_string = config_json_file.read()
87-
config_partial = json_to_object(config_json_string, output_base, config_base)
86+
config_partial = json_to_object(config_json_string, output_base)
8887
config_json_file.close()
8988
defaults = {
9089
".use_snake_file_names": False,

0 commit comments

Comments
 (0)