From 4b818f2adac5c26a38b6b89c9f3e9216732f4b20 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 28 May 2026 01:22:54 +0900 Subject: [PATCH] chore: bump electron 42 header version for msvc compatibility --- .github/workflows/pr-node-modules.yml | 3 - .npmrc | 2 +- build/.cachesalt | 2 +- .../product-build-win32-node-modules.yml | 3 - .../azure-pipelines/win32/sdl-scan-win32.yml | 3 - .../steps/product-build-win32-compile.yml | 3 - build/lib/electron.ts | 3 +- build/npm/gyp/custom-headers/cppgc/heap.h | 226 ------------------ build/npm/preinstall.ts | 2 - 9 files changed, 4 insertions(+), 243 deletions(-) delete mode 100644 build/npm/gyp/custom-headers/cppgc/heap.h diff --git a/.github/workflows/pr-node-modules.yml b/.github/workflows/pr-node-modules.yml index de3a8af8962cc..1f83561abb101 100644 --- a/.github/workflows/pr-node-modules.yml +++ b/.github/workflows/pr-node-modules.yml @@ -251,9 +251,6 @@ jobs: run: | . build/azure-pipelines/win32/exec.ps1 $ErrorActionPreference = "Stop" - # Run preinstall script before root dependencies are installed - # so that Electron/v8 headers are patched correctly for native modules. - exec { node build/npm/preinstall.ts } for ($i = 1; $i -le 5; $i++) { try { exec { npm ci } diff --git a/.npmrc b/.npmrc index 66bcebe736bf8..8c21e58ef14d5 100644 --- a/.npmrc +++ b/.npmrc @@ -1,5 +1,5 @@ disturl="https://electronjs.org/headers" -target="42.2.0" +target="42.3.0" ms_build_id="14159160" runtime="electron" ignore-scripts=false diff --git a/build/.cachesalt b/build/.cachesalt index dc913d548599d..57519bc2df234 100644 --- a/build/.cachesalt +++ b/build/.cachesalt @@ -1 +1 @@ -2026-05-13T00:00:00.000Z +2026-05-27T16:21:42.961Z diff --git a/build/azure-pipelines/win32/product-build-win32-node-modules.yml b/build/azure-pipelines/win32/product-build-win32-node-modules.yml index 681713e5bc111..6780073f57af7 100644 --- a/build/azure-pipelines/win32/product-build-win32-node-modules.yml +++ b/build/azure-pipelines/win32/product-build-win32-node-modules.yml @@ -70,9 +70,6 @@ jobs: - powershell: | . build/azure-pipelines/win32/exec.ps1 $ErrorActionPreference = "Stop" - # Run preinstall script before root dependencies are installed - # so that Electron/v8 headers are patched correctly for native modules. - exec { node build/npm/preinstall.ts } exec { npm ci } env: npm_config_arch: $(VSCODE_ARCH) diff --git a/build/azure-pipelines/win32/sdl-scan-win32.yml b/build/azure-pipelines/win32/sdl-scan-win32.yml index 7cdb889cc2994..6c28f30a6f8a3 100644 --- a/build/azure-pipelines/win32/sdl-scan-win32.yml +++ b/build/azure-pipelines/win32/sdl-scan-win32.yml @@ -82,9 +82,6 @@ steps: - powershell: | . build/azure-pipelines/win32/exec.ps1 $ErrorActionPreference = "Stop" - # Run preinstall script before root dependencies are installed - # so that Electron/v8 headers are patched correctly for native modules. - exec { node build/npm/preinstall.ts } exec { npm ci } env: npm_config_arch: ${{ parameters.VSCODE_ARCH }} diff --git a/build/azure-pipelines/win32/steps/product-build-win32-compile.yml b/build/azure-pipelines/win32/steps/product-build-win32-compile.yml index 5e331e041d6d1..6a93ab2aa2c1f 100644 --- a/build/azure-pipelines/win32/steps/product-build-win32-compile.yml +++ b/build/azure-pipelines/win32/steps/product-build-win32-compile.yml @@ -78,9 +78,6 @@ steps: - powershell: | . build/azure-pipelines/win32/exec.ps1 $ErrorActionPreference = "Stop" - # Run preinstall script before root dependencies are installed - # so that Electron/v8 headers are patched correctly for native modules. - exec { node build/npm/preinstall.ts } exec { npm ci } env: npm_config_arch: $(VSCODE_ARCH) diff --git a/build/lib/electron.ts b/build/lib/electron.ts index 43b15a96c3b91..016c25f7553db 100644 --- a/build/lib/electron.ts +++ b/build/lib/electron.ts @@ -100,7 +100,8 @@ function darwinBundleDocumentTypes(types: { [name: string]: string | string[] }, }); } -const { electronVersion, msBuildId } = util.getElectronVersion(); +const { msBuildId } = util.getElectronVersion(); +const electronVersion = '42.2.0'; export const config = { version: electronVersion, diff --git a/build/npm/gyp/custom-headers/cppgc/heap.h b/build/npm/gyp/custom-headers/cppgc/heap.h deleted file mode 100644 index e07603ab6bff6..0000000000000 --- a/build/npm/gyp/custom-headers/cppgc/heap.h +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef INCLUDE_CPPGC_HEAP_H_ -#define INCLUDE_CPPGC_HEAP_H_ - -#include -#include -#include -#if defined(_MSC_VER) && !defined(__clang__) -#include -#endif -#include - -#include "cppgc/common.h" -#include "cppgc/custom-space.h" -#include "cppgc/platform.h" -#include "v8config.h" // NOLINT(build/include_directory) - -/** - * cppgc - A C++ garbage collection library. - */ -namespace cppgc { - -class AllocationHandle; -class HeapHandle; - -/** - * Implementation details of cppgc. Those details are considered internal and - * may change at any point in time without notice. Users should never rely on - * the contents of this namespace. - */ -namespace internal { -class Heap; -} // namespace internal - -/** - * A marker that captures the current stack start address. - */ -class V8_EXPORT StackStartMarker { - public: -#if defined(_MSC_VER) && !defined(__clang__) - StackStartMarker() : stack_start_(_AddressOfReturnAddress()) {} -#else - StackStartMarker() : stack_start_(__builtin_frame_address(0)) {} -#endif - void* stack_start() const { return stack_start_; } - - private: - void* stack_start_; -}; - -class V8_EXPORT Heap { - public: - /** - * Specifies the stack state the embedder is in. - */ - using StackState = EmbedderStackState; - - /** - * Specifies whether conservative stack scanning is supported. - */ - enum class StackSupport : uint8_t { - /** - * Conservative stack scan is supported. - */ - kSupportsConservativeStackScan, - /** - * Conservative stack scan is not supported. Embedders may use this option - * when using custom infrastructure that is unsupported by the library. - */ - kNoConservativeStackScan, - }; - - /** - * Specifies supported marking types. - */ - enum class MarkingType : uint8_t { - /** - * Atomic stop-the-world marking. This option does not require any write - * barriers but is the most intrusive in terms of jank. - */ - kAtomic, - /** - * Incremental marking interleaves marking with the rest of the application - * workload on the same thread. - */ - kIncremental, - /** - * Incremental and concurrent marking. - */ - kIncrementalAndConcurrent - }; - - /** - * Specifies supported sweeping types. - */ - enum class SweepingType : uint8_t { - /** - * Atomic stop-the-world sweeping. All of sweeping is performed at once. - */ - kAtomic, - /** - * Incremental sweeping interleaves sweeping with the rest of the - * application workload on the same thread. - */ - kIncremental, - /** - * Incremental and concurrent sweeping. Sweeping is split and interleaved - * with the rest of the application. - */ - kIncrementalAndConcurrent - }; - - /** - * Constraints for a Heap setup. - */ - struct ResourceConstraints { - /** - * Allows the heap to grow to some initial size in bytes before triggering - * garbage collections. This is useful when it is known that applications - * need a certain minimum heap to run to avoid repeatedly invoking the - * garbage collector when growing the heap. - */ - size_t initial_heap_size_bytes = 0; - }; - - /** - * Options specifying Heap properties (e.g. custom spaces) when initializing a - * heap through `Heap::Create()`. - */ - struct HeapOptions { - /** - * Creates reasonable defaults for instantiating a Heap. - * - * \returns the HeapOptions that can be passed to `Heap::Create()`. - */ - static HeapOptions Default() { return {}; } - - /** - * Custom spaces added to heap are required to have indices forming a - * numbered sequence starting at 0, i.e., their `kSpaceIndex` must - * correspond to the index they reside in the vector. - */ - std::vector> custom_spaces; - - /** - * Specifies whether conservative stack scan is supported. When conservative - * stack scan is not supported, the collector may try to invoke - * garbage collections using non-nestable task, which are guaranteed to have - * no interesting stack, through the provided Platform. If such tasks are - * not supported by the Platform, the embedder must take care of invoking - * the GC through `ForceGarbageCollectionSlow()`. - */ - StackSupport stack_support = StackSupport::kSupportsConservativeStackScan; - - /** - * Specifies which types of marking are supported by the heap. - */ - MarkingType marking_support = MarkingType::kIncrementalAndConcurrent; - - /** - * Specifies which types of sweeping are supported by the heap. - */ - SweepingType sweeping_support = SweepingType::kIncrementalAndConcurrent; - - /** - * Resource constraints specifying various properties that the internal - * GC scheduler follows. - */ - ResourceConstraints resource_constraints; - - /** - * Optional marker representing the stack start of the thread creating the - * heap. - */ - std::optional stack_start_marker = std::nullopt; - }; - /** - * Creates a new heap that can be used for object allocation. - * - * \param platform implemented and provided by the embedder. - * \param options HeapOptions specifying various properties for the Heap. - * \returns a new Heap instance. - */ - static std::unique_ptr Create( - std::shared_ptr platform, - HeapOptions options = HeapOptions::Default()); - - virtual ~Heap() = default; - - /** - * Forces garbage collection. - * - * \param source String specifying the source (or caller) triggering a - * forced garbage collection. - * \param reason String specifying the reason for the forced garbage - * collection. - * \param stack_state The embedder stack state, see StackState. - */ - void ForceGarbageCollectionSlow( - const char* source, const char* reason, - StackState stack_state = StackState::kMayContainHeapPointers); - - /** - * \returns the opaque handle for allocating objects using - * `MakeGarbageCollected()`. - */ - AllocationHandle& GetAllocationHandle(); - - /** - * \returns the opaque heap handle which may be used to refer to this heap in - * other APIs. Valid as long as the underlying `Heap` is alive. - */ - HeapHandle& GetHeapHandle(); - - private: - Heap() = default; - - friend class internal::Heap; -}; - -} // namespace cppgc - -#endif // INCLUDE_CPPGC_HEAP_H_ diff --git a/build/npm/preinstall.ts b/build/npm/preinstall.ts index 9cd91e2802143..54a377a65d22b 100644 --- a/build/npm/preinstall.ts +++ b/build/npm/preinstall.ts @@ -146,8 +146,6 @@ function installHeaders() { // the downloaded Electron headers. This is used to work around upstream issues: // - v8-source-location.h: remove dependency on std::source_location (GCC 11+ requirement) // Refs https://chromium-review.googlesource.com/c/v8/v8/+/6879784 - // - cppgc/heap.h: replace GCC/Clang-only __builtin_frame_address(0) with the - // MSVC equivalent _AddressOfReturnAddress() so native modules build with MSVC. if (local !== undefined) { const localHeaderPath = getLocalHeaderPath(local.target); if (localHeaderPath && fs.existsSync(localHeaderPath)) {