electron/patches/node/build_add_gn_build_files.patch

1345 lines
46 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Apthorp <nornagon@nornagon.net>
Date: Tue, 26 Feb 2019 17:07:45 -0800
Subject: build: add GN build files
This adds GN build files for Node, so we don't have to build with GYP.
Note that there always GN files in upstream Node in 20/21 branches,
however those files were cherry-picked from main branch and do not
really in 20/21. We have to wait until 22 is released to be able to
build with upstream GN files.
diff --git a/deps/ncrypto/ncrypto.h b/deps/ncrypto/ncrypto.h
index 60bfce3ea8999e8e145aaf8cd14f0fdf21ed9c54..661c996889d0a89c1c38658a0933fcf5e3cdc1b9 100644
--- a/deps/ncrypto/ncrypto.h
+++ b/deps/ncrypto/ncrypto.h
@@ -400,17 +400,21 @@ public:
UNABLE_TO_CHECK_GENERATOR = DH_UNABLE_TO_CHECK_GENERATOR,
NOT_SUITABLE_GENERATOR = DH_NOT_SUITABLE_GENERATOR,
Q_NOT_PRIME = DH_CHECK_Q_NOT_PRIME,
+#ifndef OPENSSL_IS_BORINGSSL
INVALID_Q = DH_CHECK_INVALID_Q_VALUE,
INVALID_J = DH_CHECK_INVALID_J_VALUE,
+#endif
CHECK_FAILED = 512,
};
CheckResult check();
enum class CheckPublicKeyResult {
NONE,
+ #ifndef OPENSSL_IS_BORINGSSL
TOO_SMALL = DH_R_CHECK_PUBKEY_TOO_SMALL,
TOO_LARGE = DH_R_CHECK_PUBKEY_TOO_LARGE,
INVALID = DH_R_CHECK_PUBKEY_INVALID,
+ #endif
CHECK_FAILED = 512,
};
// Check to see if the given public key is suitable for this DH instance.
diff --git a/deps/sqlite/unofficial.gni b/deps/sqlite/unofficial.gni
index ebb3ffcd6d42b4c16b6865a91ccf4428cffe864b..00225afa1fb4205f1e02d9f185aeb97d642b3fd9 100644
--- a/deps/sqlite/unofficial.gni
+++ b/deps/sqlite/unofficial.gni
@@ -18,8 +18,14 @@ template("sqlite_gn_build") {
forward_variables_from(invoker, "*")
public_configs = [ ":sqlite_config" ]
sources = gypi_values.sqlite_sources
+ cflags_c = [
+ "-Wno-implicit-fallthrough",
+ "-Wno-unreachable-code-break",
+ "-Wno-unreachable-code-return",
+ "-Wno-unreachable-code",
+ ]
if (is_win) {
- cflags_c = [
+ cflags_c += [
"-Wno-sign-compare",
"-Wno-unused-but-set-variable",
"-Wno-unused-function",
diff --git a/filenames.json b/filenames.json
new file mode 100644
index 0000000000000000000000000000000000000000..5af3886d8d3d74d31249a4d79030a8373b8dad52
--- /dev/null
+++ b/filenames.json
@@ -0,0 +1,756 @@
+// This file is automatically generated by generate_gn_filenames_json.py
+// DO NOT EDIT
+{
+ "fs_files": [
+ "lib/internal/fs/cp/cp-sync.js",
+ "lib/internal/fs/cp/cp.js",
+ "lib/internal/fs/dir.js",
+ "lib/internal/fs/glob.js",
+ "lib/internal/fs/promises.js",
+ "lib/internal/fs/read/context.js",
+ "lib/internal/fs/recursive_watch.js",
+ "lib/internal/fs/rimraf.js",
+ "lib/internal/fs/streams.js",
+ "lib/internal/fs/sync_write_stream.js",
+ "lib/internal/fs/utils.js",
+ "lib/internal/fs/watchers.js",
+ "lib/fs.js",
+ "lib/fs/promises.js"
+ ],
+ "headers": [
+ {
+ "dest_dir": "include/node/",
+ "files": [
+ "src/js_native_api.h",
+ "src/js_native_api_types.h",
+ "src/node.h",
+ "src/node_api.h",
+ "src/node_api_types.h",
+ "src/node_buffer.h",
+ "src/node_object_wrap.h"
+ ]
+ },
+ {
+ "dest_dir": "include/node/./",
+ "files": [
+ "//v8/include/v8-array-buffer.h",
+ "//v8/include/v8-callbacks.h",
+ "//v8/include/v8-container.h",
+ "//v8/include/v8-context.h",
+ "//v8/include/v8-cppgc.h",
+ "//v8/include/v8-data.h",
+ "//v8/include/v8-date.h",
+ "//v8/include/v8-debug.h",
+ "//v8/include/v8-embedder-heap.h",
+ "//v8/include/v8-embedder-state-scope.h",
+ "//v8/include/v8-exception.h",
+ "//v8/include/v8-extension.h",
+ "//v8/include/v8-external.h",
+ "//v8/include/v8-forward.h",
+ "//v8/include/v8-function-callback.h",
+ "//v8/include/v8-function.h",
+ "//v8/include/v8-handle-base.h",
+ "//v8/include/v8-initialization.h",
+ "//v8/include/v8-internal.h",
+ "//v8/include/v8-isolate.h",
+ "//v8/include/v8-json.h",
+ "//v8/include/v8-local-handle.h",
+ "//v8/include/v8-locker.h",
+ "//v8/include/v8-maybe.h",
+ "//v8/include/v8-memory-span.h",
+ "//v8/include/v8-message.h",
+ "//v8/include/v8-microtask-queue.h",
+ "//v8/include/v8-microtask.h",
+ "//v8/include/v8-object.h",
+ "//v8/include/v8-persistent-handle.h",
+ "//v8/include/v8-platform.h",
+ "//v8/include/v8-primitive-object.h",
+ "//v8/include/v8-primitive.h",
+ "//v8/include/v8-profiler.h",
+ "//v8/include/v8-promise.h",
+ "//v8/include/v8-proxy.h",
+ "//v8/include/v8-regexp.h",
+ "//v8/include/v8-sandbox.h",
+ "//v8/include/v8-script.h",
+ "//v8/include/v8-snapshot.h",
+ "//v8/include/v8-source-location.h",
+ "//v8/include/v8-statistics.h",
+ "//v8/include/v8-template.h",
+ "//v8/include/v8-traced-handle.h",
+ "//v8/include/v8-typed-array.h",
+ "//v8/include/v8-unwinder.h",
+ "//v8/include/v8-value-serializer.h",
+ "//v8/include/v8-value.h",
+ "//v8/include/v8-version.h",
+ "//v8/include/v8-wasm.h",
+ "//v8/include/v8-weak-callback-info.h",
+ "//v8/include/v8.h",
+ "//v8/include/v8config.h",
+ "deps/uv/include/uv.h"
+ ]
+ },
+ {
+ "dest_dir": "include/node/libplatform/",
+ "files": [
+ "//v8/include/libplatform/libplatform-export.h",
+ "//v8/include/libplatform/libplatform.h",
+ "//v8/include/libplatform/v8-tracing.h"
+ ]
+ },
+ {
+ "dest_dir": "include/node/cppgc/",
+ "files": [
+ "//v8/include/cppgc/allocation.h",
+ "//v8/include/cppgc/common.h",
+ "//v8/include/cppgc/cross-thread-persistent.h",
+ "//v8/include/cppgc/custom-space.h",
+ "//v8/include/cppgc/default-platform.h",
+ "//v8/include/cppgc/ephemeron-pair.h",
+ "//v8/include/cppgc/explicit-management.h",
+ "//v8/include/cppgc/garbage-collected.h",
+ "//v8/include/cppgc/heap-consistency.h",
+ "//v8/include/cppgc/heap-handle.h",
+ "//v8/include/cppgc/heap-state.h",
+ "//v8/include/cppgc/heap-statistics.h",
+ "//v8/include/cppgc/heap.h",
+ "//v8/include/cppgc/liveness-broker.h",
+ "//v8/include/cppgc/macros.h",
+ "//v8/include/cppgc/member.h",
+ "//v8/include/cppgc/name-provider.h",
+ "//v8/include/cppgc/object-size-trait.h",
+ "//v8/include/cppgc/persistent.h",
+ "//v8/include/cppgc/platform.h",
+ "//v8/include/cppgc/prefinalizer.h",
+ "//v8/include/cppgc/process-heap-statistics.h",
+ "//v8/include/cppgc/sentinel-pointer.h",
+ "//v8/include/cppgc/source-location.h",
+ "//v8/include/cppgc/testing.h",
+ "//v8/include/cppgc/trace-trait.h",
+ "//v8/include/cppgc/type-traits.h",
+ "//v8/include/cppgc/visitor.h"
+ ]
+ },
+ {
+ "dest_dir": "include/node/cppgc/internal/",
+ "files": [
+ "//v8/include/cppgc/internal/api-constants.h",
+ "//v8/include/cppgc/internal/atomic-entry-flag.h",
+ "//v8/include/cppgc/internal/base-page-handle.h",
+ "//v8/include/cppgc/internal/caged-heap-local-data.h",
+ "//v8/include/cppgc/internal/caged-heap.h",
+ "//v8/include/cppgc/internal/compiler-specific.h",
+ "//v8/include/cppgc/internal/finalizer-trait.h",
+ "//v8/include/cppgc/internal/gc-info.h",
+ "//v8/include/cppgc/internal/logging.h",
+ "//v8/include/cppgc/internal/member-storage.h",
+ "//v8/include/cppgc/internal/name-trait.h",
+ "//v8/include/cppgc/internal/persistent-node.h",
+ "//v8/include/cppgc/internal/pointer-policies.h",
+ "//v8/include/cppgc/internal/write-barrier.h"
+ ]
+ },
+ {
+ "dest_dir": "include/node/uv/",
+ "files": [
+ "deps/uv/include/uv/aix.h",
+ "deps/uv/include/uv/bsd.h",
+ "deps/uv/include/uv/darwin.h",
+ "deps/uv/include/uv/errno.h",
+ "deps/uv/include/uv/linux.h",
+ "deps/uv/include/uv/os390.h",
+ "deps/uv/include/uv/posix.h",
+ "deps/uv/include/uv/sunos.h",
+ "deps/uv/include/uv/threadpool.h",
+ "deps/uv/include/uv/tree.h",
+ "deps/uv/include/uv/unix.h",
+ "deps/uv/include/uv/version.h",
+ "deps/uv/include/uv/win.h"
+ ]
+ }
+ ],
+ "library_files": [
+ "lib/_http_agent.js",
+ "lib/_http_client.js",
+ "lib/_http_common.js",
+ "lib/_http_incoming.js",
+ "lib/_http_outgoing.js",
+ "lib/_http_server.js",
+ "lib/_stream_duplex.js",
+ "lib/_stream_passthrough.js",
+ "lib/_stream_readable.js",
+ "lib/_stream_transform.js",
+ "lib/_stream_wrap.js",
+ "lib/_stream_writable.js",
+ "lib/_tls_common.js",
+ "lib/_tls_wrap.js",
+ "lib/assert.js",
+ "lib/assert/strict.js",
+ "lib/async_hooks.js",
+ "lib/buffer.js",
+ "lib/child_process.js",
+ "lib/cluster.js",
+ "lib/console.js",
+ "lib/constants.js",
+ "lib/crypto.js",
+ "lib/dgram.js",
+ "lib/diagnostics_channel.js",
+ "lib/dns.js",
+ "lib/dns/promises.js",
+ "lib/domain.js",
+ "lib/events.js",
+ "lib/http.js",
+ "lib/http2.js",
+ "lib/https.js",
+ "lib/inspector.js",
+ "lib/inspector/promises.js",
+ "lib/internal/abort_controller.js",
+ "lib/internal/assert.js",
+ "lib/internal/assert/assertion_error.js",
+ "lib/internal/assert/calltracker.js",
+ "lib/internal/assert/utils.js",
+ "lib/internal/async_context_frame.js",
+ "lib/internal/async_hooks.js",
+ "lib/internal/async_local_storage/async_context_frame.js",
+ "lib/internal/async_local_storage/async_hooks.js",
+ "lib/internal/blob.js",
+ "lib/internal/blocklist.js",
+ "lib/internal/bootstrap/node.js",
+ "lib/internal/bootstrap/realm.js",
+ "lib/internal/bootstrap/shadow_realm.js",
+ "lib/internal/bootstrap/switches/does_not_own_process_state.js",
+ "lib/internal/bootstrap/switches/does_own_process_state.js",
+ "lib/internal/bootstrap/switches/is_main_thread.js",
+ "lib/internal/bootstrap/switches/is_not_main_thread.js",
+ "lib/internal/bootstrap/web/exposed-wildcard.js",
+ "lib/internal/bootstrap/web/exposed-window-or-worker.js",
+ "lib/internal/buffer.js",
+ "lib/internal/child_process.js",
+ "lib/internal/child_process/serialization.js",
+ "lib/internal/cli_table.js",
+ "lib/internal/cluster/child.js",
+ "lib/internal/cluster/primary.js",
+ "lib/internal/cluster/round_robin_handle.js",
+ "lib/internal/cluster/shared_handle.js",
+ "lib/internal/cluster/utils.js",
+ "lib/internal/cluster/worker.js",
+ "lib/internal/console/constructor.js",
+ "lib/internal/console/global.js",
+ "lib/internal/constants.js",
+ "lib/internal/crypto/aes.js",
+ "lib/internal/crypto/certificate.js",
+ "lib/internal/crypto/cfrg.js",
+ "lib/internal/crypto/cipher.js",
+ "lib/internal/crypto/diffiehellman.js",
+ "lib/internal/crypto/ec.js",
+ "lib/internal/crypto/hash.js",
+ "lib/internal/crypto/hashnames.js",
+ "lib/internal/crypto/hkdf.js",
+ "lib/internal/crypto/keygen.js",
+ "lib/internal/crypto/keys.js",
+ "lib/internal/crypto/mac.js",
+ "lib/internal/crypto/pbkdf2.js",
+ "lib/internal/crypto/random.js",
+ "lib/internal/crypto/rsa.js",
+ "lib/internal/crypto/scrypt.js",
+ "lib/internal/crypto/sig.js",
+ "lib/internal/crypto/util.js",
+ "lib/internal/crypto/webcrypto.js",
+ "lib/internal/crypto/webidl.js",
+ "lib/internal/crypto/x509.js",
+ "lib/internal/data_url.js",
+ "lib/internal/debugger/inspect.js",
+ "lib/internal/debugger/inspect_client.js",
+ "lib/internal/debugger/inspect_repl.js",
+ "lib/internal/dgram.js",
+ "lib/internal/dns/callback_resolver.js",
+ "lib/internal/dns/promises.js",
+ "lib/internal/dns/utils.js",
+ "lib/internal/encoding.js",
+ "lib/internal/error_serdes.js",
+ "lib/internal/errors.js",
+ "lib/internal/event_target.js",
+ "lib/internal/events/abort_listener.js",
+ "lib/internal/events/symbols.js",
+ "lib/internal/file.js",
+ "lib/internal/fixed_queue.js",
+ "lib/internal/freelist.js",
+ "lib/internal/freeze_intrinsics.js",
+ "lib/internal/heap_utils.js",
+ "lib/internal/histogram.js",
+ "lib/internal/http.js",
+ "lib/internal/http2/compat.js",
+ "lib/internal/http2/core.js",
+ "lib/internal/http2/util.js",
+ "lib/internal/idna.js",
+ "lib/internal/inspector_async_hook.js",
+ "lib/internal/inspector_network_tracking.js",
+ "lib/internal/js_stream_socket.js",
+ "lib/internal/legacy/processbinding.js",
+ "lib/internal/linkedlist.js",
+ "lib/internal/main/check_syntax.js",
+ "lib/internal/main/embedding.js",
+ "lib/internal/main/eval_stdin.js",
+ "lib/internal/main/eval_string.js",
+ "lib/internal/main/inspect.js",
+ "lib/internal/main/mksnapshot.js",
+ "lib/internal/main/print_help.js",
+ "lib/internal/main/prof_process.js",
+ "lib/internal/main/repl.js",
+ "lib/internal/main/run_main_module.js",
+ "lib/internal/main/test_runner.js",
+ "lib/internal/main/watch_mode.js",
+ "lib/internal/main/worker_thread.js",
+ "lib/internal/mime.js",
+ "lib/internal/modules/cjs/loader.js",
+ "lib/internal/modules/esm/assert.js",
+ "lib/internal/modules/esm/create_dynamic_module.js",
+ "lib/internal/modules/esm/fetch_module.js",
+ "lib/internal/modules/esm/formats.js",
+ "lib/internal/modules/esm/get_format.js",
+ "lib/internal/modules/esm/hooks.js",
+ "lib/internal/modules/esm/initialize_import_meta.js",
+ "lib/internal/modules/esm/load.js",
+ "lib/internal/modules/esm/loader.js",
+ "lib/internal/modules/esm/module_job.js",
+ "lib/internal/modules/esm/module_map.js",
+ "lib/internal/modules/esm/resolve.js",
+ "lib/internal/modules/esm/shared_constants.js",
+ "lib/internal/modules/esm/translators.js",
+ "lib/internal/modules/esm/utils.js",
+ "lib/internal/modules/esm/worker.js",
+ "lib/internal/modules/helpers.js",
+ "lib/internal/modules/package_json_reader.js",
+ "lib/internal/modules/run_main.js",
+ "lib/internal/navigator.js",
+ "lib/internal/net.js",
+ "lib/internal/options.js",
+ "lib/internal/per_context/domexception.js",
+ "lib/internal/per_context/messageport.js",
+ "lib/internal/per_context/primordials.js",
+ "lib/internal/perf/event_loop_delay.js",
+ "lib/internal/perf/event_loop_utilization.js",
+ "lib/internal/perf/nodetiming.js",
+ "lib/internal/perf/observe.js",
+ "lib/internal/perf/performance.js",
+ "lib/internal/perf/performance_entry.js",
+ "lib/internal/perf/resource_timing.js",
+ "lib/internal/perf/timerify.js",
+ "lib/internal/perf/usertiming.js",
+ "lib/internal/perf/utils.js",
+ "lib/internal/priority_queue.js",
+ "lib/internal/process/execution.js",
+ "lib/internal/process/finalization.js",
+ "lib/internal/process/per_thread.js",
+ "lib/internal/process/permission.js",
+ "lib/internal/process/pre_execution.js",
+ "lib/internal/process/promises.js",
+ "lib/internal/process/report.js",
+ "lib/internal/process/signal.js",
+ "lib/internal/process/task_queues.js",
+ "lib/internal/process/warning.js",
+ "lib/internal/process/worker_thread_only.js",
+ "lib/internal/promise_hooks.js",
+ "lib/internal/querystring.js",
+ "lib/internal/readline/callbacks.js",
+ "lib/internal/readline/emitKeypressEvents.js",
+ "lib/internal/readline/interface.js",
+ "lib/internal/readline/promises.js",
+ "lib/internal/readline/utils.js",
+ "lib/internal/repl.js",
+ "lib/internal/repl/await.js",
+ "lib/internal/repl/history.js",
+ "lib/internal/repl/utils.js",
+ "lib/internal/socket_list.js",
+ "lib/internal/socketaddress.js",
+ "lib/internal/source_map/prepare_stack_trace.js",
+ "lib/internal/source_map/source_map.js",
+ "lib/internal/source_map/source_map_cache.js",
+ "lib/internal/source_map/source_map_cache_map.js",
+ "lib/internal/stream_base_commons.js",
+ "lib/internal/streams/add-abort-signal.js",
+ "lib/internal/streams/compose.js",
+ "lib/internal/streams/destroy.js",
+ "lib/internal/streams/duplex.js",
+ "lib/internal/streams/duplexify.js",
+ "lib/internal/streams/duplexpair.js",
+ "lib/internal/streams/end-of-stream.js",
+ "lib/internal/streams/from.js",
+ "lib/internal/streams/lazy_transform.js",
+ "lib/internal/streams/legacy.js",
+ "lib/internal/streams/operators.js",
+ "lib/internal/streams/passthrough.js",
+ "lib/internal/streams/pipeline.js",
+ "lib/internal/streams/readable.js",
+ "lib/internal/streams/state.js",
+ "lib/internal/streams/transform.js",
+ "lib/internal/streams/utils.js",
+ "lib/internal/streams/writable.js",
+ "lib/internal/test/binding.js",
+ "lib/internal/test/transfer.js",
+ "lib/internal/test_runner/coverage.js",
+ "lib/internal/test_runner/harness.js",
+ "lib/internal/test_runner/mock/loader.js",
+ "lib/internal/test_runner/mock/mock.js",
+ "lib/internal/test_runner/mock/mock_timers.js",
+ "lib/internal/test_runner/reporter/dot.js",
+ "lib/internal/test_runner/reporter/junit.js",
+ "lib/internal/test_runner/reporter/lcov.js",
+ "lib/internal/test_runner/reporter/spec.js",
+ "lib/internal/test_runner/reporter/tap.js",
+ "lib/internal/test_runner/reporter/utils.js",
+ "lib/internal/test_runner/reporter/v8-serializer.js",
+ "lib/internal/test_runner/runner.js",
+ "lib/internal/test_runner/snapshot.js",
+ "lib/internal/test_runner/test.js",
+ "lib/internal/test_runner/tests_stream.js",
+ "lib/internal/test_runner/utils.js",
+ "lib/internal/timers.js",
+ "lib/internal/tls/secure-context.js",
+ "lib/internal/tls/secure-pair.js",
+ "lib/internal/trace_events_async_hooks.js",
+ "lib/internal/tty.js",
+ "lib/internal/url.js",
+ "lib/internal/util.js",
+ "lib/internal/util/colors.js",
+ "lib/internal/util/comparisons.js",
+ "lib/internal/util/debuglog.js",
+ "lib/internal/util/inspect.js",
+ "lib/internal/util/inspector.js",
+ "lib/internal/util/parse_args/parse_args.js",
+ "lib/internal/util/parse_args/utils.js",
+ "lib/internal/util/types.js",
+ "lib/internal/v8/startup_snapshot.js",
+ "lib/internal/v8_prof_polyfill.js",
+ "lib/internal/v8_prof_processor.js",
+ "lib/internal/validators.js",
+ "lib/internal/vm.js",
+ "lib/internal/vm/module.js",
+ "lib/internal/wasm_web_api.js",
+ "lib/internal/watch_mode/files_watcher.js",
+ "lib/internal/watchdog.js",
+ "lib/internal/webidl.js",
+ "lib/internal/webstorage.js",
+ "lib/internal/webstreams/adapters.js",
+ "lib/internal/webstreams/compression.js",
+ "lib/internal/webstreams/encoding.js",
+ "lib/internal/webstreams/queuingstrategies.js",
+ "lib/internal/webstreams/readablestream.js",
+ "lib/internal/webstreams/transfer.js",
+ "lib/internal/webstreams/transformstream.js",
+ "lib/internal/webstreams/util.js",
+ "lib/internal/webstreams/writablestream.js",
+ "lib/internal/worker.js",
+ "lib/internal/worker/io.js",
+ "lib/internal/worker/js_transferable.js",
+ "lib/internal/worker/messaging.js",
+ "lib/module.js",
+ "lib/net.js",
+ "lib/os.js",
+ "lib/path.js",
+ "lib/path/posix.js",
+ "lib/path/win32.js",
+ "lib/perf_hooks.js",
+ "lib/process.js",
+ "lib/punycode.js",
+ "lib/querystring.js",
+ "lib/readline.js",
+ "lib/readline/promises.js",
+ "lib/repl.js",
+ "lib/sea.js",
+ "lib/sqlite.js",
+ "lib/stream.js",
+ "lib/stream/consumers.js",
+ "lib/stream/promises.js",
+ "lib/stream/web.js",
+ "lib/string_decoder.js",
+ "lib/sys.js",
+ "lib/test.js",
+ "lib/test/reporters.js",
+ "lib/timers.js",
+ "lib/timers/promises.js",
+ "lib/tls.js",
+ "lib/trace_events.js",
+ "lib/tty.js",
+ "lib/url.js",
+ "lib/util.js",
+ "lib/util/types.js",
+ "lib/v8.js",
+ "lib/vm.js",
+ "lib/wasi.js",
+ "lib/worker_threads.js",
+ "lib/zlib.js",
+ "deps/v8/tools/splaytree.mjs",
+ "deps/v8/tools/codemap.mjs",
+ "deps/v8/tools/consarray.mjs",
+ "deps/v8/tools/csvparser.mjs",
+ "deps/v8/tools/profile.mjs",
+ "deps/v8/tools/profile_view.mjs",
+ "deps/v8/tools/logreader.mjs",
+ "deps/v8/tools/arguments.mjs",
+ "deps/v8/tools/tickprocessor.mjs",
+ "deps/v8/tools/sourcemap.mjs",
+ "deps/v8/tools/tickprocessor-driver.mjs",
+ "deps/acorn/acorn/dist/acorn.js",
+ "deps/acorn/acorn-walk/dist/walk.js",
+ "deps/minimatch/index.js",
+ "deps/cjs-module-lexer/lexer.js",
+ "deps/cjs-module-lexer/dist/lexer.js",
+ "deps/undici/undici.js"
+ ],
+ "node_sources": [
+ "src/api/async_resource.cc",
+ "src/api/callback.cc",
+ "src/api/embed_helpers.cc",
+ "src/api/encoding.cc",
+ "src/api/environment.cc",
+ "src/api/exceptions.cc",
+ "src/api/hooks.cc",
+ "src/api/utils.cc",
+ "src/async_context_frame.cc",
+ "src/async_wrap.cc",
+ "src/base_object.cc",
+ "src/cares_wrap.cc",
+ "src/cleanup_queue.cc",
+ "src/compile_cache.cc",
+ "src/connect_wrap.cc",
+ "src/connection_wrap.cc",
+ "src/dataqueue/queue.cc",
+ "src/debug_utils.cc",
+ "src/embedded_data.cc",
+ "src/encoding_binding.cc",
+ "src/env.cc",
+ "src/fs_event_wrap.cc",
+ "src/handle_wrap.cc",
+ "src/heap_utils.cc",
+ "src/histogram.cc",
+ "src/internal_only_v8.cc",
+ "src/js_native_api.h",
+ "src/js_native_api_types.h",
+ "src/js_native_api_v8.cc",
+ "src/js_native_api_v8.h",
+ "src/js_native_api_v8_internals.h",
+ "src/js_stream.cc",
+ "src/json_utils.cc",
+ "src/js_udp_wrap.cc",
+ "src/json_parser.h",
+ "src/json_parser.cc",
+ "src/module_wrap.cc",
+ "src/node.cc",
+ "src/node_api.cc",
+ "src/node_binding.cc",
+ "src/node_blob.cc",
+ "src/node_buffer.cc",
+ "src/node_builtins.cc",
+ "src/node_config.cc",
+ "src/node_constants.cc",
+ "src/node_contextify.cc",
+ "src/node_credentials.cc",
+ "src/node_debug.cc",
+ "src/node_dir.cc",
+ "src/node_dotenv.cc",
+ "src/node_env_var.cc",
+ "src/node_errors.cc",
+ "src/node_external_reference.cc",
+ "src/node_file.cc",
+ "src/node_http_parser.cc",
+ "src/node_http2.cc",
+ "src/node_i18n.cc",
+ "src/node_main_instance.cc",
+ "src/node_messaging.cc",
+ "src/node_metadata.cc",
+ "src/node_modules.cc",
+ "src/node_options.cc",
+ "src/node_os.cc",
+ "src/node_perf.cc",
+ "src/node_platform.cc",
+ "src/node_postmortem_metadata.cc",
+ "src/node_process_events.cc",
+ "src/node_process_methods.cc",
+ "src/node_process_object.cc",
+ "src/node_realm.cc",
+ "src/node_report.cc",
+ "src/node_report_module.cc",
+ "src/node_report_utils.cc",
+ "src/node_sea.cc",
+ "src/node_serdes.cc",
+ "src/node_shadow_realm.cc",
+ "src/node_snapshotable.cc",
+ "src/node_sockaddr.cc",
+ "src/node_sqlite.cc",
+ "src/node_stat_watcher.cc",
+ "src/node_symbols.cc",
+ "src/node_task_queue.cc",
+ "src/node_task_runner.cc",
+ "src/node_trace_events.cc",
+ "src/node_types.cc",
+ "src/node_url.cc",
+ "src/node_util.cc",
+ "src/node_v8.cc",
+ "src/node_wasi.cc",
+ "src/node_wasm_web_api.cc",
+ "src/node_watchdog.cc",
+ "src/node_webstorage.cc",
+ "src/node_worker.cc",
+ "src/node_zlib.cc",
+ "src/path.cc",
+ "src/permission/child_process_permission.cc",
+ "src/permission/fs_permission.cc",
+ "src/permission/inspector_permission.cc",
+ "src/permission/permission.cc",
+ "src/permission/wasi_permission.cc",
+ "src/permission/worker_permission.cc",
+ "src/pipe_wrap.cc",
+ "src/process_wrap.cc",
+ "src/signal_wrap.cc",
+ "src/spawn_sync.cc",
+ "src/stream_base.cc",
+ "src/stream_pipe.cc",
+ "src/stream_wrap.cc",
+ "src/string_bytes.cc",
+ "src/string_decoder.cc",
+ "src/tcp_wrap.cc",
+ "src/timers.cc",
+ "src/timer_wrap.cc",
+ "src/tracing/agent.cc",
+ "src/tracing/node_trace_buffer.cc",
+ "src/tracing/node_trace_writer.cc",
+ "src/tracing/trace_event.cc",
+ "src/tracing/traced_value.cc",
+ "src/tty_wrap.cc",
+ "src/udp_wrap.cc",
+ "src/util.cc",
+ "src/uv.cc",
+ "src/aliased_buffer.h",
+ "src/aliased_buffer-inl.h",
+ "src/aliased_struct.h",
+ "src/aliased_struct-inl.h",
+ "src/async_context_frame.h",
+ "src/async_wrap.h",
+ "src/async_wrap-inl.h",
+ "src/base_object.h",
+ "src/base_object-inl.h",
+ "src/base_object_types.h",
+ "src/blob_serializer_deserializer.h",
+ "src/blob_serializer_deserializer-inl.h",
+ "src/callback_queue.h",
+ "src/callback_queue-inl.h",
+ "src/cleanup_queue.h",
+ "src/cleanup_queue-inl.h",
+ "src/compile_cache.h",
+ "src/connect_wrap.h",
+ "src/connection_wrap.h",
+ "src/dataqueue/queue.h",
+ "src/debug_utils.h",
+ "src/debug_utils-inl.h",
+ "src/embedded_data.h",
+ "src/encoding_binding.h",
+ "src/env_properties.h",
+ "src/env.h",
+ "src/env-inl.h",
+ "src/handle_wrap.h",
+ "src/histogram.h",
+ "src/histogram-inl.h",
+ "src/js_stream.h",
+ "src/json_utils.h",
+ "src/large_pages/node_large_page.cc",
+ "src/large_pages/node_large_page.h",
+ "src/memory_tracker.h",
+ "src/memory_tracker-inl.h",
+ "src/module_wrap.h",
+ "src/node.h",
+ "src/node_api.h",
+ "src/node_api_types.h",
+ "src/node_binding.h",
+ "src/node_blob.h",
+ "src/node_buffer.h",
+ "src/node_builtins.h",
+ "src/node_constants.h",
+ "src/node_context_data.h",
+ "src/node_contextify.h",
+ "src/node_debug.h",
+ "src/node_dir.h",
+ "src/node_dotenv.h",
+ "src/node_errors.h",
+ "src/node_exit_code.h",
+ "src/node_external_reference.h",
+ "src/node_file.h",
+ "src/node_file-inl.h",
+ "src/node_http_common.h",
+ "src/node_http_common-inl.h",
+ "src/node_http2.h",
+ "src/node_http2_state.h",
+ "src/node_i18n.h",
+ "src/node_internals.h",
+ "src/node_main_instance.h",
+ "src/node_mem.h",
+ "src/node_mem-inl.h",
+ "src/node_messaging.h",
+ "src/node_metadata.h",
+ "src/node_mutex.h",
+ "src/node_modules.h",
+ "src/node_object_wrap.h",
+ "src/node_options.h",
+ "src/node_options-inl.h",
+ "src/node_perf.h",
+ "src/node_perf_common.h",
+ "src/node_platform.h",
+ "src/node_process.h",
+ "src/node_process-inl.h",
+ "src/node_realm.h",
+ "src/node_realm-inl.h",
+ "src/node_report.h",
+ "src/node_revert.h",
+ "src/node_root_certs.h",
+ "src/node_sea.h",
+ "src/node_shadow_realm.h",
+ "src/node_snapshotable.h",
+ "src/node_snapshot_builder.h",
+ "src/node_sockaddr.h",
+ "src/node_sockaddr-inl.h",
+ "src/node_sqlite.h",
+ "src/node_stat_watcher.h",
+ "src/node_union_bytes.h",
+ "src/node_url.h",
+ "src/node_version.h",
+ "src/node_v8.h",
+ "src/node_v8_platform-inl.h",
+ "src/node_wasi.h",
+ "src/node_watchdog.h",
+ "src/node_webstorage.h",
+ "src/node_worker.h",
+ "src/path.h",
+ "src/permission/child_process_permission.h",
+ "src/permission/fs_permission.h",
+ "src/permission/inspector_permission.h",
+ "src/permission/permission.h",
+ "src/permission/wasi_permission.h",
+ "src/permission/worker_permission.h",
+ "src/pipe_wrap.h",
+ "src/req_wrap.h",
+ "src/req_wrap-inl.h",
+ "src/spawn_sync.h",
+ "src/stream_base.h",
+ "src/stream_base-inl.h",
+ "src/stream_pipe.h",
+ "src/stream_wrap.h",
+ "src/string_bytes.h",
+ "src/string_decoder.h",
+ "src/string_decoder-inl.h",
+ "src/tcp_wrap.h",
+ "src/timers.h",
+ "src/tracing/agent.h",
+ "src/tracing/node_trace_buffer.h",
+ "src/tracing/node_trace_writer.h",
+ "src/tracing/trace_event.h",
+ "src/tracing/trace_event_common.h",
+ "src/tracing/traced_value.h",
+ "src/timer_wrap.h",
+ "src/timer_wrap-inl.h",
+ "src/tty_wrap.h",
+ "src/udp_wrap.h",
+ "src/util.h",
+ "src/util-inl.h",
+ "//v8/include/v8.h",
+ "deps/postject/postject-api.h"
+ ]
+}
diff --git a/node.gni b/node.gni
index 9dca810decebd75aab427e306b3cc37c80fb55c9..32709b860ccb12d8d1e75342a65dda0b86129b21 100644
--- a/node.gni
+++ b/node.gni
@@ -5,10 +5,10 @@
# Embedder options.
declare_args() {
# The location of Node.js in source code tree.
- node_path = "//node"
+ node_path = "//third_party/electron_node"
# The location of V8, use the one from node's deps by default.
- node_v8_path = "$node_path/deps/v8"
+ node_v8_path = "//v8"
# The NODE_MODULE_VERSION defined in node_version.h.
node_module_version = exec_script("$node_path/tools/getmoduleversion.py", [], "value")
@@ -38,7 +38,7 @@ declare_args() {
node_openssl_system_ca_path = ""
# Initialize v8 platform during node.js startup.
- node_use_v8_platform = true
+ node_use_v8_platform = false
# Custom build tag.
node_tag = ""
@@ -58,7 +58,7 @@ declare_args() {
# TODO(zcbenz): There are few broken things for now:
# 1. cross-os compilation is not supported.
# 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
- node_use_node_snapshot = (host_os == target_os) && !(host_cpu == "arm64" && target_cpu == "x64")
+ node_use_node_snapshot = false
}
assert(!node_enable_inspector || node_use_openssl,
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index 2bc7155f7c075e5a22ece7159a64a1c9ba3d8ac9..48d29a0d05538cd1d992f3f086d826e78d0d8882 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -775,6 +775,7 @@ void BuiltinLoader::RegisterExternalReferences(
registry->Register(GetNatives);
RegisterExternalReferencesForInternalizedBuiltinCode(registry);
+ EmbedderRegisterExternalReferencesForInternalizedBuiltinCode(registry);
}
} // namespace builtins
diff --git a/src/node_builtins.h b/src/node_builtins.h
index 1cb85b9058d06555382e565dc32192a9fa48ed9f..cec9be01abd107e8612f70daf19b4834e118ffcf 100644
--- a/src/node_builtins.h
+++ b/src/node_builtins.h
@@ -74,6 +74,8 @@ using BuiltinCodeCacheMap =
// Generated by tools/js2c.py as node_javascript.cc
void RegisterExternalReferencesForInternalizedBuiltinCode(
ExternalReferenceRegistry* registry);
+void EmbedderRegisterExternalReferencesForInternalizedBuiltinCode(
+ ExternalReferenceRegistry* registry);
// Handles compilation and caching of built-in JavaScript modules and
// bootstrap scripts, whose source are bundled into the binary as static data.
diff --git a/tools/generate_config_gypi.py b/tools/generate_config_gypi.py
index 45b3ac5006140fb55aad0e6b78084b753a947a76..8667857107e4f2481fd98032d4333b086fb7b479 100755
--- a/tools/generate_config_gypi.py
+++ b/tools/generate_config_gypi.py
@@ -21,7 +21,7 @@ import getnapibuildversion
GN_RE = re.compile(r'(\w+)\s+=\s+(.*?)$', re.MULTILINE)
if sys.platform == 'win32':
- GN = 'gn.exe'
+ GN = 'gn.bat'
else:
GN = 'gn'
diff --git a/tools/generate_gn_filenames_json.py b/tools/generate_gn_filenames_json.py
new file mode 100755
index 0000000000000000000000000000000000000000..54b761d91734aead50aeeba8c91a1262531df713
--- /dev/null
+++ b/tools/generate_gn_filenames_json.py
@@ -0,0 +1,118 @@
+#!/usr/bin/env python3
+import json
+import os
+import sys
+
+import install
+
+from utils import SearchFiles
+
+def LoadPythonDictionary(path):
+ file_string = open(path).read()
+ try:
+ file_data = eval(file_string, {'__builtins__': None}, None)
+ except SyntaxError as e:
+ e.filename = path
+ raise
+ except Exception as e:
+ raise Exception("Unexpected error while reading %s: %s" % (path, str(e)))
+
+ assert isinstance(file_data, dict), "%s does not eval to a dictionary" % path
+
+ return file_data
+
+
+FILENAMES_JSON_HEADER = '''
+// This file is automatically generated by generate_gn_filenames_json.py
+// DO NOT EDIT
+'''.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__':
+ node_root_dir = os.path.dirname(os.path.dirname(__file__))
+ node_gyp_path = os.path.join(node_root_dir, 'node.gyp')
+ out = {}
+ node_gyp = LoadPythonDictionary(node_gyp_path)
+ node_lib_target = next(
+ t for t in node_gyp['targets']
+ if t['target_name'] == '<(node_lib_target_name)')
+ node_source_blocklist = {
+ '<@(library_files)',
+ '<@(deps_files)',
+ '<@(node_sources)',
+ 'common.gypi',
+ 'common_node.gypi',
+ '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
+ }
+
+ def filter_v8_files(files):
+ v8_files = [f for f in files if f.startswith('deps/v8/')]
+ other_files = [f for f in files if not f.startswith('deps/v8/')]
+
+ for i, f in enumerate(v8_files):
+ 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']
+ other_files.extend(shared_builtins)
+
+ return v8_files + other_files
+
+ def filter_fs_files(files):
+ return [f for f in files if f.startswith('lib/internal/fs/')] + ['lib/fs.js'] + ['lib/fs/promises.js']
+
+ lib_files = SearchFiles('lib', 'js')
+ out['library_files'] = filter_v8_files(lib_files)
+ out['library_files'] += filter_v8_files(node_gyp['variables']['deps_files'])
+ out['node_sources'] = node_gyp['variables']['node_sources']
+
+ out['fs_files'] = filter_fs_files(out['library_files'])
+ # fs files are handled separately
+ out['library_files'] = [f for f in out['library_files'] if f not in out['fs_files']]
+
+ blocklisted_sources = [
+ f for f in node_lib_target['sources']
+ if f not in node_source_blocklist]
+ out['node_sources'] += filter_v8_files(blocklisted_sources)
+
+ out['headers'] = []
+ def add_headers(options, files, dest_dir):
+ if 'src/node.h' in files:
+ 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):
+ files = [f.replace('../../v8/', '//v8/', 1) for f in files]
+ if files:
+ dir_index = next((i for i, d in enumerate(out['headers']) if d['dest_dir'] == dest_dir), -1)
+ if (dir_index != -1):
+ out['headers'][dir_index]['files'] += sorted(files)
+ else:
+ hs = {'files': sorted(files), 'dest_dir': dest_dir}
+ out['headers'].append(hs)
+
+ config_gypi_path = os.path.join(get_out_dir(), 'gen', 'config.gypi')
+ 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:
+ f.write(FILENAMES_JSON_HEADER)
+ f.write(json.dumps(out, sort_keys=True, indent=2, separators=(',', ': ')))
+ f.write('\n')
diff --git a/tools/install.py b/tools/install.py
index bf54249b66c0d4e179deaae5a9fd55568e694fe0..57b51b03d237fba4b25aa69a663c88e9541b6cb5 100755
--- a/tools/install.py
+++ b/tools/install.py
@@ -392,7 +392,7 @@ def parse_options(args):
parser.add_argument('--build-dir', help='the location of built binaries',
default='out/Release')
parser.add_argument('--v8-dir', help='the location of V8',
- default='deps/v8')
+ default='../../v8')
parser.add_argument('--config-gypi-path', help='the location of config.gypi',
default='config.gypi')
parser.add_argument('--is-win', help='build for Windows target',
diff --git a/tools/js2c.cc b/tools/js2c.cc
old mode 100644
new mode 100755
index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd786f64bb
--- a/tools/js2c.cc
+++ b/tools/js2c.cc
@@ -30,6 +30,7 @@ namespace js2c {
int Main(int argc, char* argv[]);
static bool is_verbose = false;
+static bool only_js = false;
void Debug(const char* format, ...) {
va_list arguments;
@@ -196,6 +197,7 @@ const char* kTemplate = R"(
#include "node_builtins.h"
#include "node_external_reference.h"
#include "node_internals.h"
+#include "node_threadsafe_cow-inl.h"
namespace node {
@@ -211,7 +213,11 @@ const ThreadsafeCopyOnWrite<BuiltinSourceMap> global_source_map {
} // anonymous namespace
void BuiltinLoader::LoadJavaScriptSource() {
- source_ = global_source_map;
+ BuiltinSourceMap map = *source_.read();
+ BuiltinSourceMap new_map = *global_source_map.read();
+
+ map.merge(new_map);
+ source_ = ThreadsafeCopyOnWrite<BuiltinSourceMap>(map);
}
void RegisterExternalReferencesForInternalizedBuiltinCode(
@@ -228,6 +234,45 @@ UnionBytes BuiltinLoader::GetConfig() {
} // namespace node
)";
+const char* kEmbedderTemplate = R"(
+#include "env-inl.h"
+#include "node_builtins.h"
+#include "node_external_reference.h"
+#include "node_internals.h"
+#include "node_threadsafe_cow-inl.h"
+
+namespace node {
+
+namespace builtins {
+
+%.*s
+namespace {
+const ThreadsafeCopyOnWrite<BuiltinSourceMap> global_source_map {
+ BuiltinSourceMap {
+%.*s
+ } // BuiltinSourceMap
+
+}; // ThreadsafeCopyOnWrite
+} // anonymous namespace
+
+void BuiltinLoader::LoadEmbedderJavaScriptSource() {
+ BuiltinSourceMap map = *source_.read();
+ BuiltinSourceMap new_map = *global_source_map.read();
+
+ map.merge(new_map);
+ source_ = ThreadsafeCopyOnWrite<BuiltinSourceMap>(map);
+}
+
+void EmbedderRegisterExternalReferencesForInternalizedBuiltinCode(
+ ExternalReferenceRegistry* registry) {
+%.*s
+}
+
+} // namespace builtins
+
+} // namespace node
+)";
+
Fragment Format(const Fragments& definitions,
const Fragments& initializers,
const Fragments& registrations) {
@@ -237,13 +282,12 @@ Fragment Format(const Fragments& definitions,
size_t init_size = init_buf.size();
std::vector<char> reg_buf = Join(registrations, "\n");
size_t reg_size = reg_buf.size();
-
- size_t result_size =
- def_size + init_size + reg_size + strlen(kTemplate) + 100;
+ size_t result_size = def_size + init_size + reg_size +
+ strlen(only_js ? kEmbedderTemplate: kTemplate) + 300;
std::vector<char> result(result_size, 0);
int r = snprintf(result.data(),
result_size,
- kTemplate,
+ only_js ? kEmbedderTemplate: kTemplate,
static_cast<int>(def_buf.size()),
def_buf.data(),
static_cast<int>(init_buf.size()),
@@ -834,12 +878,15 @@ int JS2C(const FileList& js_files,
}
}
+ if (!only_js) {
assert(FilenameIsConfigGypi(config));
// "config.gypi" -> config_raw.
int r = AddGypi("config", config, &definitions);
if (r != 0) {
return r;
}
+ }
+
Fragment out = Format(definitions, initializers, registrations);
return WriteIfChanged(out, dest);
}
@@ -865,6 +912,8 @@ int Main(int argc, char* argv[]) {
std::string arg(argv[i]);
if (arg == "--verbose") {
is_verbose = true;
+ } else if (arg == "--only-js") {
+ only_js = true;
} else if (arg == "--root") {
if (i == argc - 1) {
fprintf(stderr, "--root must be followed by a path\n");
@@ -913,6 +962,14 @@ int Main(int argc, char* argv[]) {
}
}
+ if (only_js) {
+ auto js_it = file_map.find(".js");
+
+ assert(file_map.size() == 1);
+ assert(js_it != file_map.end());
+
+ return JS2C(js_it->second, FileList(), std::string(), output);
+ } else {
// Should have exactly 3 types: `.js`, `.mjs` and `.gypi`.
assert(file_map.size() == 3);
auto gypi_it = file_map.find(".gypi");
@@ -939,6 +996,7 @@ int Main(int argc, char* argv[]) {
std::sort(mjs_it->second.begin(), mjs_it->second.end());
return JS2C(js_it->second, mjs_it->second, gypi_it->second[0], output);
+ }
}
} // namespace js2c
} // namespace node
diff --git a/tools/search_files.py b/tools/search_files.py
index 65d0e1be42f0a85418491ebb548278cf431aa6a0..d4a31342f1c6107b029394c6e1d00a1d1e877e03 100755
--- a/tools/search_files.py
+++ b/tools/search_files.py
@@ -14,6 +14,7 @@ if __name__ == '__main__':
try:
files = SearchFiles(*sys.argv[2:])
files = [ os.path.relpath(x, sys.argv[1]) for x in files ]
+ files = [os.path.normpath(x).replace(os.sep, '/') for x in files]
print('\n'.join(files))
except Exception as e:
print(str(e))
diff --git a/unofficial.gni b/unofficial.gni
index c3b311e4a7f5444b07d4d7028d4621806959804e..de6ff5548ca5282199b7d85c11941c1fa351a9d9 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -139,6 +139,7 @@ template("node_gn_build") {
public_deps = [
"deps/ada",
"deps/uv",
+ "//electron:electron_js2c",
"deps/simdjson",
"$node_v8_path",
]
@@ -150,7 +151,6 @@ template("node_gn_build") {
"deps/llhttp",
"deps/nbytes",
"deps/nghttp2",
- "deps/ngtcp2",
"deps/postject",
"deps/simdutf",
"deps/sqlite",
@@ -159,7 +159,11 @@ template("node_gn_build") {
"$node_v8_path:v8_libplatform",
]
+ cflags_cc = [ "-Wno-unguarded-availability-new" ]
+
sources = [
+ "src/node_snapshot_stub.cc",
+ "$root_gen_dir/electron_natives.cc",
"$target_gen_dir/node_javascript.cc",
] + gypi_values.node_sources
@@ -178,8 +182,10 @@ template("node_gn_build") {
deps += [ "//third_party/icu" ]
}
if (node_use_openssl) {
- deps += [ "deps/ncrypto" ]
- public_deps += [ "deps/openssl" ]
+ deps += [
+ "deps/ncrypto",
+ "//third_party/boringssl"
+ ]
sources += gypi_values.node_crypto_sources
}
if (node_enable_inspector) {
@@ -276,6 +282,7 @@ template("node_gn_build") {
}
executable("node_js2c") {
+ defines = []
deps = [
"deps/simdutf",
"deps/uv",
@@ -286,26 +293,75 @@ template("node_gn_build") {
"src/embedded_data.cc",
"src/embedded_data.h",
]
- include_dirs = [ "src" ]
+ include_dirs = [ "src", "tools" ]
+
+ if (!is_win) {
+ defines += [ "NODE_JS2C_USE_STRING_LITERALS" ]
+ }
+ }
+
+ node_deps_files = gypi_values.deps_files + node_builtin_shareable_builtins
+ node_library_files = exec_script("./tools/search_files.py",
+ [ rebase_path(".", root_build_dir),
+ rebase_path("lib", root_build_dir),
+ "js" ],
+ "list lines")
+
+ fs_files = [
+ "lib/internal/fs/cp/cp-sync.js",
+ "lib/internal/fs/cp/cp.js",
+ "lib/internal/fs/dir.js",
+ "lib/internal/fs/glob.js",
+ "lib/internal/fs/promises.js",
+ "lib/internal/fs/read/context.js",
+ "lib/internal/fs/recursive_watch.js",
+ "lib/internal/fs/rimraf.js",
+ "lib/internal/fs/streams.js",
+ "lib/internal/fs/sync_write_stream.js",
+ "lib/internal/fs/utils.js",
+ "lib/internal/fs/watchers.js",
+ "lib/fs.js",
+ "lib/fs/promises.js"
+ ]
+
+ original_fs_files = []
+ foreach(file, fs_files) {
+ original_fs_files += [string_replace(string_replace(string_replace(file, "internal/fs/", "internal/original-fs/"), "lib/fs.js", "lib/original-fs.js"), "lib/fs/", "lib/original-fs/")]
+ }
+
+ copy("node_js2c_inputs") {
+ sources = node_deps_files + node_library_files
+ outputs = [
+ "$target_gen_dir/js2c_inputs/{{source_target_relative}}",
+ ]
+ }
+
+ action("node_js2c_original_fs") {
+ script = "//electron/script/node/generate_original_fs.py"
+ inputs = fs_files
+ deps = [ ":node_js2c_inputs" ]
+
+ outputs = []
+ foreach(file, original_fs_files) {
+ outputs += ["$target_gen_dir/js2c_inputs/$file"]
+ }
+
+ args = [rebase_path("$target_gen_dir/js2c_inputs")] + fs_files
}
action("run_node_js2c") {
- script = "$node_v8_path/tools/run.py"
+ script = "//electron/build/run-in-dir.py"
deps = [
+ ":node_js2c_original_fs",
":node_js2c($host_toolchain)",
":generate_config_gypi",
]
- node_deps_files = gypi_values.deps_files + node_builtin_shareable_builtins
- node_library_files = exec_script("./tools/search_files.py",
- [ rebase_path(".", root_build_dir),
- rebase_path("lib", root_build_dir),
- "js" ],
- "list lines")
-
+ config_gypi = [ "$target_gen_dir/config.gypi" ]
inputs = node_library_files +
node_deps_files +
- [ "$target_gen_dir/config.gypi" ]
+ get_target_outputs(":node_js2c_original_fs") +
+ config_gypi
outputs = [ "$target_gen_dir/node_javascript.cc" ]
# Get the path to node_js2c executable of the host toolchain.
@@ -319,11 +375,11 @@ template("node_gn_build") {
get_label_info(":node_js2c($host_toolchain)", "name") +
host_executable_suffix
- args = [ rebase_path(node_js2c_path),
- rebase_path("$target_gen_dir/node_javascript.cc"),
- "--root", rebase_path("."),
- "lib", rebase_path("$target_gen_dir/config.gypi") ] +
- node_deps_files
+ args = [ rebase_path("$target_gen_dir/js2c_inputs"),
+ rebase_path(node_js2c_path),
+ rebase_path("$target_gen_dir/node_javascript.cc")] +
+ rebase_path(config_gypi) + node_deps_files +
+ original_fs_files + node_library_files
}
executable("node_cctest") {