build: fix `generate_gn_filenames_json.py` (#42389)

build: fix generate_gn_filenames_json.py
This commit is contained in:
Shelley Vohr 2024-06-10 10:34:36 -05:00 коммит произвёл GitHub
Родитель c6845b0afc
Коммит 92db4f0b8a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 63 добавлений и 32 удалений

Просмотреть файл

@ -1256,10 +1256,10 @@ index 0000000000000000000000000000000000000000..af9cbada10203b387fb9732b346583b1
+} +}
diff --git a/filenames.json b/filenames.json diff --git a/filenames.json b/filenames.json
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..1a9cba024f1762b0dfe31da92213b51e112101ec index 0000000000000000000000000000000000000000..fd42e2a5e6163ff70db0f716d2f9a32f13cdf668
--- /dev/null --- /dev/null
+++ b/filenames.json +++ b/filenames.json
@@ -0,0 +1,739 @@ @@ -0,0 +1,734 @@
+// This file is automatically generated by generate_gn_filenames_json.py +// This file is automatically generated by generate_gn_filenames_json.py
+// DO NOT EDIT +// DO NOT EDIT
+{ +{
@ -1292,7 +1292,7 @@ index 0000000000000000000000000000000000000000..1a9cba024f1762b0dfe31da92213b51e
+ ] + ]
+ }, + },
+ { + {
+ "dest_dir": "include/node//", + "dest_dir": "include/node/./",
+ "files": [ + "files": [
+ "//v8/include/v8-array-buffer.h", + "//v8/include/v8-array-buffer.h",
+ "//v8/include/v8-callbacks.h", + "//v8/include/v8-callbacks.h",
@ -1346,11 +1346,12 @@ index 0000000000000000000000000000000000000000..1a9cba024f1762b0dfe31da92213b51e
+ "//v8/include/v8-wasm.h", + "//v8/include/v8-wasm.h",
+ "//v8/include/v8-weak-callback-info.h", + "//v8/include/v8-weak-callback-info.h",
+ "//v8/include/v8.h", + "//v8/include/v8.h",
+ "//v8/include/v8config.h" + "//v8/include/v8config.h",
+ "deps/uv/include/uv.h"
+ ] + ]
+ }, + },
+ { + {
+ "dest_dir": "include/node//libplatform/", + "dest_dir": "include/node/libplatform/",
+ "files": [ + "files": [
+ "//v8/include/libplatform/libplatform-export.h", + "//v8/include/libplatform/libplatform-export.h",
+ "//v8/include/libplatform/libplatform.h", + "//v8/include/libplatform/libplatform.h",
@ -1358,7 +1359,7 @@ index 0000000000000000000000000000000000000000..1a9cba024f1762b0dfe31da92213b51e
+ ] + ]
+ }, + },
+ { + {
+ "dest_dir": "include/node//cppgc/", + "dest_dir": "include/node/cppgc/",
+ "files": [ + "files": [
+ "//v8/include/cppgc/allocation.h", + "//v8/include/cppgc/allocation.h",
+ "//v8/include/cppgc/common.h", + "//v8/include/cppgc/common.h",
@ -1391,7 +1392,7 @@ index 0000000000000000000000000000000000000000..1a9cba024f1762b0dfe31da92213b51e
+ ] + ]
+ }, + },
+ { + {
+ "dest_dir": "include/node//cppgc/internal/", + "dest_dir": "include/node/cppgc/internal/",
+ "files": [ + "files": [
+ "//v8/include/cppgc/internal/api-constants.h", + "//v8/include/cppgc/internal/api-constants.h",
+ "//v8/include/cppgc/internal/atomic-entry-flag.h", + "//v8/include/cppgc/internal/atomic-entry-flag.h",
@ -1410,13 +1411,7 @@ index 0000000000000000000000000000000000000000..1a9cba024f1762b0dfe31da92213b51e
+ ] + ]
+ }, + },
+ { + {
+ "dest_dir": "include/node//", + "dest_dir": "include/node/uv/",
+ "files": [
+ "deps/uv/include/uv.h"
+ ]
+ },
+ {
+ "dest_dir": "include/node//uv/",
+ "files": [ + "files": [
+ "deps/uv/include/uv/aix.h", + "deps/uv/include/uv/aix.h",
+ "deps/uv/include/uv/bsd.h", + "deps/uv/include/uv/bsd.h",
@ -1891,7 +1886,7 @@ index 0000000000000000000000000000000000000000..1a9cba024f1762b0dfe31da92213b51e
+ "src/dataqueue/queue.h", + "src/dataqueue/queue.h",
+ "src/debug_utils.h", + "src/debug_utils.h",
+ "src/debug_utils-inl.h", + "src/debug_utils-inl.h",
+ "src/embeded_data.h", + "src/embedded_data.h",
+ "src/encoding_binding.h", + "src/encoding_binding.h",
+ "src/env_properties.h", + "src/env_properties.h",
+ "src/env.h", + "src/env.h",
@ -2243,10 +2238,10 @@ index 75a7f3dd89e096d13ad7d70ed29d301cd56315b5..9a20a275fbe5df9f384b7b1d1d26806e
// bootstrap scripts, whose source are bundled into the binary as static data. // bootstrap scripts, whose source are bundled into the binary as static data.
diff --git a/tools/generate_gn_filenames_json.py b/tools/generate_gn_filenames_json.py diff --git a/tools/generate_gn_filenames_json.py b/tools/generate_gn_filenames_json.py
new file mode 100755 new file mode 100755
index 0000000000000000000000000000000000000000..7848ddb1841b6d4f36e9376c73564eb4ff6d7c08 index 0000000000000000000000000000000000000000..37c16859003e61636fe2f1a4040b1e904c472d0b
--- /dev/null --- /dev/null
+++ b/tools/generate_gn_filenames_json.py +++ b/tools/generate_gn_filenames_json.py
@@ -0,0 +1,90 @@ @@ -0,0 +1,117 @@
+#!/usr/bin/env python3 +#!/usr/bin/env python3
+import json +import json
+import os +import os
@ -2276,6 +2271,14 @@ index 0000000000000000000000000000000000000000..7848ddb1841b6d4f36e9376c73564eb4
+// DO NOT EDIT +// DO NOT EDIT
+'''.lstrip() +'''.lstrip()
+ +
+SRC_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..'))
+
+def get_out_dir():
+ out_dir = 'Testing'
+ override = os.environ.get('ELECTRON_OUT_DIR')
+ if override is not None:
+ out_dir = override
+ return os.path.join(SRC_DIR, 'out', out_dir)
+ +
+if __name__ == '__main__': +if __name__ == '__main__':
+ node_root_dir = os.path.dirname(os.path.dirname(__file__)) + node_root_dir = os.path.dirname(os.path.dirname(__file__))
@ -2294,18 +2297,25 @@ index 0000000000000000000000000000000000000000..7848ddb1841b6d4f36e9376c73564eb4
+ } + }
+ +
+ def filter_v8_files(files): + def filter_v8_files(files):
+ if any(f.startswith('deps/v8/') for f in files): + v8_files = [f for f in files if f.startswith('deps/v8/')]
+ files = [f.replace('deps/v8/', '../../v8/', 1) if f.endswith('js') else f.replace('deps/v8/', '//v8/') for f in files] + other_files = [f for f in files if not f.startswith('deps/v8/')]
+ +
+ if any(f == '<@(node_builtin_shareable_builtins)' for f in files): + for i, f in enumerate(v8_files):
+ files.remove('<@(node_builtin_shareable_builtins)') + if not f.startswith('deps/v8/tools'):
+ if f.endswith('js'):
+ v8_files[i] = f.replace('deps/v8/', '../../v8/', 1)
+ else:
+ v8_files[i] = f.replace('deps/v8/', '//v8/')
+
+ if any(f == '<@(node_builtin_shareable_builtins)' for f in other_files):
+ other_files.remove('<@(node_builtin_shareable_builtins)')
+ shared_builtins = ['deps/cjs-module-lexer/lexer.js', 'deps/cjs-module-lexer/dist/lexer.js', 'deps/undici/undici.js'] + shared_builtins = ['deps/cjs-module-lexer/lexer.js', 'deps/cjs-module-lexer/dist/lexer.js', 'deps/undici/undici.js']
+ files.extend(shared_builtins) + other_files.extend(shared_builtins)
+ +
+ return files + return v8_files + other_files
+ +
+ def filter_fs_files(files): + def filter_fs_files(files):
+ return [f for f in files if f.startswith('lib/internal/fs/')] + ['lib/fs.js'] + return [f for f in files if f.startswith('lib/internal/fs/')] + ['lib/fs.js'] + ['lib/fs/promises.js']
+ +
+ lib_files = SearchFiles('lib', 'js') + lib_files = SearchFiles('lib', 'js')
+ out['library_files'] = filter_v8_files(lib_files) + out['library_files'] = filter_v8_files(lib_files)
@ -2322,17 +2332,29 @@ index 0000000000000000000000000000000000000000..7848ddb1841b6d4f36e9376c73564eb4
+ out['node_sources'] += filter_v8_files(blocklisted_sources) + out['node_sources'] += filter_v8_files(blocklisted_sources)
+ +
+ out['headers'] = [] + out['headers'] = []
+ def add_headers(files, dest_dir): + def add_headers(options, files, dest_dir):
+ if 'src/node.h' in files: + if 'src/node.h' in files:
+ files = [f for f in files if f.endswith('.h') and f != 'src/node_version.h'] + files = [f for f in files if f.endswith('.h') and f != 'src/node_version.h']
+ elif any(f.startswith('../../v8/') for f in files): + elif any(f.startswith('../../v8/') for f in files):
+ files = [f.replace('../../v8/', '//v8/', 1) for f in files] + files = [f.replace('../../v8/', '//v8/', 1) for f in files]
+ if files: + if files:
+ hs = {'files': sorted(files), 'dest_dir': dest_dir} + dir_index = next((i for i, d in enumerate(out['headers']) if d['dest_dir'] == dest_dir), -1)
+ out['headers'].append(hs) + if (dir_index != -1):
+ out['headers'][dir_index]['files'] += sorted(files)
+ else:
+ hs = {'files': sorted(files), 'dest_dir': dest_dir}
+ out['headers'].append(hs)
+ +
+ install.variables = {'node_shared_libuv': 'false'} + config_gypi_path = os.path.join(get_out_dir(), 'gen', 'config.gypi')
+ install.headers(add_headers) + root_gen_dir = os.path.join(node_root_dir, 'out', 'Release', 'gen')
+
+ options = install.parse_options(['install', '--v8-dir', '../../v8', '--config-gypi-path', config_gypi_path, '--headers-only'])
+ options.variables['node_use_openssl'] = 'false'
+ options.variables['node_shared_libuv'] = 'false'
+ # We generate zlib headers in Electron's BUILD.gn.
+ options.variables['node_shared_zlib'] = ''
+
+ install.headers(options, add_headers)
+ with open(os.path.join(node_root_dir, 'filenames.json'), 'w') as f: + with open(os.path.join(node_root_dir, 'filenames.json'), 'w') as f:
+ f.write(FILENAMES_JSON_HEADER) + f.write(FILENAMES_JSON_HEADER)
+ f.write(json.dumps(out, sort_keys=True, indent=2, separators=(',', ': '))) + f.write(json.dumps(out, sort_keys=True, indent=2, separators=(',', ': ')))
@ -2363,18 +2385,27 @@ index 0000000000000000000000000000000000000000..9be3ac447f9a4dde23fefc26e0b922b4
+ transformed_f.write(transformed_contents) + transformed_f.write(transformed_contents)
+ +
diff --git a/tools/install.py b/tools/install.py diff --git a/tools/install.py b/tools/install.py
index b132c7bf26c02886a7ab341a1973bf449744ba0f..171b383a4b6c2528d11dd5f89a6837fd071bcf4b 100755 index b132c7bf26c02886a7ab341a1973bf449744ba0f..757e3e60a7be01fac55c5fbb010dbbae00b1bfca 100755
--- a/tools/install.py --- a/tools/install.py
+++ b/tools/install.py +++ b/tools/install.py
@@ -284,6 +284,7 @@ def headers(options, action): @@ -264,6 +264,7 @@ def headers(options, action):
'include/v8-forward.h',
'include/v8-function-callback.h',
'include/v8-function.h',
+ 'include/v8-handle-base.h',
'include/v8-initialization.h',
'include/v8-internal.h',
'include/v8-isolate.h',
@@ -284,6 +285,8 @@ def headers(options, action):
'include/v8-promise.h', 'include/v8-promise.h',
'include/v8-proxy.h', 'include/v8-proxy.h',
'include/v8-regexp.h', 'include/v8-regexp.h',
+ "include/v8-sandbox.h", + "include/v8-sandbox.h",
+ "include/v8-source-location.h",
'include/v8-script.h', 'include/v8-script.h',
'include/v8-snapshot.h', 'include/v8-snapshot.h',
'include/v8-statistics.h', 'include/v8-statistics.h',
@@ -390,7 +391,7 @@ def parse_options(args): @@ -390,7 +393,7 @@ def parse_options(args):
parser.add_argument('--build-dir', help='the location of built binaries', parser.add_argument('--build-dir', help='the location of built binaries',
default='out/Release') default='out/Release')
parser.add_argument('--v8-dir', help='the location of V8', parser.add_argument('--v8-dir', help='the location of V8',