mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Compare commits
39 Commits
remove-dec
...
build-win-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e7cbfee95 | ||
|
|
44b0789530 | ||
|
|
038f610ef8 | ||
|
|
9f58248ac5 | ||
|
|
1f6c061d0e | ||
|
|
76a4adbe1c | ||
|
|
695b375cc9 | ||
|
|
cab27faeee | ||
|
|
ed8cdca6c7 | ||
|
|
f87cbacea4 | ||
|
|
0e93e65759 | ||
|
|
aa74829cea | ||
|
|
d4b50302c6 | ||
|
|
44c52506b9 | ||
|
|
4ade686dc0 | ||
|
|
f7fdbbdf36 | ||
|
|
d2f0ebc159 | ||
|
|
ac4307d32a | ||
|
|
ef368f377f | ||
|
|
df4a22eae4 | ||
|
|
34fba75af3 | ||
|
|
613434c18e | ||
|
|
4718534f22 | ||
|
|
1fb9fd3810 | ||
|
|
f9f25e4d48 | ||
|
|
3079b0c606 | ||
|
|
25de3bb0b5 | ||
|
|
400cb880aa | ||
|
|
71f792cf35 | ||
|
|
c947680085 | ||
|
|
f1c425650a | ||
|
|
f61a5b1889 | ||
|
|
5491b80c48 | ||
|
|
165a675b8a | ||
|
|
b7461579db | ||
|
|
19816f5f3e | ||
|
|
12f9b97955 | ||
|
|
8d7db38344 | ||
|
|
57892e93c0 |
175
.github/actions/build-electron/action.yml
vendored
175
.github/actions/build-electron/action.yml
vendored
@@ -40,10 +40,113 @@ runs:
|
||||
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
|
||||
- name: Set GN_EXTRA_ARGS for Windows
|
||||
shell: bash
|
||||
if: ${{inputs.target-arch != 'x64' && inputs.target-platform == 'win' }}
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
run: |
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"${{ inputs.target-arch }}\""
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"${{ inputs.target-arch }}\" use_v8_context_snapshot=true v8_win_cross_compile_using_wine=true target_os=\"win\""
|
||||
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
|
||||
echo "ELECTRON_BUILD_TOOLS_MAIN_STAR=`pwd`/src/electron/build/siso/main.star" >> $GITHUB_ENV
|
||||
- name: Install wine for Windows builds on non-Windows hosts
|
||||
shell: bash
|
||||
if: ${{ inputs.target-platform == 'win' && runner.os != 'Windows' }}
|
||||
run: |
|
||||
sudo mkdir -pm755 /etc/apt/keyrings
|
||||
wget -O - https://dl.winehq.org/wine-builds/winehq.key | sudo gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key -
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
|
||||
sudo apt-get update
|
||||
sudo apt install -y --install-recommends winehq-stable libgcc-s1:i386 libgcc-s1
|
||||
# Increase virtual memory limits for Wine's VirtualAlloc (V8 sandbox
|
||||
# reserves a very large contiguous region that fails under default limits)
|
||||
sudo sysctl vm.mmap_min_addr
|
||||
sudo sysctl -w vm.mmap_min_addr=65536
|
||||
sudo sysctl -w vm.max_map_count=1048576
|
||||
sudo sysctl -w vm.overcommit_memory=1
|
||||
sudo sysctl -w kernel.randomize_va_space=0
|
||||
if [ -x /usr/bin/wine ]; then
|
||||
WINE_PATH=/usr/bin/wine
|
||||
elif command -v wine >/dev/null 2>&1; then
|
||||
WINE_PATH=$(command -v wine)
|
||||
fi
|
||||
if [ -z "$WINE_PATH" ] || [ ! -x "$WINE_PATH" ]; then
|
||||
echo "ERROR: wine binary not found anywhere after install"
|
||||
exit 1
|
||||
fi
|
||||
echo "Found wine at: $WINE_PATH"
|
||||
export WINEPREFIX="$HOME/.wine"
|
||||
mkdir -p "$WINEPREFIX"
|
||||
echo "WINEPREFIX=$WINEPREFIX" >> $GITHUB_ENV
|
||||
# Start a persistent Xvfb server for wine (xvfb-run per-invocation hangs
|
||||
# because wineserver keeps the X connection alive)
|
||||
export DISPLAY=:99.0
|
||||
echo "DISPLAY=:99.0" >> $GITHUB_ENV
|
||||
export XDG_RUNTIME_DIR=/tmp/runtime-$(whoami)
|
||||
echo "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" >> $GITHUB_ENV
|
||||
mkdir -p "$XDG_RUNTIME_DIR"
|
||||
echo "Starting Xvfb on :99 with 1024x768x24 resolution"
|
||||
Xvfb :99 -screen 0 1024x768x24 &
|
||||
echo "Wait for Xvfb to be ready"
|
||||
# Wait for Xvfb to be ready (up to 5 seconds)
|
||||
for i in $(seq 1 10); do
|
||||
if xdpyinfo -display :99 >/dev/null 2>&1; then
|
||||
echo "Xvfb is running on :99"
|
||||
break
|
||||
fi
|
||||
echo "xvfb not ready yet, waiting..."
|
||||
sleep 0.5
|
||||
done
|
||||
if ! xdpyinfo -display :99 >/dev/null 2>&1; then
|
||||
echo "ERROR: Xvfb failed to start"
|
||||
exit 1
|
||||
fi
|
||||
echo "Xvfb is ready; about to run wineboot"
|
||||
|
||||
export WINEDEBUG=-all
|
||||
echo "WINEDEBUG=$WINEDEBUG" >> $GITHUB_ENV
|
||||
export WINEARCH=win64
|
||||
echo "WINEARCH=$WINEARCH" >> $GITHUB_ENV
|
||||
WINEDLLOVERRIDES="mscoree,mshtml=" wineboot --init
|
||||
echo "Done running wineboot"
|
||||
# Initialize wine prefix to avoid first-run delays during build
|
||||
#"$WINE_PATH" wineboot --init 2>/dev/null || true
|
||||
WINE_WRAPPER="/usr/local/bin/xvfb-wine"
|
||||
printf '#!/bin/sh\nsetarch x86_64 -R %s "$@"\n' "$WINE_PATH" | sudo tee "$WINE_WRAPPER" > /dev/null
|
||||
sudo chmod +x "$WINE_WRAPPER"
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS v8_wine_path=\"$WINE_WRAPPER\""
|
||||
|
||||
# Pass wine path to GN so siso can find it regardless of PATH
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS v8_wine_path=\"$WINE_PATH\""
|
||||
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
|
||||
echo "GN APPENDED_ARGS set with wine path: $GN_APPENDED_ARGS"
|
||||
echo "Wine setup complete"
|
||||
# - name: Download mksnapshot.zip
|
||||
# shell: bash
|
||||
# if: ${{ inputs.target-platform == 'win' }}
|
||||
# run: |
|
||||
# # Download mksnapshot.zip from https://electronbuildtools.blob.core.windows.net/windows-toolchains/mksnapshot.zip
|
||||
# curl -L -o mksnapshot.zip https://electronbuildtools.blob.core.windows.net/windows-toolchains/mksnapshot.zip
|
||||
# if [ $? -ne 0 ]; then
|
||||
# echo "Failed to download mksnapshot.zip"
|
||||
# exit 1
|
||||
# fi
|
||||
# if [ -f mksnapshot.zip ]; then
|
||||
# echo "Successfully downloaded mksnapshot.zip"
|
||||
# else
|
||||
# echo "mksnapshot.zip not found after download"
|
||||
# exit 1
|
||||
# fi
|
||||
# if [ -f mksnapshot.zip ]; then
|
||||
# unzip mksnapshot.zip -d mksnapshot || true
|
||||
# PREBUILT_MKSNAPSHOT="$(pwd)/mksnapshot/mksnapshot.exe"
|
||||
# if [ -f "$PREBUILT_MKSNAPSHOT" ]; then
|
||||
# GN_APPENDED_ARGS="$GN_EXTRA_ARGS v8_prebuilt_mksnapshot=\"$PREBUILT_MKSNAPSHOT\""
|
||||
# echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
|
||||
# echo "Using pre-built mksnapshot at $PREBUILT_MKSNAPSHOT"
|
||||
# else
|
||||
# echo "mksnapshot binary not found in mksnapshot.zip, will build from source"
|
||||
# fi
|
||||
# else
|
||||
# echo "mksnapshot.zip not found, skipping unzip and PATH update"
|
||||
# fi
|
||||
- name: Add Clang problem matcher
|
||||
shell: bash
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/clang.json"
|
||||
@@ -58,7 +161,6 @@ runs:
|
||||
OUTPUT_PATH: src/previous-object-checksums.json
|
||||
run: node src/electron/.github/actions/build-electron/download-previous-object-checksums.mjs
|
||||
- name: Build Electron ${{ inputs.step-suffix }}
|
||||
if: ${{ inputs.target-platform != 'win' }}
|
||||
shell: bash
|
||||
run: |
|
||||
rm -rf "src/out/Default/Electron Framework.framework"
|
||||
@@ -83,7 +185,11 @@ runs:
|
||||
node electron/script/check-symlinks.js
|
||||
|
||||
# Build stats and object checksums
|
||||
BUILD_STATS_ARGS="out/Default/siso.INFO --out-dir out/Default --output-object-checksums object-checksums.${{ inputs.artifact-platform }}_${{ inputs.target-arch }}.json"
|
||||
if [ "$TARGET_PLATFORM" = "win" ]; then
|
||||
BUILD_STATS_ARGS="out/Default/siso.exe.INFO --out-dir out/Default --output-object-checksums object-checksums.${{ inputs.artifact-platform }}_${{ inputs.target-arch }}.json"
|
||||
else
|
||||
BUILD_STATS_ARGS="out/Default/siso.INFO --out-dir out/Default --output-object-checksums object-checksums.${{ inputs.artifact-platform }}_${{ inputs.target-arch }}.json"
|
||||
fi
|
||||
if [ -f previous-object-checksums.json ]; then
|
||||
BUILD_STATS_ARGS="$BUILD_STATS_ARGS --input-object-checksums previous-object-checksums.json"
|
||||
fi
|
||||
@@ -93,38 +199,6 @@ runs:
|
||||
echo "Skipping build-stats.mjs upload because DD_API_KEY is not set"
|
||||
fi
|
||||
node electron/script/build-stats.mjs $BUILD_STATS_ARGS || true
|
||||
- name: Build Electron (Windows) ${{ inputs.step-suffix }}
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
shell: powershell
|
||||
run: |
|
||||
cd src\electron
|
||||
git pack-refs
|
||||
cd ..
|
||||
|
||||
$env:NINJA_SUMMARIZE_BUILD = 1
|
||||
if ("${{ inputs.is-release }}" -eq "true") {
|
||||
e build --target electron:release_build
|
||||
} else {
|
||||
e build --target electron:testing_build
|
||||
}
|
||||
Copy-Item out\Default\.ninja_log out\electron_ninja_log
|
||||
node electron\script\check-symlinks.js
|
||||
|
||||
# Build stats and object checksums
|
||||
$statsArgs = @("out\Default\siso.exe.INFO", "--out-dir", "out\Default", "--output-object-checksums", "object-checksums.${{ inputs.artifact-platform }}_${{ inputs.target-arch }}.json")
|
||||
if (Test-Path previous-object-checksums.json) {
|
||||
$statsArgs += @("--input-object-checksums", "previous-object-checksums.json")
|
||||
}
|
||||
if ($env:DD_API_KEY) {
|
||||
$statsArgs += "--upload-stats"
|
||||
} else {
|
||||
Write-Host "Skipping build-stats.mjs upload because DD_API_KEY is not set"
|
||||
}
|
||||
try {
|
||||
& node electron\script\build-stats.mjs @statsArgs ; $LASTEXITCODE = 0
|
||||
} catch {
|
||||
Write-Host "Build stats failed, continuing..."
|
||||
}
|
||||
- name: Verify dist.zip ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -152,15 +226,7 @@ runs:
|
||||
sed $SEDOPTION '/--warn-about-builtin-profile-data/d' out/Default/mksnapshot_args
|
||||
sed $SEDOPTION '/--abort-on-bad-builtin-profile-data/d' out/Default/mksnapshot_args
|
||||
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
cd out/Default
|
||||
powershell Compress-Archive -update mksnapshot_args mksnapshot.zip
|
||||
powershell mkdir mktmp\\gen\\v8
|
||||
powershell Copy-Item gen\\v8\\embedded.S mktmp\\gen\\v8
|
||||
powershell Compress-Archive -update -Path mktmp\\gen mksnapshot.zip
|
||||
else
|
||||
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
|
||||
fi
|
||||
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
|
||||
- name: Generate Cross-Arch Snapshot (arm/arm64) ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
if: ${{ (inputs.target-arch == 'arm' || inputs.target-arch == 'arm64') && inputs.target-platform == 'linux' }}
|
||||
@@ -194,12 +260,6 @@ runs:
|
||||
fi
|
||||
electron/script/zip_manifests/check-zip-manifest.py out/Default/chromedriver.zip electron/script/zip_manifests/chromedriver_zip.$target_os.${{ inputs.target-arch }}.manifest
|
||||
fi
|
||||
- name: Create installed_software.json ${{ inputs.step-suffix }}
|
||||
shell: powershell
|
||||
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
|
||||
run: |
|
||||
cd src
|
||||
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
|
||||
- name: Profile Windows Toolchain ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
|
||||
@@ -269,7 +329,7 @@ runs:
|
||||
with:
|
||||
subject-path: ${{ steps.github-upload.outputs.UPLOADED_PATHS }}
|
||||
- name: Generate siso report
|
||||
if: ${{ inputs.target-platform != 'win' && !cancelled() }}
|
||||
if: ${{ !cancelled() }}
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
@@ -278,17 +338,6 @@ runs:
|
||||
echo "SISO_REPORT_PATH=$SISO_REPORT_PATH" >> $GITHUB_ENV
|
||||
cat siso_report.txt
|
||||
echo "SISO REPORT AT $SISO_REPORT_PATH"
|
||||
- name: Generate siso report (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' && !cancelled() }}
|
||||
shell: powershell
|
||||
run: |
|
||||
cd src
|
||||
e d siso report -C out\Default > siso_report.txt
|
||||
$SISO_REPORT_PATH = Get-Content "siso_report.txt" | Select-String "report file:\s*(.+)" | ForEach-Object {
|
||||
$_.Matches.Groups[1].Value.Trim()
|
||||
}
|
||||
echo "SISO_REPORT_PATH=$SISO_REPORT_PATH"
|
||||
echo "SISO_REPORT_PATH=$SISO_REPORT_PATH" >> $env:GITHUB_ENV
|
||||
- name: Generate Artifact Key
|
||||
if: always() && !cancelled()
|
||||
shell: bash
|
||||
|
||||
@@ -15,7 +15,7 @@ runs:
|
||||
git config --global core.preloadindex true
|
||||
git config --global core.longpaths true
|
||||
fi
|
||||
export BUILD_TOOLS_SHA=a0cc95a1884a631559bcca0c948465b725d9295a
|
||||
export BUILD_TOOLS_SHA=1aa9dce0b3fa9353c38a6c3d4aac0249f0f68973
|
||||
npm i -g @electron/build-tools
|
||||
# Update depot_tools to ensure python
|
||||
e d update_depot_tools
|
||||
|
||||
17
.github/workflows/build.yml
vendored
17
.github/workflows/build.yml
vendored
@@ -11,12 +11,12 @@ on:
|
||||
skip-macos:
|
||||
type: boolean
|
||||
description: 'Skip macOS builds'
|
||||
default: false
|
||||
default: true
|
||||
required: false
|
||||
skip-linux:
|
||||
type: boolean
|
||||
description: 'Skip Linux builds'
|
||||
default: false
|
||||
default: true
|
||||
required: false
|
||||
skip-windows:
|
||||
type: boolean
|
||||
@@ -108,7 +108,7 @@ jobs:
|
||||
# Checkout Jobs
|
||||
checkout-macos:
|
||||
needs: setup
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-macos}}
|
||||
if: ${{ needs.setup.outputs.src == 'true' && inputs.skip-macos == 'false'}}
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -138,7 +138,7 @@ jobs:
|
||||
|
||||
checkout-linux:
|
||||
needs: setup
|
||||
if: ${{ !inputs.skip-linux}}
|
||||
if: ${{ inputs.skip-linux == 'false' }}
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -387,8 +387,9 @@ jobs:
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
test-runs-on: windows-latest
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
|
||||
target-platform: win
|
||||
target-arch: x64
|
||||
is-release: false
|
||||
@@ -406,8 +407,9 @@ jobs:
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
test-runs-on: windows-latest
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
|
||||
target-platform: win
|
||||
target-arch: x86
|
||||
is-release: false
|
||||
@@ -425,8 +427,9 @@ jobs:
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
test-runs-on: windows-11-arm
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
|
||||
target-platform: win
|
||||
target-arch: arm64
|
||||
is-release: false
|
||||
|
||||
@@ -134,6 +134,10 @@ jobs:
|
||||
- name: Install AZCopy
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: brew install azcopy
|
||||
- name: Enable windows toolchain
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
run: |
|
||||
echo "ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN=1" >> $GITHUB_ENV
|
||||
- name: Set GN_EXTRA_ARGS for Linux
|
||||
if: ${{ inputs.target-platform == 'linux' }}
|
||||
run: |
|
||||
@@ -160,13 +164,15 @@ jobs:
|
||||
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
|
||||
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
|
||||
- name: Restore src cache via AZCopy
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/restore-cache-azcopy
|
||||
with:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
- name: Restore src cache via AKS
|
||||
if: ${{ inputs.target-platform == 'linux' }}
|
||||
if: ${{ inputs.target-platform != 'macos' }}
|
||||
uses: ./src/electron/.github/actions/restore-cache-aks
|
||||
with:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
with:
|
||||
@@ -174,7 +180,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Fix Sync
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/fix-sync
|
||||
with:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
@@ -183,9 +189,21 @@ jobs:
|
||||
- name: Init Build Tools
|
||||
run: |
|
||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} --remote-build siso
|
||||
e sanitize-config
|
||||
- name: Run Electron Only Hooks
|
||||
run: |
|
||||
e d gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
rm -rf src/third_party/depot_tools/win_toolchain/vs_files*
|
||||
fi
|
||||
echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
echo "target_os=['win']" >> tmpgclient
|
||||
fi
|
||||
gclient runhooks --gclientfile=tmpgclient
|
||||
# Fix VS Toolchain
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
e d python3 src/build/vs_toolchain.py update --force
|
||||
fi
|
||||
- name: Regenerate DEPS Hash
|
||||
run: |
|
||||
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js
|
||||
@@ -224,3 +242,11 @@ jobs:
|
||||
generate-symbols: '${{ inputs.generate-symbols }}'
|
||||
upload-to-storage: '${{ inputs.upload-to-storage }}'
|
||||
step-suffix: '(mas)'
|
||||
- name: Wait for active SSH sessions
|
||||
shell: bash
|
||||
if: always() && !cancelled()
|
||||
run: |
|
||||
while [ -f /var/.ssh-lock ]
|
||||
do
|
||||
sleep 60
|
||||
done
|
||||
|
||||
103
build/siso/main.star
Normal file
103
build/siso/main.star
Normal file
@@ -0,0 +1,103 @@
|
||||
load("@builtin//encoding.star", "json")
|
||||
load("@builtin//lib/gn.star", "gn")
|
||||
load("@builtin//path.star", "path")
|
||||
load("@builtin//runtime.star", "runtime")
|
||||
load("@builtin//struct.star", "module")
|
||||
load("@config//main.star", upstream_init = "init")
|
||||
load("@config//win_sdk.star", "win_sdk")
|
||||
load("@config//gn_logs.star", "gn_logs")
|
||||
|
||||
def init(ctx):
|
||||
mod = upstream_init(ctx)
|
||||
step_config = json.decode(mod.step_config)
|
||||
|
||||
# Buildbarn doesn't support input_root_absolute_path so disable that
|
||||
for rule in step_config["rules"]:
|
||||
input_root_absolute_path = rule.get("input_root_absolute_path", False)
|
||||
if input_root_absolute_path:
|
||||
rule.pop("input_root_absolute_path", None)
|
||||
|
||||
# Only wrap clang rules with a remote wrapper if not on Linux. These are currently only
|
||||
# needed for X-Compile builds, which run on Windows and Mac.
|
||||
if runtime.os != "linux":
|
||||
for rule in step_config["rules"]:
|
||||
if rule["name"].startswith("clang/") or rule["name"].startswith("clang-cl/"):
|
||||
rule["remote_wrapper"] = "../../buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper"
|
||||
if "inputs" not in rule:
|
||||
rule["inputs"] = []
|
||||
rule["inputs"].append("buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper")
|
||||
rule["inputs"].append("third_party/llvm-build/Release+Asserts_linux/bin/clang")
|
||||
|
||||
if "executables" not in step_config:
|
||||
step_config["executables"] = []
|
||||
step_config["executables"].append("buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper")
|
||||
step_config["executables"].append("third_party/llvm-build/Release+Asserts_linux/bin/clang")
|
||||
|
||||
if runtime.os == "darwin":
|
||||
# Update platforms to match our default siso config instead of reclient configs.
|
||||
step_config["platforms"].update({
|
||||
"clang": step_config["platforms"]["default"],
|
||||
"clang_large": step_config["platforms"]["default"],
|
||||
})
|
||||
|
||||
# Add additional Windows SDK headers needed by Electron
|
||||
win_toolchain_dir = win_sdk.toolchain_dir(ctx)
|
||||
if win_toolchain_dir:
|
||||
sdk_version = gn_logs.read(ctx).get("windows_sdk_version")
|
||||
step_config["input_deps"][win_toolchain_dir + ":headers"].extend([
|
||||
# third_party/electron_node/deps/uv/include/uv/win.h includes mswsock.h
|
||||
path.join(win_toolchain_dir, "Windows Kits", "10/Include", sdk_version, "um/mswsock.h"),
|
||||
# third_party/electron_node/src/debug_utils.cc includes lm.h
|
||||
path.join(win_toolchain_dir, "Windows Kits", "10/Include", sdk_version, "um/Lm.h"),
|
||||
])
|
||||
|
||||
if runtime.os == "windows":
|
||||
# Update platforms to match our default siso config instead of reclient configs.
|
||||
step_config["platforms"].update({
|
||||
"clang-cl": step_config["platforms"]["default"],
|
||||
"clang-cl_large": step_config["platforms"]["default"],
|
||||
"lld-link": step_config["platforms"]["default"],
|
||||
})
|
||||
|
||||
# When cross-compiling for Windows using wine, mksnapshot.exe is run via
|
||||
# wine64 on the local machine. The remote execution service cannot handle
|
||||
# this, so force mksnapshot to run locally. The wine64 prefix also changes
|
||||
# the command so the upstream v8/mksnapshot rule's command_prefix won't
|
||||
# match — add an explicit rule for the wine-prefixed command.
|
||||
if "args.gn" in ctx.metadata:
|
||||
gn_args = gn.args(ctx)
|
||||
if gn_args.get("v8_win_cross_compile_using_wine", "").strip('"') == "true":
|
||||
# Force the existing v8/mksnapshot rule to run locally
|
||||
for rule in step_config["rules"]:
|
||||
if rule.get("name") == "v8/mksnapshot":
|
||||
rule["remote"] = False
|
||||
|
||||
# Add a rule that matches the wine64-prefixed mksnapshot command.
|
||||
# With wine, GN emits: python3 ../../v8/tools/run.py <wine_path> ./mksnapshot.exe
|
||||
# The upstream command_prefix ("python3 ...run.py ./mksnapshot") won't
|
||||
# match because wine_path appears before ./mksnapshot.exe.
|
||||
wine_path = gn_args.get("v8_wine_path", "").strip('"')
|
||||
if wine_path:
|
||||
step_config["rules"].insert(0, {
|
||||
"name": "v8/mksnapshot_wine",
|
||||
"command_prefix": "python3 ../../v8/tools/run.py " + wine_path,
|
||||
"remote": False,
|
||||
"timeout": "2m",
|
||||
"output_local": True,
|
||||
})
|
||||
# Same treatment for v8_context_snapshot_generator which uses
|
||||
# gn_run_binary.py instead of v8/tools/run.py.
|
||||
step_config["rules"].insert(0, {
|
||||
"name": "v8/context_snapshot_wine",
|
||||
"command_prefix": "python3 ../../build/gn_run_binary.py " + wine_path,
|
||||
"remote": False,
|
||||
"timeout": "2m",
|
||||
"output_local": True,
|
||||
})
|
||||
|
||||
return module(
|
||||
"config",
|
||||
step_config = json.encode(step_config),
|
||||
filegroups = mod.filegroups,
|
||||
handlers = mod.handlers,
|
||||
)
|
||||
@@ -150,3 +150,4 @@ fix_use_fresh_lazynow_for_onendworkitemimpl_after_didruntask.patch
|
||||
fix_pulseaudio_stream_and_icon_names.patch
|
||||
fix_fire_menu_popup_start_for_dynamically_created_aria_menus.patch
|
||||
feat_allow_enabling_extensions_on_custom_protocols.patch
|
||||
chore_run_v8_context_snapshot_generator_through_wine_when.patch
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: John Kleinschmidt <kleinschmidtorama@gmail.com>
|
||||
Date: Tue, 7 Apr 2026 14:05:09 -0400
|
||||
Subject: chore: run v8_context_snapshot_generator through Wine when
|
||||
cross-compiling
|
||||
|
||||
When cross-compiling for Windows on Linux with Wine, the
|
||||
v8_context_snapshot_generator binary is a Windows PE executable (.exe)
|
||||
that cannot be run directly. Prepend the wine path to args and append
|
||||
.exe to the binary name, matching the approach used for mksnapshot.
|
||||
|
||||
diff --git a/tools/v8_context_snapshot/BUILD.gn b/tools/v8_context_snapshot/BUILD.gn
|
||||
index ec2357139826613e8b295cb01be341acb03b4737..6c4171dbaf7a76cfc89d71871b73058747675811 100644
|
||||
--- a/tools/v8_context_snapshot/BUILD.gn
|
||||
+++ b/tools/v8_context_snapshot/BUILD.gn
|
||||
@@ -50,12 +50,27 @@ if (use_v8_context_snapshot) {
|
||||
output_file = "$root_build_dir/$v8_context_snapshot_filename"
|
||||
output_path = rebase_path(output_file, root_build_dir)
|
||||
|
||||
- args = [
|
||||
- "./" + rebase_path(
|
||||
- get_label_info(
|
||||
- ":v8_context_snapshot_generator($v8_snapshot_toolchain)",
|
||||
- "root_out_dir") + "/v8_context_snapshot_generator",
|
||||
- root_build_dir),
|
||||
+ _generator_dir = get_label_info(
|
||||
+ ":v8_context_snapshot_generator($v8_snapshot_toolchain)",
|
||||
+ "root_out_dir")
|
||||
+ if (v8_win_cross_compile_using_wine) {
|
||||
+ _generator_bin = "./" + rebase_path(
|
||||
+ _generator_dir + "/v8_context_snapshot_generator.exe",
|
||||
+ root_build_dir)
|
||||
+ } else {
|
||||
+ _generator_bin = "./" + rebase_path(
|
||||
+ _generator_dir + "/v8_context_snapshot_generator",
|
||||
+ root_build_dir)
|
||||
+ }
|
||||
+
|
||||
+ args = []
|
||||
+ if (v8_win_cross_compile_using_wine) {
|
||||
+ assert(v8_wine_path != "",
|
||||
+ "v8_wine_path must be set when v8_win_cross_compile_using_wine is true")
|
||||
+ args += [ v8_wine_path ]
|
||||
+ }
|
||||
+ args += [
|
||||
+ _generator_bin,
|
||||
"--snapshot_blob=$snapshot_blob_path",
|
||||
"--output_file=$output_path",
|
||||
]
|
||||
@@ -1,2 +1,3 @@
|
||||
chore_allow_customizing_microtask_policy_per_context.patch
|
||||
build_warn_instead_of_abort_on_builtin_pgo_profile_mismatch.patch
|
||||
feat_support_running_mksnapshot_exe_via_wine_for_windows.patch
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: John Kleinschmidt <kleinschmidtorama@gmail.com>
|
||||
Date: Tue, 24 Mar 2026 16:29:55 -0400
|
||||
Subject: feat: support running mksnapshot.exe via Wine for Windows
|
||||
cross-compile
|
||||
|
||||
When v8_win_cross_compile_using_wine=true is set, mksnapshot is built as a
|
||||
Windows .exe using the target toolchain and executed via Wine on the Linux
|
||||
host. This avoids needing source-level cross-compile patches for the
|
||||
unwinding info code paths.
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index 751265ba83c04f0c545248a71b35e46034bfc90a..9ca41b06b569c729496abde7cba085518a9f0d71 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -2699,7 +2699,11 @@ template("run_mksnapshot") {
|
||||
suffix = "_$name"
|
||||
}
|
||||
action("run_mksnapshot_" + name) {
|
||||
- deps = [ ":mksnapshot($v8_snapshot_toolchain)" ]
|
||||
+ if (v8_prebuilt_mksnapshot != "") {
|
||||
+ deps = []
|
||||
+ } else {
|
||||
+ deps = [ ":mksnapshot($v8_snapshot_toolchain)" ]
|
||||
+ }
|
||||
if (v8_verify_deterministic_mksnapshot) {
|
||||
# We archive the snapshot executable when verifying snapshot
|
||||
# determinism to ease debugging.
|
||||
@@ -2753,10 +2757,26 @@ template("run_mksnapshot") {
|
||||
data += [ "$root_out_dir/mksnapshot_output${suffix}.log" ]
|
||||
}
|
||||
|
||||
+ if (v8_prebuilt_mksnapshot != "") {
|
||||
+ _mksnapshot_bin = v8_prebuilt_mksnapshot
|
||||
+ } else {
|
||||
+ _mksnapshot_dir =
|
||||
+ get_label_info(":mksnapshot($v8_snapshot_toolchain)", "root_out_dir")
|
||||
+ if (v8_win_cross_compile_using_wine) {
|
||||
+ _mksnapshot_bin = _mksnapshot_dir + "/mksnapshot.exe"
|
||||
+ } else {
|
||||
+ _mksnapshot_bin = _mksnapshot_dir + "/mksnapshot"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (v8_win_cross_compile_using_wine) {
|
||||
+ assert(
|
||||
+ v8_wine_path != "",
|
||||
+ "v8_wine_path must be set when v8_win_cross_compile_using_wine is true")
|
||||
+ args += [ v8_wine_path ]
|
||||
+ }
|
||||
args += [
|
||||
- "./" + rebase_path(get_label_info(":mksnapshot($v8_snapshot_toolchain)",
|
||||
- "root_out_dir") + "/mksnapshot",
|
||||
- root_build_dir),
|
||||
+ "./" + rebase_path(_mksnapshot_bin, root_build_dir),
|
||||
"--turbo_instruction_scheduling",
|
||||
"--turbo-always-optimize-spills",
|
||||
|
||||
diff --git a/gni/snapshot_toolchain.gni b/gni/snapshot_toolchain.gni
|
||||
index 37ed262640d048a6fa5923279ae0388c1c0ae766..d9830914f0abd919143f0cf8b3069c5a3f70516e 100644
|
||||
--- a/gni/snapshot_toolchain.gni
|
||||
+++ b/gni/snapshot_toolchain.gni
|
||||
@@ -32,6 +32,21 @@ declare_args() {
|
||||
# toolchain that matches the bit-width of the target CPU, but runs on
|
||||
# the host.
|
||||
v8_snapshot_toolchain = ""
|
||||
+
|
||||
+ # When cross-compiling for Windows on a non-Windows host, build mksnapshot
|
||||
+ # as a Windows .exe and run it via Wine instead of building a host-native
|
||||
+ # mksnapshot with cross-compile patches.
|
||||
+ v8_win_cross_compile_using_wine = false
|
||||
+
|
||||
+ # Absolute path to the wine64 binary. Required when
|
||||
+ # v8_win_cross_compile_using_wine is true.
|
||||
+ v8_wine_path = ""
|
||||
+
|
||||
+ # Path to a pre-built mksnapshot binary to use instead of building one from
|
||||
+ # source. When set, run_mksnapshot will use this binary directly and skip
|
||||
+ # building the mksnapshot target. The path should be absolute or relative
|
||||
+ # to the source root.
|
||||
+ v8_prebuilt_mksnapshot = ""
|
||||
}
|
||||
|
||||
# Try to infer the appropriate snapshot toolchain for the v8_current_cpu
|
||||
@@ -69,7 +84,12 @@ if (v8_snapshot_toolchain == "") {
|
||||
# Cross-build from same ISA on one OS to another. For example:
|
||||
# * targeting win/x64 on a linux/x64 host
|
||||
# * targeting win/arm64 on a mac/arm64 host
|
||||
- v8_snapshot_toolchain = host_toolchain
|
||||
+ if (v8_win_cross_compile_using_wine && is_win && host_os != "win") {
|
||||
+ # Build mksnapshot as a Windows .exe and run it via Wine.
|
||||
+ v8_snapshot_toolchain = current_toolchain
|
||||
+ } else {
|
||||
+ v8_snapshot_toolchain = host_toolchain
|
||||
+ }
|
||||
} else if (host_cpu == "arm64" && current_cpu == "x64") {
|
||||
# Cross-build from arm64 to intel (likely on an Apple Silicon mac).
|
||||
v8_snapshot_toolchain =
|
||||
@@ -119,7 +139,13 @@ assert(v8_snapshot_toolchain != "",
|
||||
# We reuse the snapshot toolchain for building torque and other generators to
|
||||
# avoid building v8_libbase on the host more than once. On mips with big endian,
|
||||
# the snapshot toolchain is the target toolchain and, hence, can't be used.
|
||||
-v8_generator_toolchain = v8_snapshot_toolchain
|
||||
+# When using Wine for cross-compilation, mksnapshot is built as a Windows .exe
|
||||
+# but other generators (torque, etc.) must still be host-native binaries.
|
||||
+if (v8_win_cross_compile_using_wine && is_win && host_os != "win") {
|
||||
+ v8_generator_toolchain = host_toolchain
|
||||
+} else {
|
||||
+ v8_generator_toolchain = v8_snapshot_toolchain
|
||||
+}
|
||||
if (host_cpu == "x64" && v8_current_cpu == "mips64") {
|
||||
v8_generator_toolchain = "//build/toolchain/linux:clang_x64"
|
||||
}
|
||||
@@ -9,7 +9,11 @@ elif [ "`uname`" == "Darwin" ]; then
|
||||
BUILD_TYPE="mas"
|
||||
fi
|
||||
elif [ "`uname`" == "Linux" ]; then
|
||||
BUILD_TYPE="linux"
|
||||
if [ "$ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN" == "1" ]; then
|
||||
BUILD_TYPE="win"
|
||||
else
|
||||
BUILD_TYPE="linux"
|
||||
fi
|
||||
else
|
||||
echo "Unsupported platform"
|
||||
exit 1
|
||||
|
||||
@@ -59,6 +59,7 @@ const startServer = async () => {
|
||||
function waitForCrash (): Promise<CrashInfo> {
|
||||
return new Promise(resolve => {
|
||||
emitter.once('crash', (crash) => {
|
||||
console.log('crash fired', crash);
|
||||
resolve(crash);
|
||||
});
|
||||
});
|
||||
@@ -69,6 +70,7 @@ const startServer = async () => {
|
||||
const fields = {} as Record<string, any>;
|
||||
const files = {} as Record<string, Buffer>;
|
||||
busboy.on('file', (fieldname, file) => {
|
||||
console.log('Receiving file for :', fieldname);
|
||||
const chunks = [] as Array<Buffer>;
|
||||
file.on('data', (chunk) => {
|
||||
chunks.push(chunk);
|
||||
@@ -81,10 +83,12 @@ const startServer = async () => {
|
||||
fields[fieldname] = val;
|
||||
});
|
||||
busboy.on('finish', () => {
|
||||
console.log('On finish');
|
||||
// breakpad id must be 16 hex digits.
|
||||
const reportId = Math.random().toString(16).split('.')[1].padStart(16, '0');
|
||||
res.end(reportId, async () => {
|
||||
req.socket.destroy();
|
||||
console.log('Emmitting crash:', fields);
|
||||
emitter.emit('crash', { ...fields, ...files });
|
||||
});
|
||||
});
|
||||
@@ -138,10 +142,15 @@ function waitForNewFileInDir (dir: string): Promise<string[]> {
|
||||
ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_TESTS)('crashReporter module', function () {
|
||||
describe('should send minidump', () => {
|
||||
it('when renderer crashes', async () => {
|
||||
console.log('starting server for renderer crash test');
|
||||
const { port, waitForCrash } = await startServer();
|
||||
console.log('Done starting server for renderer crash test');
|
||||
runCrashApp('renderer', port);
|
||||
console.log('Waiting for renderer crash');
|
||||
const crash = await waitForCrash();
|
||||
console.log('Renderer crash received');
|
||||
checkCrash('renderer', crash);
|
||||
console.log('Renderer crash checked');
|
||||
expect(crash.mainProcessSpecific).to.be.undefined();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user