build: add apple silicon support (#24545)

* chore: add patches to prevent installation of non-arm pip packages

* chore: add patches for apple-silicon

* build: add apple silicon build

* ci: add testing of new arm binary

* chore: remove / update for upstreamed patches

* Skip content tracing on macos on arm

* build: ensure that spec native modules are rebuilt for arm64 on apple-silicon

* chore: fix patches

* chore: fix broken patch

* chore: fix arm64 DCHECK

* build: add MAS arm64 build

* build: disable arm2 tests

* chore: update patches

* build: actually build MAS version of apple silicon app

Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
This commit is contained in:
Samuel Attard 2020-07-17 09:08:44 -07:00 committed by GitHub
parent 6f53457a17
commit f146a164af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 767 additions and 70 deletions

View file

@ -84,6 +84,11 @@ machine-mac-large: &machine-mac-large
macos: macos:
xcode: "11.5.0" xcode: "11.5.0"
machine-mac-large-arm: &machine-mac-large-arm
resource_class: large
macos:
xcode: "12.0.0-UA"
# Build configurations options. # Build configurations options.
env-testing-build: &env-testing-build env-testing-build: &env-testing-build
GN_CONFIG: //electron/build/args/testing.gn GN_CONFIG: //electron/build/args/testing.gn
@ -123,6 +128,10 @@ env-arm: &env-arm
BUILD_NATIVE_MKSNAPSHOT: 1 BUILD_NATIVE_MKSNAPSHOT: 1
TARGET_ARCH: arm TARGET_ARCH: arm
env-apple-silicon: &env-apple-silicon
GN_EXTRA_ARGS: 'target_cpu = "arm64"'
TARGET_ARCH: arm64
env-arm64: &env-arm64 env-arm64: &env-arm64
GN_EXTRA_ARGS: 'target_cpu = "arm64" fatal_linker_warnings = false enable_linux_installer = false' GN_EXTRA_ARGS: 'target_cpu = "arm64" fatal_linker_warnings = false enable_linux_installer = false'
MKSNAPSHOT_TOOLCHAIN: //build/toolchain/linux:clang_arm64 MKSNAPSHOT_TOOLCHAIN: //build/toolchain/linux:clang_arm64
@ -133,6 +142,10 @@ env-mas: &env-mas
GN_EXTRA_ARGS: 'is_mas_build = true' GN_EXTRA_ARGS: 'is_mas_build = true'
MAS_BUILD: 'true' MAS_BUILD: 'true'
env-mas-apple-silicon: &env-mas-apple-silicon
GN_EXTRA_ARGS: 'target_cpu = "arm64" is_mas_build = true'
MAS_BUILD: 'true'
# Misc build configuration options. # Misc build configuration options.
env-enable-sccache: &env-enable-sccache env-enable-sccache: &env-enable-sccache
USE_SCCACHE: true USE_SCCACHE: true
@ -752,8 +765,12 @@ step-maybe-cross-arch-snapshot: &step-maybe-cross-arch-snapshot
export MKSNAPSHOT_PATH="clang_x64_v8_arm64" export MKSNAPSHOT_PATH="clang_x64_v8_arm64"
fi fi
cp "out/Default/$MKSNAPSHOT_PATH/mksnapshot" out/Default cp "out/Default/$MKSNAPSHOT_PATH/mksnapshot" out/Default
cp "out/Default/$MKSNAPSHOT_PATH/libffmpeg.so" out/Default
cp "out/Default/$MKSNAPSHOT_PATH/v8_context_snapshot_generator" out/Default cp "out/Default/$MKSNAPSHOT_PATH/v8_context_snapshot_generator" out/Default
if [ "`uname`" == "Linux" ]; then
cp "out/Default/$MKSNAPSHOT_PATH/libffmpeg.so" out/Default
elif [ "`uname`" == "Darwin" ]; then
cp "out/Default/$MKSNAPSHOT_PATH/libffmpeg.dylib" out/Default
fi
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --create-snapshot-only python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --create-snapshot-only
mkdir cross-arch-snapshots mkdir cross-arch-snapshots
cp out/Default-mksnapshot-test/*.bin cross-arch-snapshots cp out/Default-mksnapshot-test/*.bin cross-arch-snapshots
@ -772,9 +789,14 @@ step-maybe-trigger-arm-test: &step-maybe-trigger-arm-test
# Only run for non-fork prs # Only run for non-fork prs
if [ "$TRIGGER_ARM_TEST" == "true" ] && [ -z "$CIRCLE_PR_NUMBER" ]; then if [ "$TRIGGER_ARM_TEST" == "true" ] && [ -z "$CIRCLE_PR_NUMBER" ]; then
#Trigger VSTS job, passing along CircleCI job number and branch to build #Trigger VSTS job, passing along CircleCI job number and branch to build
if [ "`uname`" == "Darwin" ]; then
echo "Triggering electron-arm2-testing build on Azure DevOps"
node electron/script/release/ci-release-build.js --job=electron-arm2-testing --ci=DevOps --armTest --circleBuildNum=$CIRCLE_BUILD_NUM $CIRCLE_BRANCH
else
echo "Triggering electron-$TARGET_ARCH-testing build on VSTS" echo "Triggering electron-$TARGET_ARCH-testing build on VSTS"
node electron/script/release/ci-release-build.js --job=electron-$TARGET_ARCH-testing --ci=VSTS --armTest --circleBuildNum=$CIRCLE_BUILD_NUM $CIRCLE_BRANCH node electron/script/release/ci-release-build.js --job=electron-$TARGET_ARCH-testing --ci=VSTS --armTest --circleBuildNum=$CIRCLE_BUILD_NUM $CIRCLE_BRANCH
fi fi
fi
step-maybe-generate-typescript-defs: &step-maybe-generate-typescript-defs step-maybe-generate-typescript-defs: &step-maybe-generate-typescript-defs
run: run:
@ -1964,7 +1986,7 @@ jobs:
attach: true attach: true
checkout: false checkout: false
osx-testing: osx-testing-x64:
<<: *machine-mac-large <<: *machine-mac-large
environment: environment:
<<: *env-mac-large <<: *env-mac-large
@ -1979,22 +2001,14 @@ jobs:
checkout-and-assume-cache: true checkout-and-assume-cache: true
attach: false attach: false
osx-testing-gn-check: osx-testing-x64-gn-check:
<<: *machine-mac <<: *machine-mac
environment: environment:
<<: *env-machine-mac <<: *env-machine-mac
<<: *env-testing-build <<: *env-testing-build
<<: *steps-electron-gn-check <<: *steps-electron-gn-check
osx-chromedriver: osx-release-x64:
<<: *machine-mac
environment:
<<: *env-machine-mac
<<: *env-release-build
<<: *env-send-slack-notifications
<<: *steps-chromedriver-build
osx-release:
<<: *machine-mac-large <<: *machine-mac-large
environment: environment:
<<: *env-mac-large <<: *env-mac-large
@ -2008,7 +2022,7 @@ jobs:
checkout-and-assume-cache: true checkout-and-assume-cache: true
attach: false attach: false
osx-publish: osx-publish-x64:
<<: *machine-mac-large <<: *machine-mac-large
environment: environment:
<<: *env-mac-large-release <<: *env-mac-large-release
@ -2021,7 +2035,7 @@ jobs:
attach: false attach: false
checkout: true checkout: true
osx-publish-skip-checkout: osx-publish-x64-skip-checkout:
<<: *machine-mac-large <<: *machine-mac-large
environment: environment:
<<: *env-mac-large-release <<: *env-mac-large-release
@ -2033,7 +2047,23 @@ jobs:
attach: true attach: true
checkout: false checkout: false
mas-testing: osx-testing-arm64:
<<: *machine-mac-large-arm
environment:
<<: *env-mac-large
<<: *env-testing-build
<<: *env-ninja-status
<<: *env-macos-build
<<: *env-apple-silicon
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
steps:
- electron-build:
persist: true
checkout: false
checkout-and-assume-cache: true
attach: false
mas-testing-x64:
<<: *machine-mac-large <<: *machine-mac-large
environment: environment:
<<: *env-mac-large <<: *env-mac-large
@ -2049,7 +2079,7 @@ jobs:
checkout-and-assume-cache: true checkout-and-assume-cache: true
attach: false attach: false
mas-testing-gn-check: mas-testing-x64-gn-check:
<<: *machine-mac <<: *machine-mac
environment: environment:
<<: *env-machine-mac <<: *env-machine-mac
@ -2099,6 +2129,22 @@ jobs:
attach: true attach: true
checkout: false checkout: false
mas-testing-arm64:
<<: *machine-mac-large-arm
environment:
<<: *env-mac-large
<<: *env-testing-build
<<: *env-ninja-status
<<: *env-macos-build
<<: *env-mas-apple-silicon
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
steps:
- electron-build:
persist: true
checkout: false
checkout-and-assume-cache: true
attach: false
# Layer 3: Tests. # Layer 3: Tests.
linux-x64-unittests: linux-x64-unittests:
<<: *machine-linux-2xlarge <<: *machine-linux-2xlarge
@ -2222,7 +2268,7 @@ jobs:
<<: *env-send-slack-notifications <<: *env-send-slack-notifications
<<: *steps-verify-ffmpeg <<: *steps-verify-ffmpeg
osx-testing-tests: osx-testing-x64-tests:
<<: *machine-mac-large <<: *machine-mac-large
environment: environment:
<<: *env-mac-large <<: *env-mac-large
@ -2230,7 +2276,7 @@ jobs:
parallelism: 2 parallelism: 2
<<: *steps-tests <<: *steps-tests
osx-release-tests: osx-release-x64-tests:
<<: *machine-mac-large <<: *machine-mac-large
environment: environment:
<<: *env-mac-large <<: *env-mac-large
@ -2245,7 +2291,7 @@ jobs:
<<: *env-send-slack-notifications <<: *env-send-slack-notifications
<<: *steps-verify-ffmpeg <<: *steps-verify-ffmpeg
mas-testing-tests: mas-testing-x64-tests:
<<: *machine-mac-large <<: *machine-mac-large
environment: environment:
<<: *env-mac-large <<: *env-mac-large
@ -2309,7 +2355,7 @@ jobs:
steps: steps:
- *step-maybe-notify-slack-success - *step-maybe-notify-slack-success
osx-release-summary: osx-release-x64-summary:
<<: *machine-mac <<: *machine-mac
environment: environment:
<<: *env-machine-mac <<: *env-machine-mac
@ -2374,7 +2420,7 @@ workflows:
publish-osx: publish-osx:
when: << pipeline.parameters.run-osx-publish >> when: << pipeline.parameters.run-osx-publish >>
jobs: jobs:
- osx-publish: - osx-publish-x64:
context: release-env context: release-env
publish-mas: publish-mas:
@ -2387,7 +2433,7 @@ workflows:
when: << pipeline.parameters.run-macos-publish >> when: << pipeline.parameters.run-macos-publish >>
jobs: jobs:
- mac-checkout - mac-checkout
- osx-publish-skip-checkout: - osx-publish-x64-skip-checkout:
requires: requires:
- mac-checkout - mac-checkout
- mas-publish-skip-checkout: - mas-publish-skip-checkout:
@ -2445,29 +2491,37 @@ workflows:
- mac-checkout-fast - mac-checkout-fast
- mac-checkout-and-save-cache - mac-checkout-and-save-cache
- osx-testing: - osx-testing-x64:
requires: requires:
- mac-checkout-and-save-cache - mac-checkout-and-save-cache
- osx-testing-gn-check: - osx-testing-x64-gn-check:
requires: requires:
- mac-checkout-fast - mac-checkout-fast
- osx-testing-tests: - osx-testing-x64-tests:
requires: requires:
- osx-testing - osx-testing-x64
- mas-testing: - osx-testing-arm64:
requires: requires:
- mac-checkout-and-save-cache - mac-checkout-and-save-cache
- mas-testing-gn-check: - mas-testing-x64:
requires:
- mac-checkout-and-save-cache
- mas-testing-x64-gn-check:
requires: requires:
- mac-checkout-fast - mac-checkout-fast
- mas-testing-tests: - mas-testing-x64-tests:
requires: requires:
- mas-testing - mas-testing-x64
- mas-testing-arm64:
requires:
- mac-checkout-and-save-cache
nightly-linux-release-test: nightly-linux-release-test:
triggers: triggers:
@ -2531,19 +2585,19 @@ workflows:
- mac-checkout-fast - mac-checkout-fast
- mac-checkout-and-save-cache - mac-checkout-and-save-cache
- osx-release: - osx-release-x64:
requires: requires:
- mac-checkout-and-save-cache - mac-checkout-and-save-cache
- osx-release-tests: - osx-release-x64-tests:
requires: requires:
- osx-release - osx-release-x64
- osx-verify-ffmpeg: - osx-verify-ffmpeg:
requires: requires:
- osx-release - osx-release-x64
- osx-release-summary: - osx-release-x64-summary:
requires: requires:
- osx-release - osx-release-x64
- osx-release-tests - osx-release-x64-tests
- osx-verify-ffmpeg - osx-verify-ffmpeg
- mas-release: - mas-release:

104
azure-pipelines-arm.yml Normal file
View file

@ -0,0 +1,104 @@
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: src/electron'
inputs:
TargetFolder: src/electron
- bash: |
cd src/electron
node script/yarn.js install --frozen-lockfile
displayName: 'Yarn install'
- bash: |
export ZIP_DEST=$PWD/src/out/Default
echo "##vso[task.setvariable variable=ZIP_DEST]$ZIP_DEST"
mkdir -p $ZIP_DEST
cd src/electron
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=dist.zip --dest=$ZIP_DEST
cd $ZIP_DEST
unzip -o dist.zip
displayName: 'Download and unzip dist files for test'
env:
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
- bash: |
export FFMPEG_ZIP_DEST=$PWD/src/out/ffmpeg
mkdir -p $FFMPEG_ZIP_DEST
cd src/electron
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=ffmpeg.zip --dest=$FFMPEG_ZIP_DEST
cd $FFMPEG_ZIP_DEST
unzip -o ffmpeg.zip
displayName: 'Download and unzip ffmpeg for test'
env:
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
- bash: |
export NODE_HEADERS_DEST=$PWD/src/out/Default/gen
mkdir -p $NODE_HEADERS_DEST
cd src/electron
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=node_headers.tar.gz --dest=$NODE_HEADERS_DEST
cd $NODE_HEADERS_DEST
tar xzf node_headers.tar.gz
displayName: 'Download and untar node header files for test'
env:
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
- bash: |
export CROSS_ARCH_SNAPSHOTS=$PWD/src/out/Default/cross-arch-snapshots
mkdir -p $CROSS_ARCH_SNAPSHOTS
cd src/electron
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/snapshot_blob.bin --dest=$CROSS_ARCH_SNAPSHOTS
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/v8_context_snapshot.bin --dest=$CROSS_ARCH_SNAPSHOTS
displayName: 'Download cross arch snapshot files'
env:
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
- bash: |
export NATIVE_UNITTESTS_DEST=$PWD/src/out/Default
cd src/electron
node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=shell_browser_ui_unittests --dest=$NATIVE_UNITTESTS_DEST
chmod +x $NATIVE_UNITTESTS_DEST/shell_browser_ui_unittests
displayName: 'Download native unittest executables'
env:
CIRCLE_TOKEN: $(CIRCLECI_TOKEN)
- bash: |
cd src
export ELECTRON_OUT_DIR=Default
set npm_config_arch=arm64
(cd electron && node script/yarn test -- --enable-logging)
displayName: 'Run Electron tests'
timeoutInMinutes: 20
env:
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
- bash: |
cd src
python electron/script/verify-ffmpeg.py --source-root "$PWD" --build-dir out/Default --ffmpeg-path out/ffmpeg
displayName: Verify non proprietary ffmpeg
timeoutInMinutes: 5
condition: succeededOrFailed()
- bash: |
cd src
echo Verify cross arch snapshot
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --snapshot-files-dir $PWD/out/Default/cross-arch-snapshots
displayName: Verify cross arch snapshot
timeoutInMinutes: 5
condition: succeededOrFailed()
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFiles: '*.xml'
searchFolder: '$(System.DefaultWorkingDirectory)/src/junit/'
condition: succeededOrFailed()
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
displayName: 'Clean Agent Directories'
condition: always()

View file

@ -97,3 +97,8 @@ feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch
use_electron_resources_in_icon_reader_service.patch use_electron_resources_in_icon_reader_service.patch
fix_patch_out_profile_refs_in_accessibility_ui.patch fix_patch_out_profile_refs_in_accessibility_ui.patch
fix_accessibility_label_id_mismatch.patch fix_accessibility_label_id_mismatch.patch
remove_some_deps_that_do_not_work_on_arm64.patch
chore_add_allocator_patches_for_apple_silicon.patch
chore_disable_failing_blink_font_dcheck_on_big_sur.patch
fix_check_issecureeventinputenabled_in_constructor_before_setting.patch
fix_compare_page_size_to_ulong_not_int.patch

View file

@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <marshallofsound@electronjs.org>
Date: Mon, 6 Jul 2020 20:49:19 -0700
Subject: chore: add allocator patches for apple silicon
Once these are available upstream we can remove this patch.
diff --git a/base/mac/mac_util.h b/base/mac/mac_util.h
index e24439cee6c81afc74bfcb557cbdab6785a32794..f84128e76f380a86b74d354787c741c2217b6b69 100644
--- a/base/mac/mac_util.h
+++ b/base/mac/mac_util.h
@@ -132,6 +132,12 @@ DEFINE_IS_OS_FUNCS(15, TEST_DEPLOYMENT_TARGET)
DEFINE_IS_OS_FUNCS(15, IGNORE_DEPLOYMENT_TARGET)
#endif
+#ifdef MAC_OS_X_VERSION_10_16
+DEFINE_IS_OS_FUNCS(16, TEST_DEPLOYMENT_TARGET)
+#else
+DEFINE_IS_OS_FUNCS(16, IGNORE_DEPLOYMENT_TARGET)
+#endif
+
#undef IGNORE_DEPLOYMENT_TARGET
#undef TEST_DEPLOYMENT_TARGET
#undef DEFINE_IS_OS_FUNCS_CR_MIN_REQUIRED

View file

@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <marshallofsound@electronjs.org>
Date: Mon, 6 Jul 2020 20:52:09 -0700
Subject: chore: disable failing blink font DCHECK on Big Sur
Once these are available upstream we can remove this patch.
diff --git a/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm b/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm
index d6abddab51bc95768467b3d84a55e07dec262f26..0678c9d30e162beb9fec6f98ae82e31b042723cf 100644
--- a/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm
+++ b/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm
@@ -59,10 +59,10 @@ bool VariableAxisChangeEffective(SkTypeface* typeface,
return false;
SkFontParameters::Variation::Axis axes_parameters[num_axes];
- int returned_axes =
- typeface->getVariationDesignParameters(axes_parameters, num_axes);
- DCHECK_EQ(num_axes, returned_axes);
- DCHECK_GE(num_axes, 0);
+ // int returned_axes =
+ // typeface->getVariationDesignParameters(axes_parameters, num_axes);
+ // DCHECK_EQ(num_axes, returned_axes);
+ // DCHECK_GE(num_axes, 0);
float clamped_new_value = new_value;
for (auto& axis_parameters : axes_parameters) {

View file

@ -0,0 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <jkleinsc@github.com>
Date: Thu, 9 Jul 2020 11:16:30 -0400
Subject: fix: check IsSecureEventInputEnabled in constructor before setting
SetPasswordInputEnabled to true
It appears that macOS 12 has IsSecureEventInputEnabled set to true initially.
diff --git a/ui/base/cocoa/secure_password_input.mm b/ui/base/cocoa/secure_password_input.mm
index c9d003216ec51407d80b2c3ed0a77e747d203069..f10829d7fe369d2419bb1f0828d6d1ec7c8f57e1 100644
--- a/ui/base/cocoa/secure_password_input.mm
+++ b/ui/base/cocoa/secure_password_input.mm
@@ -41,7 +41,7 @@ void SetPasswordInputEnabled(bool enabled) {
namespace ui {
ScopedPasswordInputEnabler::ScopedPasswordInputEnabler() {
- if (!g_password_input_counter) {
+ if (!g_password_input_counter && !IsSecureEventInputEnabled()) {
SetPasswordInputEnabled(true);
}
++g_password_input_counter;

View file

@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <marshallofsound@electronjs.org>
Date: Tue, 14 Jul 2020 14:51:31 -0700
Subject: fix: compare page size to ulong not int
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2298340
diff --git a/base/process/process_metrics_mac.cc b/base/process/process_metrics_mac.cc
index 6d05c82369f792f5f396dfc4f2c61f49b6585390..8f80975763e8a2e04dbe5864d7d4eaf7460cd119 100644
--- a/base/process/process_metrics_mac.cc
+++ b/base/process/process_metrics_mac.cc
@@ -298,7 +298,7 @@ bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) {
#if defined(ARCH_CPU_ARM64)
// PAGE_SIZE is vm_page_size on arm, which isn't constexpr.
- DCHECK_EQ(PAGE_SIZE % 1024, 0) << "Invalid page size";
+ DCHECK_EQ(PAGE_SIZE % 1024, static_cast<uint64_t>(0)) << "Invalid page size";
#else
static_assert(PAGE_SIZE % 1024 == 0, "Invalid page size");
#endif

View file

@ -0,0 +1,168 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <marshallofsound@electronjs.org>
Date: Mon, 6 Jul 2020 16:59:17 -0700
Subject: remove some deps that do not work on arm64
Once these deps have been fixed upstream we can remove this patch.
diff --git a/.vpython b/.vpython
index 0a28e76064296edea609eb52e57555689c23c0a3..bea6a9b7ee4b64dcc44b6f345a83e28d1d22649c 100644
--- a/.vpython
+++ b/.vpython
@@ -53,10 +53,10 @@ wheel: <
#
# This version must be compatible with the version range specified by
# //third_party/catapult/telemetry/telemetry/internal/util/external_modules.py
-wheel: <
- name: "infra/python/wheels/psutil/${vpython_platform}"
- version: "version:5.2.2"
->
+#wheel: <
+# name: "infra/python/wheels/psutil/${vpython_platform}"
+# version: "version:5.2.2"
+#>
# Used by:
# third_party/catapult
@@ -67,37 +67,37 @@ wheel: <
# This version must also be compatible with the "numpy" version, as "cv2"
# depends on "numpy". In this case, OpenCV@2.4.13.2 has been built against
# numpy@1.11.3.
-wheel: <
- name: "infra/python/wheels/opencv_python/${vpython_platform}"
- version: "version:2.4.13.2"
- match_tag: <
- platform: "win32"
- >
- match_tag: <
- platform: "win_amd64"
- >
- match_tag: <
- abi: "cp27mu"
- platform: "manylinux1_i686"
- >
- match_tag: <
- abi: "cp27mu"
- platform: "manylinux1_x86_64"
- >
- match_tag: <
- platform: "macosx_10_6_intel"
- >
->
+#wheel: <
+# name: "infra/python/wheels/opencv_python/${vpython_platform}"
+# version: "version:2.4.13.2"
+# match_tag: <
+# platform: "win32"
+# >
+# match_tag: <
+# platform: "win_amd64"
+# >
+# match_tag: <
+# abi: "cp27mu"
+# platform: "manylinux1_i686"
+# >
+# match_tag: <
+# abi: "cp27mu"
+# platform: "manylinux1_x86_64"
+# >
+# match_tag: <
+# platform: "macosx_10_6_intel"
+# >
+#>
# Used by:
# third_party/catapult
#
# This version must be compatible with the version range specified by
# //third_party/catapult/telemetry/telemetry/internal/util/external_modules.py
-wheel: <
- name: "infra/python/wheels/numpy/${vpython_platform}"
- version: "version:1.11.3"
->
+#wheel: <
+# name: "infra/python/wheels/numpy/${vpython_platform}"
+# version: "version:1.11.3"
+#>
# Used by:
# third_party/catapult
@@ -132,10 +132,10 @@ wheel: <
# Used by:
# testing/buildbot/generate_buildbot_json_coveragetest.py
-wheel: <
- name: "infra/python/wheels/coverage/${vpython_platform}"
- version: "version:4.3.4"
->
+#wheel: <
+# name: "infra/python/wheels/coverage/${vpython_platform}"
+# version: "version:4.3.4"
+#>
# Used by:
# build/android/pylib/local/emulator/avd.py
@@ -166,27 +166,27 @@ wheel: <
# Used by:
# tools/perf/flakiness_cli
-wheel: <
- name: "infra/python/wheels/pandas/${vpython_platform}"
- version: "version:0.23.4"
- match_tag: <
- platform: "win32"
- >
- match_tag: <
- platform: "win_amd64"
- >
- match_tag: <
- abi: "cp27mu"
- platform: "manylinux1_i686"
- >
- match_tag: <
- abi: "cp27mu"
- platform: "manylinux1_x86_64"
- >
- match_tag: <
- platform: "macosx_10_6_intel"
- >
->
+#wheel: <
+# name: "infra/python/wheels/pandas/${vpython_platform}"
+# version: "version:0.23.4"
+# match_tag: <
+# platform: "win32"
+# >
+# match_tag: <
+# platform: "win_amd64"
+# >
+# match_tag: <
+# abi: "cp27mu"
+# platform: "manylinux1_i686"
+# >
+# match_tag: <
+# abi: "cp27mu"
+# platform: "manylinux1_x86_64"
+# >
+# match_tag: <
+# platform: "macosx_10_6_intel"
+# >
+#>
wheel: <
name: "infra/python/wheels/pytz-py2_py3"
version: "version:2018.4"
@@ -268,10 +268,10 @@ wheel <
name: "infra/python/wheels/funcsigs-py2_py3"
version: "version:1.0.2"
>
-wheel: <
- name: "infra/python/wheels/psutil/${vpython_platform}"
- version: "version:5.2.2"
->
+#wheel: <
+# name: "infra/python/wheels/psutil/${vpython_platform}"
+# version: "version:5.2.2"
+#>
# Used by:
# tools/infra

View file

@ -9,5 +9,7 @@
"src/electron/patches/squirrel.mac": "src/third_party/squirrel.mac", "src/electron/patches/squirrel.mac": "src/third_party/squirrel.mac",
"src/electron/patches/ReactiveObjC": "src/third_party/squirrel.mac/vendor/ReactiveObjC" "src/electron/patches/ReactiveObjC": "src/third_party/squirrel.mac/vendor/ReactiveObjC",
"src/electron/patches/depot_tools": "src/third_party/depot_tools"
} }

View file

@ -0,0 +1 @@
remove_some_deps_that_do_not_work_on_arm64.patch

View file

@ -0,0 +1,54 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <samuel@Samuels-Mac.local>
Date: Mon, 6 Jul 2020 14:47:55 -0700
Subject: remove some deps that do not work on arm64
Once these deps have newly built arm64 versions we can remove this patch.
diff --git a/gsutil.vpython b/gsutil.vpython
index 8a2a38aac8e154199a1431a95b1d620052c8d770..0d9d92cd5f93c1f771253a4542c0548e7f002c10 100644
--- a/gsutil.vpython
+++ b/gsutil.vpython
@@ -25,19 +25,19 @@ wheel <
# "gsutil" on non-GCE can require PyOpenSSL, which, in turn, requires
# "cryptography".
-wheel: <
- name: "infra/python/wheels/pyopenssl-py2_py3"
- version: "version:17.2.0"
->
+#wheel: <
+# name: "infra/python/wheels/pyopenssl-py2_py3"
+# version: "version:17.2.0"
+#>
##
# BEGIN "cryptography" dependencies.
##
-wheel: <
- name: "infra/python/wheels/cryptography/${platform}_${py_python}_${py_abi}"
- version: "version:2.0.3"
->
+#wheel: <
+# name: "infra/python/wheels/cryptography/${platform}_${py_python}_${py_abi}"
+# version: "version:2.0.3"
+#>
wheel: <
name: "infra/python/wheels/appdirs-py2_py3"
@@ -54,10 +54,10 @@ wheel: <
version: "version:1.1.6"
>
-wheel: <
- name: "infra/python/wheels/cffi/${platform}_${py_python}_${py_abi}"
- version: "version:1.10.0"
->
+#wheel: <
+# name: "infra/python/wheels/cffi/${platform}_${py_python}_${py_abi}"
+# version: "version:1.10.0"
+#>
wheel: <
name: "infra/python/wheels/idna-py2_py3"

View file

@ -7,3 +7,5 @@ workaround_an_undefined_symbol_error.patch
do_not_export_private_v8_symbols_on_windows.patch do_not_export_private_v8_symbols_on_windows.patch
revert_cleanup_switch_offset_of_to_offsetof_where_possible.patch revert_cleanup_switch_offset_of_to_offsetof_where_possible.patch
fix_build_deprecated_attirbute_for_older_msvc_versions.patch fix_build_deprecated_attirbute_for_older_msvc_versions.patch
chore_add_v8_apple_silicon_patches.patch
fix_use_proper_page_size_for_mac_arm64.patch

View file

@ -0,0 +1,134 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <marshallofsound@electronjs.org>
Date: Mon, 6 Jul 2020 20:47:43 -0700
Subject: chore: add v8 apple silicon patches
Once these are available upstream we can remove this patch.
diff --git a/src/codegen/arm64/macro-assembler-arm64.cc b/src/codegen/arm64/macro-assembler-arm64.cc
index 2d3e27e5302f40466917ca5ce28bd787d14d8fe9..d0d55a25a62c255096cfb0348beaae02e5549e87 100644
--- a/src/codegen/arm64/macro-assembler-arm64.cc
+++ b/src/codegen/arm64/macro-assembler-arm64.cc
@@ -2973,6 +2973,35 @@ void TurboAssembler::PrintfNoPreserve(const char* format,
int arg_count = kPrintfMaxArgCount;
+#if V8_OS_MACOSX && !USE_SIMULATOR
+ CPURegList tmp_list = kCallerSaved;
+ tmp_list.Remove(x0); // Used to pass the format string.
+ tmp_list.Remove(arg0, arg1, arg2, arg3);
+
+ // Override the MacroAssembler's scratch register list. The lists will be
+ // reset automatically at the end of the UseScratchRegisterScope.
+ UseScratchRegisterScope temps(this);
+ TmpList()->set_list(tmp_list.list());
+
+ VRegister temp_D = temps.AcquireD();
+
+ // https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html#//apple_ref/doc/uid/TP40013702-SW1
+ Claim(kPrintfMaxArgCount, 8);
+ int64_t offset = 0;
+ for (unsigned i = 0; i < kPrintfMaxArgCount; i++) {
+ CPURegister arg = args[i];
+ if (arg.IsNone()) {
+ break;
+ }
+ if (arg.IsS()) {
+ fcvt(temp_D, arg.S());
+ arg = temp_D;
+ }
+ // FIXME: Use stp.
+ str(arg, MemOperand(sp, offset, Offset));
+ offset += 8;
+ }
+#else
// The PCS varargs registers for printf. Note that x0 is used for the printf
// format string.
static const CPURegList kPCSVarargs =
@@ -3083,7 +3112,7 @@ void TurboAssembler::PrintfNoPreserve(const char* format,
}
#endif
}
-
+#endif
// Load the format string into x0, as per the procedure-call standard.
//
// To make the code as portable as possible, the format string is encoded
@@ -3105,6 +3134,10 @@ void TurboAssembler::PrintfNoPreserve(const char* format,
}
CallPrintf(arg_count, pcs);
+
+#if V8_OS_MACOSX && !USE_SIMULATOR
+ Drop(kPrintfMaxArgCount, 8);
+#endif
}
void TurboAssembler::CallPrintf(int arg_count, const CPURegister* args) {
diff --git a/src/compiler/backend/arm64/instruction-selector-arm64.cc b/src/compiler/backend/arm64/instruction-selector-arm64.cc
index 1737c7f8e121c967de6da8bfd17dcebd121d9dd5..58ec3108a8ea5888ba31f4b5c7c4939e1c1718ea 100644
--- a/src/compiler/backend/arm64/instruction-selector-arm64.cc
+++ b/src/compiler/backend/arm64/instruction-selector-arm64.cc
@@ -1864,6 +1864,7 @@ void InstructionSelector::EmitPrepareArguments(
// Poke the arguments into the stack.
while (slot >= 0) {
+ // FIXME: In the Apple ARM64 ABI parameters should be packed on the stack.
PushParameter input0 = (*arguments)[slot];
PushParameter input1 = slot > 0 ? (*arguments)[slot - 1] : PushParameter();
// Emit a poke-pair if consecutive parameters have the same type.
diff --git a/src/flags/flag-definitions.h b/src/flags/flag-definitions.h
index d4a1ad0920a45e0d704e4ed8a01fdad59fcde6e1..32c25712c6490984bd59cf4125feec98050cc61d 100644
--- a/src/flags/flag-definitions.h
+++ b/src/flags/flag-definitions.h
@@ -710,7 +710,12 @@ DEFINE_INT(wasm_num_compilation_tasks, 128,
"maximum number of parallel compilation tasks for wasm")
DEFINE_DEBUG_BOOL(trace_wasm_native_heap, false,
"trace wasm native heap events")
-DEFINE_BOOL(wasm_write_protect_code_memory, false,
+#if V8_OS_MACOSX && V8_TARGET_ARCH_ARM64
+#define V8_DEFAULT_WASM_WRITE_PROTECT_CODE_MEMORY true
+#else
+#define V8_DEFAULT_WASM_WRITE_PROTECT_CODE_MEMORY false
+#endif
+DEFINE_BOOL(wasm_write_protect_code_memory, V8_DEFAULT_WASM_WRITE_PROTECT_CODE_MEMORY,
"write protect code memory on the wasm native heap")
DEFINE_DEBUG_BOOL(trace_wasm_serialization, false,
"trace serialization/deserialization")
diff --git a/src/wasm/function-compiler.cc b/src/wasm/function-compiler.cc
index e268667d2870a0f8fc370e14d3a846b623dae197..95d4318cf9baf895bea58991d4c2f58e4f07e23d 100644
--- a/src/wasm/function-compiler.cc
+++ b/src/wasm/function-compiler.cc
@@ -260,6 +260,7 @@ void WasmCompilationUnit::CompileWasmFunction(Isolate* isolate,
isolate->counters(), detected);
if (result.succeeded()) {
WasmCodeRefScope code_ref_scope;
+ NativeModuleModificationScope native_module_modification_scope(native_module);
native_module->PublishCode(
native_module->AddCompiledCode(std::move(result)));
} else {
diff --git a/src/wasm/wasm-code-manager.h b/src/wasm/wasm-code-manager.h
index d76adccad7667665da2723dac1b30e4956dfd98a..1b802d7e4382f61c8a622234c6d1314e8fcbac96 100644
--- a/src/wasm/wasm-code-manager.h
+++ b/src/wasm/wasm-code-manager.h
@@ -851,7 +851,7 @@ class V8_EXPORT_PRIVATE WasmCodeManager final {
// and even if we did, the resulting set of pages may be fragmented.
// Currently, we try and keep the number of syscalls low.
// - similar argument for debug time.
-class NativeModuleModificationScope final {
+class V8_EXPORT_PRIVATE NativeModuleModificationScope final {
public:
explicit NativeModuleModificationScope(NativeModule* native_module);
~NativeModuleModificationScope();
diff --git a/src/wasm/wasm-objects.cc b/src/wasm/wasm-objects.cc
index 1d85bb3ff79557442dc416587769b5f8fcfa77fb..bdd7ef4c45a3908ff234ecf136e153c31dbc2ba9 100644
--- a/src/wasm/wasm-objects.cc
+++ b/src/wasm/wasm-objects.cc
@@ -1447,6 +1447,7 @@ void WasmInstanceObject::ImportWasmJSFunctionIntoTable(
wasm::CompilationEnv env = native_module->CreateCompilationEnv();
wasm::WasmCompilationResult result = compiler::CompileWasmImportCallWrapper(
isolate->wasm_engine(), &env, kind, sig, false);
+ wasm::NativeModuleModificationScope native_module_modification_scope(native_module);
std::unique_ptr<wasm::WasmCode> wasm_code = native_module->AddCode(
result.func_index, result.code_desc, result.frame_slot_count,
result.tagged_parameter_slots,

View file

@ -0,0 +1,65 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <jkleinsc@github.com>
Date: Wed, 8 Jul 2020 10:46:13 -0400
Subject: fix: use proper page size for mac arm64
This fix temporarily sets page size to 16k for mac arm64 so that mksnapshot can run on x64
and generate a mac arm64 snapshot
diff --git a/src/base/platform/platform-posix.cc b/src/base/platform/platform-posix.cc
index 238750bab16b619d017bddce584b1c8257e5a6dc..89716d0ac4d354615411374dcef5b2d381804e50 100644
--- a/src/base/platform/platform-posix.cc
+++ b/src/base/platform/platform-posix.cc
@@ -147,9 +147,19 @@ int GetFlagsForMemoryPermission(OS::MemoryPermission access) {
void* Allocate(void* hint, size_t size, OS::MemoryPermission access) {
int prot = GetProtectionFromMemoryPermission(access);
int flags = GetFlagsForMemoryPermission(access);
+#if defined(__APPLE__) && V8_TARGET_ARCH_ARM64 && defined(__x86_64__)
+ // XXX: This logic is simple and leaky as it is only used for mksnapshot.
+ size_t alignment = 16384;
+ void* result = mmap(hint, size + alignment, prot, flags, kMmapFd,
+ kMmapFdOffset);
+ if (result == MAP_FAILED) return nullptr;
+ return reinterpret_cast<void*>(
+ RoundUp(reinterpret_cast<uintptr_t>(result), alignment));
+#else
void* result = mmap(hint, size, prot, flags, kMmapFd, kMmapFdOffset);
if (result == MAP_FAILED) return nullptr;
return result;
+#endif
}
#endif // !V8_OS_FUCHSIA
@@ -206,7 +216,9 @@ void OS::Initialize(bool hard_abort, const char* const gc_fake_mmap) {
}
int OS::ActivationFrameAlignment() {
-#if V8_TARGET_ARCH_ARM
+#if defined(__APPLE__) && V8_TARGET_ARCH_ARM
+ return 4;
+#elif V8_TARGET_ARCH_ARM
// On EABI ARM targets this is required for fp correctness in the
// runtime system.
return 8;
@@ -226,13 +238,21 @@ int OS::ActivationFrameAlignment() {
// static
size_t OS::AllocatePageSize() {
+#if defined(__APPLE__) && V8_TARGET_ARCH_ARM64 && defined(__x86_64__)
+ return 16384;
+#else
return static_cast<size_t>(sysconf(_SC_PAGESIZE));
+#endif
}
// static
size_t OS::CommitPageSize() {
+#if defined(__APPLE__) && V8_TARGET_ARCH_ARM64 && defined(__x86_64__)
+ return 16384;
+#else
static size_t page_size = getpagesize();
return page_size;
+#endif
}
// static

View file

@ -6,6 +6,7 @@ const request = require('request');
const BUILD_APPVEYOR_URL = 'https://ci.appveyor.com/api/builds'; const BUILD_APPVEYOR_URL = 'https://ci.appveyor.com/api/builds';
const CIRCLECI_PIPELINE_URL = 'https://circleci.com/api/v2/project/gh/electron/electron/pipeline'; const CIRCLECI_PIPELINE_URL = 'https://circleci.com/api/v2/project/gh/electron/electron/pipeline';
const VSTS_URL = 'https://github.visualstudio.com/electron/_apis/build'; const VSTS_URL = 'https://github.visualstudio.com/electron/_apis/build';
const DEVOPS_URL = 'https://dev.azure.com/electron-ci/electron/_apis/build';
const CIRCLECI_WAIT_TIME = process.env.CIRCLECI_WAIT_TIME || 30000; const CIRCLECI_WAIT_TIME = process.env.CIRCLECI_WAIT_TIME || 30000;
const appVeyorJobs = { const appVeyorJobs = {
@ -30,6 +31,7 @@ const circleCIPublishWorkflows = [
const vstsArmJobs = [ const vstsArmJobs = [
'electron-arm-testing', 'electron-arm-testing',
'electron-arm2-testing',
'electron-arm64-testing', 'electron-arm64-testing',
'electron-woa-testing' 'electron-woa-testing'
]; ];
@ -249,45 +251,43 @@ function buildCircleCI (targetBranch, options) {
} }
async function buildVSTS (targetBranch, options) { async function buildVSTS (targetBranch, options) {
if (options.armTest) { assert(options.armTest, `${options.ci} only works with the --armTest option.`);
assert(vstsArmJobs.includes(options.job), `Unknown VSTS CI arm test job name: ${options.job}. Valid values are: ${vstsArmJobs}.`); assert(vstsArmJobs.includes(options.job), `Unknown VSTS CI arm test job name: ${options.job}. Valid values are: ${vstsArmJobs}.`);
}
console.log(`Triggering VSTS to run build on branch: ${targetBranch} with release flag.`); console.log(`Triggering VSTS to run build on branch: ${targetBranch}.`);
const environmentVariables = { const environmentVariables = {};
ELECTRON_RELEASE: 1
};
if (options.armTest) {
if (options.circleBuildNum) { if (options.circleBuildNum) {
environmentVariables.CIRCLE_BUILD_NUM = options.circleBuildNum; environmentVariables.CIRCLE_BUILD_NUM = options.circleBuildNum;
} else if (options.appveyorJobId) { } else if (options.appveyorJobId) {
environmentVariables.APPVEYOR_JOB_ID = options.appveyorJobId; environmentVariables.APPVEYOR_JOB_ID = options.appveyorJobId;
} }
} else {
if (!options.ghRelease) {
environmentVariables.UPLOAD_TO_S3 = 1;
}
}
let vstsURL = VSTS_URL;
let vstsToken = process.env.VSTS_TOKEN;
if (options.ci === 'DevOps') {
vstsURL = DEVOPS_URL;
vstsToken = process.env.DEVOPS_TOKEN;
}
const requestOpts = { const requestOpts = {
url: `${VSTS_URL}/definitions?api-version=4.1`, url: `${vstsURL}/definitions?api-version=4.1`,
auth: { auth: {
user: '', user: '',
password: process.env.VSTS_TOKEN password: vstsToken
}, },
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
}; };
jobRequestedCount++;
const vstsResponse = await makeRequest(requestOpts, true).catch(err => { const vstsResponse = await makeRequest(requestOpts, true).catch(err => {
console.log('Error calling VSTS to get build definitions:', err); console.log('Error calling VSTS to get build definitions:', err);
}); });
const buildsToRun = vstsResponse.value.filter(build => build.name === options.job); const buildToRun = vstsResponse.value.find(build => build.name === options.job);
buildsToRun.forEach((build) => callVSTSBuild(build, targetBranch, environmentVariables)); callVSTSBuild(buildToRun, targetBranch, environmentVariables, vstsURL, vstsToken);
} }
async function callVSTSBuild (build, targetBranch, environmentVariables) { async function callVSTSBuild (build, targetBranch, environmentVariables, vstsURL, vstsToken) {
const buildBody = { const buildBody = {
definition: build, definition: build,
sourceBranch: targetBranch, sourceBranch: targetBranch,
@ -297,10 +297,10 @@ async function callVSTSBuild (build, targetBranch, environmentVariables) {
buildBody.parameters = JSON.stringify(environmentVariables); buildBody.parameters = JSON.stringify(environmentVariables);
} }
const requestOpts = { const requestOpts = {
url: `${VSTS_URL}/builds?api-version=4.1`, url: `${vstsURL}/builds?api-version=4.1`,
auth: { auth: {
user: '', user: '',
password: process.env.VSTS_TOKEN password: vstsToken
}, },
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@ -308,7 +308,6 @@ async function callVSTSBuild (build, targetBranch, environmentVariables) {
body: JSON.stringify(buildBody), body: JSON.stringify(buildBody),
method: 'POST' method: 'POST'
}; };
jobRequestedCount++;
const vstsResponse = await makeRequest(requestOpts, true).catch(err => { const vstsResponse = await makeRequest(requestOpts, true).catch(err => {
console.log(`Error calling VSTS for job ${build.name}`, err); console.log(`Error calling VSTS for job ${build.name}`, err);
}); });
@ -326,6 +325,7 @@ function runRelease (targetBranch, options) {
buildAppVeyor(targetBranch, options); buildAppVeyor(targetBranch, options);
break; break;
} }
case 'DevOps':
case 'VSTS': { case 'VSTS': {
buildVSTS(targetBranch, options); buildVSTS(targetBranch, options);
break; break;
@ -351,7 +351,7 @@ if (require.main === module) {
const targetBranch = args._[0]; const targetBranch = args._[0];
if (args._.length < 1) { if (args._.length < 1) {
console.log(`Trigger CI to build release builds of electron. console.log(`Trigger CI to build release builds of electron.
Usage: ci-release-build.js [--job=CI_JOB_NAME] [--ci=CircleCI|AppVeyor|VSTS] Usage: ci-release-build.js [--job=CI_JOB_NAME] [--ci=CircleCI|AppVeyor|VSTS|DevOps]
[--ghRelease] [--armTest] [--circleBuildNum=xxx] [--appveyorJobId=xxx] TARGET_BRANCH [--ghRelease] [--armTest] [--circleBuildNum=xxx] [--appveyorJobId=xxx] TARGET_BRANCH
`); `);
process.exit(0); process.exit(0);

View file

@ -2,7 +2,7 @@
const childProcess = require('child_process'); const childProcess = require('child_process');
const crypto = require('crypto'); const crypto = require('crypto');
const fs = require('fs'); const fs = require('fs-extra');
const { hashElement } = require('folder-hash'); const { hashElement } = require('folder-hash');
const path = require('path'); const path = require('path');
const unknownFlags = []; const unknownFlags = [];
@ -225,6 +225,9 @@ async function installSpecModules (dir) {
npm_config_nodedir: nodeDir, npm_config_nodedir: nodeDir,
npm_config_msvs_version: '2019' npm_config_msvs_version: '2019'
}); });
if (fs.existsSync(path.resolve(dir, 'node_modules'))) {
await fs.remove(path.resolve(dir, 'node_modules'));
}
const { status } = childProcess.spawnSync(NPX_CMD, [`yarn@${YARN_VERSION}`, 'install', '--frozen-lockfile'], { const { status } = childProcess.spawnSync(NPX_CMD, [`yarn@${YARN_VERSION}`, 'install', '--frozen-lockfile'], {
env, env,
cwd: dir, cwd: dir,
@ -234,6 +237,19 @@ async function installSpecModules (dir) {
console.log(`${fail} Failed to yarn install in '${dir}'`); console.log(`${fail} Failed to yarn install in '${dir}'`);
process.exit(1); process.exit(1);
} }
// TODO(MarshallOfSound): Remove once node-gyp supports arm64
if (process.platform === 'darwin' && process.env.npm_config_arch === 'arm64') {
for (const nodeModule of fs.readdirSync(path.resolve(dir, 'node_modules'))) {
if (fs.existsSync(path.resolve(dir, 'node_modules', nodeModule, 'binding.gyp'))) {
childProcess.spawnSync(NPX_CMD, ['https://github.com/MarshallOfSound/node-gyp/archive/apple-silicon.tar.gz', 'clean', 'configure', 'build', '--arch=arm64'], {
env,
cwd: path.resolve(dir, 'node_modules', nodeModule),
stdio: 'inherit'
});
}
}
}
} }
function getSpecHash () { function getSpecHash () {
@ -244,6 +260,7 @@ function getSpecHash () {
hasher.update(fs.readFileSync(path.resolve(__dirname, '../spec-main/package.json'))); hasher.update(fs.readFileSync(path.resolve(__dirname, '../spec-main/package.json')));
hasher.update(fs.readFileSync(path.resolve(__dirname, '../spec/yarn.lock'))); hasher.update(fs.readFileSync(path.resolve(__dirname, '../spec/yarn.lock')));
hasher.update(fs.readFileSync(path.resolve(__dirname, '../spec-main/yarn.lock'))); hasher.update(fs.readFileSync(path.resolve(__dirname, '../spec-main/yarn.lock')));
hasher.update(fs.readFileSync(path.resolve(__dirname, '../script/spec-runner.js')));
return hasher.digest('hex'); return hasher.digest('hex');
})(), })(),
(async () => { (async () => {

View file

@ -5,7 +5,7 @@ import * as path from 'path';
import { ifdescribe, delay } from './spec-helpers'; import { ifdescribe, delay } from './spec-helpers';
// FIXME: The tests are skipped on arm/arm64. // FIXME: The tests are skipped on arm/arm64.
ifdescribe(!(process.platform === 'linux' && ['arm', 'arm64'].includes(process.arch)))('contentTracing', () => { ifdescribe(!(process.platform !== 'win32' && ['arm', 'arm64'].includes(process.arch)))('contentTracing', () => {
const record = async (options: TraceConfig | TraceCategoriesAndOptions, outputFilePath: string | undefined, recordTimeInMilliseconds = 1e1) => { const record = async (options: TraceConfig | TraceCategoriesAndOptions, outputFilePath: string | undefined, recordTimeInMilliseconds = 1e1) => {
await app.whenReady(); await app.whenReady();