mirror of
https://github.com/electron/electron.git
synced 2026-02-26 03:01:17 -05:00
Compare commits
314 Commits
refactor/a
...
v33.4.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1686a38c2a | ||
|
|
f49816e855 | ||
|
|
c29c430dd2 | ||
|
|
e0e3cb1fb1 | ||
|
|
32d08728ee | ||
|
|
ff3793aa71 | ||
|
|
3225fd9af5 | ||
|
|
9801b99076 | ||
|
|
551d301c98 | ||
|
|
e08f067d53 | ||
|
|
98900a48f2 | ||
|
|
c6e4e4cdd6 | ||
|
|
65d1bf2d44 | ||
|
|
29ec38de49 | ||
|
|
1d946b1aca | ||
|
|
d7c6e0358d | ||
|
|
6dc985382d | ||
|
|
cee1499093 | ||
|
|
c5f4a6c44b | ||
|
|
cea9ebb8e9 | ||
|
|
faf3ff9219 | ||
|
|
2e256e301d | ||
|
|
eee1b523dd | ||
|
|
3980b0f8e4 | ||
|
|
f647a02a1b | ||
|
|
f8bfeb3d61 | ||
|
|
03ceb38f25 | ||
|
|
3b4d991fd4 | ||
|
|
35dd10bd26 | ||
|
|
155359e0de | ||
|
|
ccf3ba075e | ||
|
|
2c52a3d692 | ||
|
|
b3bf094787 | ||
|
|
e2380d5ec3 | ||
|
|
2226d68ced | ||
|
|
7f00c5c00e | ||
|
|
39390d70c0 | ||
|
|
8f8351dbaa | ||
|
|
02d1f557cb | ||
|
|
611b980612 | ||
|
|
0a0c320ca6 | ||
|
|
13ae29f8e1 | ||
|
|
503b5eaad0 | ||
|
|
2c96e1612e | ||
|
|
91e569e822 | ||
|
|
f360dadbb4 | ||
|
|
64a1ede1a6 | ||
|
|
715f15736c | ||
|
|
4dd027fb74 | ||
|
|
61cd32a8bd | ||
|
|
133336f803 | ||
|
|
1c4596e0cf | ||
|
|
24d77baeeb | ||
|
|
dd82356e25 | ||
|
|
9d2e0f688c | ||
|
|
3fa59b9b9c | ||
|
|
be88dbd361 | ||
|
|
ebe380a2fc | ||
|
|
48aba26aac | ||
|
|
dd85ddce20 | ||
|
|
fcf396ff91 | ||
|
|
17a9ae14bc | ||
|
|
5e1d54396d | ||
|
|
4d12984d52 | ||
|
|
eb931e2789 | ||
|
|
d313fc00b4 | ||
|
|
c09f82764a | ||
|
|
0cf9bdcfca | ||
|
|
7cd00f143b | ||
|
|
e672dd4628 | ||
|
|
237e486589 | ||
|
|
39e85d9a50 | ||
|
|
fa20da8fe4 | ||
|
|
4062d18270 | ||
|
|
0af5ec3758 | ||
|
|
0dde916ae5 | ||
|
|
d1fe7d2227 | ||
|
|
e1d9df224c | ||
|
|
7d2d5240bd | ||
|
|
19c8b0f01f | ||
|
|
baeabc03a3 | ||
|
|
f618fb2359 | ||
|
|
2120828e3b | ||
|
|
4286610961 | ||
|
|
217a6c03b2 | ||
|
|
e76893eaed | ||
|
|
8c3b2e7b9d | ||
|
|
ae3d1ccdef | ||
|
|
73e791475b | ||
|
|
90890e20c0 | ||
|
|
0fe5035395 | ||
|
|
f22baeb670 | ||
|
|
cd6e3d720f | ||
|
|
7152209fb5 | ||
|
|
51e31de79e | ||
|
|
fe3467e187 | ||
|
|
d0e24fca25 | ||
|
|
3483cd62d7 | ||
|
|
1ef8b47052 | ||
|
|
71c11496b7 | ||
|
|
bd5c8d7a92 | ||
|
|
52b5d8ab99 | ||
|
|
1329e22fce | ||
|
|
5b9fbb2e19 | ||
|
|
c0e51c8646 | ||
|
|
bf13656e44 | ||
|
|
c014819673 | ||
|
|
f0de0348d5 | ||
|
|
c5a820bd31 | ||
|
|
8255e4e8d2 | ||
|
|
8e03e1d4a9 | ||
|
|
0010d976c5 | ||
|
|
0c42bf5743 | ||
|
|
b293c3b23f | ||
|
|
bc7ab508b1 | ||
|
|
3d658dfa59 | ||
|
|
8b2496af1a | ||
|
|
43e449c8a7 | ||
|
|
14af0370d8 | ||
|
|
72115c1948 | ||
|
|
24874c6adc | ||
|
|
0fd7b33640 | ||
|
|
941965016e | ||
|
|
b88e1aba10 | ||
|
|
e95e6fac0d | ||
|
|
3eb1f02adb | ||
|
|
040e9c317e | ||
|
|
eddae27077 | ||
|
|
5e07ab9728 | ||
|
|
3e4c5dcc28 | ||
|
|
2f20dbea55 | ||
|
|
c9d026e19b | ||
|
|
65cd09ffaf | ||
|
|
c8dc8717a4 | ||
|
|
6e44a274e9 | ||
|
|
743fe6f4b4 | ||
|
|
bd81baaf04 | ||
|
|
6e1d940ef3 | ||
|
|
be69311692 | ||
|
|
fcf0c115cb | ||
|
|
4fad573746 | ||
|
|
c600be6439 | ||
|
|
a7ab89ee9e | ||
|
|
7930412006 | ||
|
|
8b38c78e94 | ||
|
|
f3a2c1dee7 | ||
|
|
50eb34423f | ||
|
|
03acaade4e | ||
|
|
532e5cc1f6 | ||
|
|
ae9f2df082 | ||
|
|
4507774c51 | ||
|
|
4f13824bc9 | ||
|
|
b184a5668b | ||
|
|
828d29526a | ||
|
|
b0614f80d7 | ||
|
|
cab11e6de0 | ||
|
|
d435ff9128 | ||
|
|
a6b34dca26 | ||
|
|
ec070e57e0 | ||
|
|
359cfecce0 | ||
|
|
6b79679e5b | ||
|
|
964c1a1df8 | ||
|
|
3b3f72e974 | ||
|
|
64fd436375 | ||
|
|
34045394e0 | ||
|
|
777d447018 | ||
|
|
e0d14a6d89 | ||
|
|
739df86774 | ||
|
|
9a087b9c56 | ||
|
|
8b3f2c5d7c | ||
|
|
ad9bf6b041 | ||
|
|
32822cd747 | ||
|
|
e1419b2fdf | ||
|
|
11c2b61011 | ||
|
|
6b458c78b0 | ||
|
|
77324ff514 | ||
|
|
63d1d9cb65 | ||
|
|
dd5bce17cb | ||
|
|
258a4a76cf | ||
|
|
f269ca1d93 | ||
|
|
7887395e92 | ||
|
|
9011532b2e | ||
|
|
afce3ce7c7 | ||
|
|
eb90fb3b9e | ||
|
|
6964b79e68 | ||
|
|
5bb1bb9b7a | ||
|
|
78cb71f7b1 | ||
|
|
c9474ef5da | ||
|
|
5244fcecd3 | ||
|
|
af5901bc6a | ||
|
|
4e6e77d696 | ||
|
|
9469efb4c9 | ||
|
|
8cbe09d412 | ||
|
|
e9cb85bea6 | ||
|
|
479caedc8a | ||
|
|
86d86768b3 | ||
|
|
bd0277923f | ||
|
|
dd8c3b8dd9 | ||
|
|
6074f7ed31 | ||
|
|
7b14a305f8 | ||
|
|
0646cbfba6 | ||
|
|
8af5c6d130 | ||
|
|
ac10ddaa48 | ||
|
|
fc9cda72d2 | ||
|
|
52a8d133cd | ||
|
|
e019b37231 | ||
|
|
c8788f8217 | ||
|
|
4d16326b4d | ||
|
|
5836ea1a78 | ||
|
|
d8cd86c4fa | ||
|
|
a44059aa05 | ||
|
|
73c1413374 | ||
|
|
ce2163da2f | ||
|
|
481f9b25a7 | ||
|
|
9ca68e2b8c | ||
|
|
9ef7ec02e5 | ||
|
|
e32e85abb2 | ||
|
|
6973af4f7a | ||
|
|
625d950e32 | ||
|
|
d62097e067 | ||
|
|
ad8f2f8d5d | ||
|
|
53cc8aef9b | ||
|
|
0ffafbc295 | ||
|
|
134176a1d1 | ||
|
|
d2bd4cf91c | ||
|
|
1af736bc15 | ||
|
|
f609d77e29 | ||
|
|
ae6d5c4661 | ||
|
|
cdcfe49592 | ||
|
|
d35b848f95 | ||
|
|
ff65b58e2c | ||
|
|
dddcc09185 | ||
|
|
8fa00dbe1a | ||
|
|
eda8205424 | ||
|
|
c4921d2592 | ||
|
|
723015db29 | ||
|
|
7d108a163f | ||
|
|
7f473f2fba | ||
|
|
95caa1f0bd | ||
|
|
45a7a5d22c | ||
|
|
3232505c55 | ||
|
|
b896dbb103 | ||
|
|
3ee3844bdb | ||
|
|
78ede09ecd | ||
|
|
5c92ea76e9 | ||
|
|
68869c18cd | ||
|
|
d3cfe7aacb | ||
|
|
753cf3d409 | ||
|
|
3a4664f836 | ||
|
|
948a28fdb8 | ||
|
|
48d4adedaa | ||
|
|
a27df94f71 | ||
|
|
888928887c | ||
|
|
4ee00641eb | ||
|
|
12bb7093e2 | ||
|
|
6b4f269d22 | ||
|
|
d11c840cf0 | ||
|
|
18bd295873 | ||
|
|
748f293400 | ||
|
|
7a04a77ed0 | ||
|
|
810a6d6ef4 | ||
|
|
27aea84411 | ||
|
|
2aa2611f76 | ||
|
|
57aeb9dfc6 | ||
|
|
454218bd2b | ||
|
|
c56673f83d | ||
|
|
87fc32f0aa | ||
|
|
c7380437aa | ||
|
|
511dece7ff | ||
|
|
12ce546ded | ||
|
|
67da1f2f9f | ||
|
|
8d9ed52c72 | ||
|
|
8d76b8dba9 | ||
|
|
6f68a40430 | ||
|
|
cf8a97a924 | ||
|
|
37a7cb2c11 | ||
|
|
d92770a275 | ||
|
|
60264f30d8 | ||
|
|
b31a4dcdf3 | ||
|
|
1d3200d7da | ||
|
|
bf10a437bc | ||
|
|
60247e685d | ||
|
|
5d340577b6 | ||
|
|
40316df338 | ||
|
|
e92eb210bb | ||
|
|
f30c9120a1 | ||
|
|
986a621bfc | ||
|
|
6172e1d2b9 | ||
|
|
0ee624c308 | ||
|
|
d8e46cdd50 | ||
|
|
bcf948595d | ||
|
|
66fa1f4665 | ||
|
|
1fcd981e5e | ||
|
|
9a3618e912 | ||
|
|
d55e120038 | ||
|
|
26d6f62c01 | ||
|
|
d769f1ea71 | ||
|
|
f08c6f2e85 | ||
|
|
824b1aeb71 | ||
|
|
ddc19e3ea0 | ||
|
|
d9aa185ec5 | ||
|
|
3169351511 | ||
|
|
75ce3ac6a2 | ||
|
|
656a86169a | ||
|
|
e08be7d8ce | ||
|
|
150d332f10 | ||
|
|
85bac873e7 | ||
|
|
706d416284 | ||
|
|
0a1e906aa8 | ||
|
|
cd944384e2 | ||
|
|
dbd7840254 | ||
|
|
6263a39d9a | ||
|
|
5134328872 | ||
|
|
2d240453de |
@@ -2,7 +2,7 @@ version: '3'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
buildtools:
|
buildtools:
|
||||||
image: ghcr.io/electron/devcontainer:9a43c14f5c19be0359843299f79e736521373adc
|
image: ghcr.io/electron/devcontainer:77262e58c37631ab082482f42c33cdf68c6c394b
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ..:/workspaces/gclient/src/electron:cached
|
- ..:/workspaces/gclient/src/electron:cached
|
||||||
|
|||||||
@@ -19,7 +19,40 @@
|
|||||||
"prefer-const": ["error", {
|
"prefer-const": ["error", {
|
||||||
"destructuring": "all"
|
"destructuring": "all"
|
||||||
}],
|
}],
|
||||||
"standard/no-callback-literal": "off"
|
"n/no-callback-literal": "off",
|
||||||
|
"import/newline-after-import": "error",
|
||||||
|
"import/order": ["error", {
|
||||||
|
"alphabetize": {
|
||||||
|
"order": "asc"
|
||||||
|
},
|
||||||
|
"newlines-between": "always",
|
||||||
|
"pathGroups": [
|
||||||
|
{
|
||||||
|
"pattern": "@electron/internal/**",
|
||||||
|
"group": "external",
|
||||||
|
"position": "before"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pattern": "@electron/**",
|
||||||
|
"group": "external",
|
||||||
|
"position": "before"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pattern": "{electron,electron/**}",
|
||||||
|
"group": "external",
|
||||||
|
"position": "before"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pathGroupsExcludedImportTypes": [],
|
||||||
|
"distinctGroup": true,
|
||||||
|
"groups": [
|
||||||
|
"external",
|
||||||
|
"builtin",
|
||||||
|
["sibling", "parent"],
|
||||||
|
"index",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
}]
|
||||||
},
|
},
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 6,
|
"ecmaVersion": 6,
|
||||||
|
|||||||
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -1,6 +1,8 @@
|
|||||||
# `git apply` and friends don't understand CRLF, even on windows. Force those
|
# `git apply` and friends don't understand CRLF, even on windows. Force those
|
||||||
# files to be checked out with LF endings even if core.autocrlf is true.
|
# files to be checked out with LF endings even if core.autocrlf is true.
|
||||||
*.patch text eol=lf
|
DEPS text eol=lf
|
||||||
|
yarn.lock text eol=lf
|
||||||
|
script/zip_manifests/*.manifest text eol=lf
|
||||||
patches/**/.patches merge=union
|
patches/**/.patches merge=union
|
||||||
|
|
||||||
# Source code and markdown files should always use LF as line ending.
|
# Source code and markdown files should always use LF as line ending.
|
||||||
|
|||||||
71
.github/actions/build-electron/action.yml
vendored
71
.github/actions/build-electron/action.yml
vendored
@@ -5,10 +5,10 @@ inputs:
|
|||||||
description: 'Target arch'
|
description: 'Target arch'
|
||||||
required: true
|
required: true
|
||||||
target-platform:
|
target-platform:
|
||||||
description: 'Target platform'
|
description: 'Target platform, should be linux, win, macos'
|
||||||
required: true
|
required: true
|
||||||
artifact-platform:
|
artifact-platform:
|
||||||
description: 'Artifact platform, should be linux, darwin or mas'
|
description: 'Artifact platform, should be linux, win, darwin or mas'
|
||||||
required: true
|
required: true
|
||||||
step-suffix:
|
step-suffix:
|
||||||
description: 'Suffix for build steps'
|
description: 'Suffix for build steps'
|
||||||
@@ -63,15 +63,15 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
cd src
|
cd src
|
||||||
electron/script/copy-debug-symbols.py --target-cpu="${{ inputs.target-arch }}" --out-dir=out/Default/debug --compress
|
electron/script/copy-debug-symbols.py --target-cpu="${{ inputs.target-arch }}" --out-dir=out/Default/debug --compress
|
||||||
electron/script/strip-binaries.py --target-cpu="${{ inputs.target-arch }}"
|
electron/script/strip-binaries.py --target-cpu="${{ inputs.target-arch }}" --verbose
|
||||||
electron/script/add-debug-link.py --target-cpu="${{ inputs.target-arch }}" --debug-dir=out/Default/debug
|
electron/script/add-debug-link.py --target-cpu="${{ inputs.target-arch }}" --debug-dir=out/Default/debug
|
||||||
- name: Build Electron dist.zip ${{ inputs.step-suffix }}
|
- name: Build Electron dist.zip ${{ inputs.step-suffix }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd src
|
cd src
|
||||||
e build electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES
|
e build --target electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||||
if [ "${{ inputs.is-asan }}" != "true" ]; then
|
if [ "${{ inputs.is-asan }}" != "true" ]; then
|
||||||
target_os=${{ inputs.target-platform == 'linux' && 'linux' || 'mac'}}
|
target_os=${{ inputs.target-platform == 'macos' && 'mac' || inputs.target-platform }}
|
||||||
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
|
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
|
||||||
target_os="${target_os}_mas"
|
target_os="${target_os}_mas"
|
||||||
fi
|
fi
|
||||||
@@ -81,8 +81,8 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd src
|
cd src
|
||||||
e build electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
|
e build --target electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
|
||||||
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
|
ELECTRON_DEPOT_TOOLS_DISABLE_LOG=1 e d gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
|
||||||
# Remove unused args from mksnapshot_args
|
# Remove unused args from mksnapshot_args
|
||||||
SEDOPTION="-i"
|
SEDOPTION="-i"
|
||||||
if [ "`uname`" = "Darwin" ]; then
|
if [ "`uname`" = "Darwin" ]; then
|
||||||
@@ -91,7 +91,7 @@ runs:
|
|||||||
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
|
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
|
||||||
sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
|
sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
|
||||||
|
|
||||||
if [ "`uname`" = "Linux" ]; then
|
if [ "${{ inputs.target-platform }}" = "linux" ]; then
|
||||||
if [ "${{ inputs.target-arch }}" = "arm" ]; then
|
if [ "${{ inputs.target-arch }}" = "arm" ]; then
|
||||||
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/mksnapshot
|
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/mksnapshot
|
||||||
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/v8_context_snapshot_generator
|
electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/v8_context_snapshot_generator
|
||||||
@@ -104,8 +104,16 @@ runs:
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
e build electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
|
e build --target electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||||
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
|
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
|
||||||
- name: Generate Cross-Arch Snapshot (arm/arm64) ${{ inputs.step-suffix }}
|
- name: Generate Cross-Arch Snapshot (arm/arm64) ${{ inputs.step-suffix }}
|
||||||
shell: bash
|
shell: bash
|
||||||
if: ${{ (inputs.target-arch == 'arm' || inputs.target-arch == 'arm64') && inputs.target-platform == 'linux' }}
|
if: ${{ (inputs.target-arch == 'arm' || inputs.target-arch == 'arm64') && inputs.target-platform == 'linux' }}
|
||||||
@@ -130,24 +138,43 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd src
|
cd src
|
||||||
e build electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
|
e build --target electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
|
||||||
e build electron:electron_chromedriver_zip
|
e build --target electron:electron_chromedriver_zip
|
||||||
- name: Build Node.js headers ${{ inputs.step-suffix }}
|
- name: Build Node.js headers ${{ inputs.step-suffix }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd src
|
cd src
|
||||||
e build electron:node_headers
|
e build --target electron:node_headers
|
||||||
|
- 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' }}
|
||||||
|
run: |
|
||||||
|
cd src
|
||||||
|
python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
|
||||||
|
- name: Add msdia140.dll to Path ${{ inputs.step-suffix }}
|
||||||
|
shell: bash
|
||||||
|
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
|
||||||
|
run: |
|
||||||
|
# Needed for msdia140.dll on 64-bit windows
|
||||||
|
cd src
|
||||||
|
export PATH="$PATH:$(pwd)/third_party/llvm-build/Release+Asserts/bin"
|
||||||
- name: Generate & Zip Symbols ${{ inputs.step-suffix }}
|
- name: Generate & Zip Symbols ${{ inputs.step-suffix }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
# Generate breakpad symbols on release builds
|
# Generate breakpad symbols on release builds
|
||||||
if [ "${{ inputs.generate-symbols }}" = "true" ]; then
|
if [ "${{ inputs.generate-symbols }}" = "true" ]; then
|
||||||
e build electron:electron_symbols
|
e build --target electron:electron_symbols
|
||||||
fi
|
fi
|
||||||
cd src
|
cd src
|
||||||
export BUILD_PATH="$(pwd)/out/Default"
|
export BUILD_PATH="$(pwd)/out/Default"
|
||||||
e build electron:licenses
|
e build --target electron:licenses
|
||||||
e build electron:electron_version_file
|
e build --target electron:electron_version_file
|
||||||
if [ "${{ inputs.is-release }}" = "true" ]; then
|
if [ "${{ inputs.is-release }}" = "true" ]; then
|
||||||
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
|
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
|
||||||
else
|
else
|
||||||
@@ -159,21 +186,19 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
cd src
|
cd src
|
||||||
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS"
|
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS"
|
||||||
autoninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES
|
e build --target electron:electron_ffmpeg_zip -C ../../out/ffmpeg -j $NUMBER_OF_NINJA_PROCESSES
|
||||||
- name: Generate Hunspell Dictionaries ${{ inputs.step-suffix }}
|
- name: Generate Hunspell Dictionaries ${{ inputs.step-suffix }}
|
||||||
shell: bash
|
shell: bash
|
||||||
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
|
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
|
||||||
run: |
|
run: |
|
||||||
cd src
|
e build --target electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||||
autoninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
|
|
||||||
- name: Generate Libcxx ${{ inputs.step-suffix }}
|
- name: Generate Libcxx ${{ inputs.step-suffix }}
|
||||||
shell: bash
|
shell: bash
|
||||||
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
|
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
|
||||||
run: |
|
run: |
|
||||||
cd src
|
e build --target electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||||
autoninja -C out/Default electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
|
e build --target electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||||
autoninja -C out/Default electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
|
e build --target electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
|
||||||
autoninja -C out/Default electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
|
|
||||||
- name: Generate TypeScript Definitions ${{ inputs.step-suffix }}
|
- name: Generate TypeScript Definitions ${{ inputs.step-suffix }}
|
||||||
if: ${{ inputs.is-release == 'true' }}
|
if: ${{ inputs.is-release == 'true' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
85
.github/actions/checkout/action.yml
vendored
85
.github/actions/checkout/action.yml
vendored
@@ -5,6 +5,10 @@ inputs:
|
|||||||
description: 'Whether to generate and persist a SAS token for the item in the cache'
|
description: 'Whether to generate and persist a SAS token for the item in the cache'
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
use-cache:
|
||||||
|
description: 'Whether to persist the cache to the shared drive'
|
||||||
|
required: false
|
||||||
|
default: 'true'
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
@@ -13,31 +17,29 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
|
echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
shell: bash
|
uses: ./src/electron/.github/actions/install-dependencies
|
||||||
run: |
|
- name: Install Build Tools
|
||||||
cd src/electron
|
uses: ./src/electron/.github/actions/install-build-tools
|
||||||
node script/yarn install --frozen-lockfile
|
- name: Set Chromium Git Cookie
|
||||||
|
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||||
- name: Get Depot Tools
|
- name: Get Depot Tools
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
if [[ ! -d depot_tools ]]; then
|
||||||
|
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||||
|
|
||||||
sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
|
# Ensure depot_tools does not update.
|
||||||
# Remove swift-format dep from cipd on macOS until we send a patch upstream.
|
test -d depot_tools && cd depot_tools
|
||||||
cd depot_tools
|
touch .disable_auto_update
|
||||||
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
|
fi
|
||||||
|
|
||||||
# Ensure depot_tools does not update.
|
|
||||||
test -d depot_tools && cd depot_tools
|
|
||||||
touch .disable_auto_update
|
|
||||||
- name: Add Depot Tools to PATH
|
- name: Add Depot Tools to PATH
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
||||||
- name: Generate DEPS Hash
|
- name: Generate DEPS Hash
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
|
node src/electron/script/generate-deps-hash.js
|
||||||
echo "DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
|
echo "DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)" >> $GITHUB_ENV
|
||||||
- name: Generate SAS Key
|
- name: Generate SAS Key
|
||||||
if: ${{ inputs.generate-sas-token == 'true' }}
|
if: ${{ inputs.generate-sas-token == 'true' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -45,7 +47,7 @@ runs:
|
|||||||
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$DEPSHASH.tar" > sas-token
|
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$DEPSHASH.tar" > sas-token
|
||||||
- name: Save SAS Key
|
- name: Save SAS Key
|
||||||
if: ${{ inputs.generate-sas-token == 'true' }}
|
if: ${{ inputs.generate-sas-token == 'true' }}
|
||||||
uses: actions/cache/save@v4
|
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
sas-token
|
sas-token
|
||||||
@@ -54,27 +56,49 @@ runs:
|
|||||||
id: check-cache
|
id: check-cache
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
|
if [[ "${{ inputs.use-cache }}" == "false" ]]; then
|
||||||
echo "Using cache key: $DEPSHASH"
|
echo "Not using cache this time..."
|
||||||
echo "Checking for cache in: $cache_path"
|
|
||||||
if [ ! -f "$cache_path" ]; then
|
|
||||||
echo "cache_exists=false" >> $GITHUB_OUTPUT
|
echo "cache_exists=false" >> $GITHUB_OUTPUT
|
||||||
echo "Cache Does Not Exist for $DEPSHASH"
|
|
||||||
else
|
else
|
||||||
echo "cache_exists=true" >> $GITHUB_OUTPUT
|
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
|
||||||
echo "Cache Already Exists for $DEPSHASH, Skipping.."
|
echo "Using cache key: $DEPSHASH"
|
||||||
|
echo "Checking for cache in: $cache_path"
|
||||||
|
if [ ! -f "$cache_path" ] || [ `du $cache_path | cut -f1` = "0" ]; then
|
||||||
|
echo "cache_exists=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "Cache Does Not Exist for $DEPSHASH"
|
||||||
|
else
|
||||||
|
echo "cache_exists=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Cache Already Exists for $DEPSHASH, Skipping.."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
- name: Check cross instance cache disk space
|
||||||
|
if: steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# if there is less than 35 GB free space then creating the cache might fail so exit early
|
||||||
|
freespace=`df -m /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
|
||||||
|
freespace_human=`df -h /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
|
||||||
|
if [ $freespace -le 35000 ]; then
|
||||||
|
echo "The cross mount cache has $freespace_human free space which is not enough - exiting"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "The cross mount cache has $freespace_human free space - continuing"
|
||||||
fi
|
fi
|
||||||
- name: Gclient Sync
|
- name: Gclient Sync
|
||||||
if: steps.check-cache.outputs.cache_exists == 'false'
|
if: steps.check-cache.outputs.cache_exists == 'false'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
gclient config \
|
e d gclient config \
|
||||||
--name "src/electron" \
|
--name "src/electron" \
|
||||||
--unmanaged \
|
--unmanaged \
|
||||||
${GCLIENT_EXTRA_ARGS} \
|
${GCLIENT_EXTRA_ARGS} \
|
||||||
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
|
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
|
||||||
|
|
||||||
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags -vvvvv
|
if [ "$TARGET_OS" != "" ]; then
|
||||||
|
echo "target_os=['$TARGET_OS']" >> ./.gclient
|
||||||
|
fi
|
||||||
|
|
||||||
|
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 e d gclient sync --with_branch_heads --with_tags -vv
|
||||||
if [ "${{ inputs.is-release }}" != "true" && -n "${{ env.PATCH_UP_APP_CREDS }}" ]; then
|
if [ "${{ inputs.is-release }}" != "true" && -n "${{ env.PATCH_UP_APP_CREDS }}" ]; then
|
||||||
# Re-export all the patches to check if there were changes.
|
# Re-export all the patches to check if there were changes.
|
||||||
python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
|
python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
|
||||||
@@ -115,13 +139,13 @@ runs:
|
|||||||
# https://dawn-review.googlesource.com/c/dawn/+/83901
|
# https://dawn-review.googlesource.com/c/dawn/+/83901
|
||||||
# TODO: maybe better to always leave out */.git/HEAD file for all targets ?
|
# TODO: maybe better to always leave out */.git/HEAD file for all targets ?
|
||||||
- name: Delete .git directories under src to free space
|
- name: Delete .git directories under src to free space
|
||||||
if: steps.check-cache.outputs.cache_exists == 'false'
|
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd src
|
cd src
|
||||||
( find . -type d -name ".git" -not -path "./third_party/angle/*" -not -path "./third_party/dawn/*" -not -path "./electron/*" ) | xargs rm -rf
|
( find . -type d -name ".git" -not -path "./third_party/angle/*" -not -path "./third_party/dawn/*" -not -path "./electron/*" ) | xargs rm -rf
|
||||||
- name: Minimize Cache Size for Upload
|
- name: Minimize Cache Size for Upload
|
||||||
if: steps.check-cache.outputs.cache_exists == 'false'
|
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
rm -rf src/android_webview
|
rm -rf src/android_webview
|
||||||
@@ -132,9 +156,12 @@ runs:
|
|||||||
rm -rf src/third_party/angle/third_party/VK-GL-CTS/src
|
rm -rf src/third_party/angle/third_party/VK-GL-CTS/src
|
||||||
rm -rf src/third_party/swift-toolchain
|
rm -rf src/third_party/swift-toolchain
|
||||||
rm -rf src/third_party/swiftshader/tests/regres/testlists
|
rm -rf src/third_party/swiftshader/tests/regres/testlists
|
||||||
|
cp src/electron/.github/actions/checkout/action.yml ./
|
||||||
rm -rf src/electron
|
rm -rf src/electron
|
||||||
|
mkdir -p src/electron/.github/actions/checkout
|
||||||
|
mv action.yml src/electron/.github/actions/checkout
|
||||||
- name: Compress Src Directory
|
- name: Compress Src Directory
|
||||||
if: steps.check-cache.outputs.cache_exists == 'false'
|
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "Uncompressed src size: $(du -sh src | cut -f1 -d' ')"
|
echo "Uncompressed src size: $(du -sh src | cut -f1 -d' ')"
|
||||||
@@ -142,7 +169,7 @@ runs:
|
|||||||
echo "Compressed src to $(du -sh $DEPSHASH.tar | cut -f1 -d' ')"
|
echo "Compressed src to $(du -sh $DEPSHASH.tar | cut -f1 -d' ')"
|
||||||
cp ./$DEPSHASH.tar /mnt/cross-instance-cache/
|
cp ./$DEPSHASH.tar /mnt/cross-instance-cache/
|
||||||
- name: Persist Src Cache
|
- name: Persist Src Cache
|
||||||
if: steps.check-cache.outputs.cache_exists == 'false'
|
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
final_cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
|
final_cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
|
||||||
|
|||||||
24
.github/actions/generate-types/action.yml
vendored
Normal file
24
.github/actions/generate-types/action.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
name: 'Generate Types for Archaeologist Dig'
|
||||||
|
description: 'Generate Types for Archaeologist Dig'
|
||||||
|
inputs:
|
||||||
|
sha-file:
|
||||||
|
description: 'File containing sha'
|
||||||
|
required: true
|
||||||
|
filename:
|
||||||
|
description: 'Filename to write types to'
|
||||||
|
required: true
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Generating Types for SHA in ${{ inputs.sha-file }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
git checkout $(cat ${{ inputs.sha-file }})
|
||||||
|
rm -rf node_modules
|
||||||
|
yarn install --frozen-lockfile --ignore-scripts
|
||||||
|
echo "#!/usr/bin/env node\nglobal.x=1" > node_modules/typescript/bin/tsc
|
||||||
|
node node_modules/.bin/electron-docs-parser --dir=./ --outDir=./ --moduleVersion=0.0.0-development
|
||||||
|
node node_modules/.bin/electron-typescript-definitions --api=electron-api.json --outDir=artifacts
|
||||||
|
mv artifacts/electron.d.ts artifacts/${{ inputs.filename }}
|
||||||
|
git checkout .
|
||||||
|
working-directory: ./electron
|
||||||
11
.github/actions/install-build-tools/action.yml
vendored
11
.github/actions/install-build-tools/action.yml
vendored
@@ -6,6 +6,15 @@ runs:
|
|||||||
- name: Install Build Tools
|
- name: Install Build Tools
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
export BUILD_TOOLS_SHA=d5b87591842be19058e8d75d2c5b7f1fabe9f450
|
if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then
|
||||||
|
git config --global core.filemode false
|
||||||
|
git config --global core.autocrlf false
|
||||||
|
git config --global branch.autosetuprebase always
|
||||||
|
fi
|
||||||
|
export BUILD_TOOLS_SHA=8246e57791b0af4ae5975eb96f09855f9269b1cd
|
||||||
npm i -g @electron/build-tools
|
npm i -g @electron/build-tools
|
||||||
e auto-update disable
|
e auto-update disable
|
||||||
|
if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then
|
||||||
|
e d cipd.bat --version
|
||||||
|
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
|
||||||
|
fi
|
||||||
|
|||||||
21
.github/actions/install-dependencies/action.yml
vendored
Normal file
21
.github/actions/install-dependencies/action.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
name: 'Install Dependencies'
|
||||||
|
description: 'Installs yarn depdencies using cache when available'
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Get yarn cache directory path
|
||||||
|
shell: bash
|
||||||
|
id: yarn-cache-dir-path
|
||||||
|
run: echo "dir=$(node src/electron/script/yarn cache dir)" >> $GITHUB_OUTPUT
|
||||||
|
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
|
||||||
|
id: yarn-cache
|
||||||
|
with:
|
||||||
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-yarn-${{ hashFiles('src/electron/yarn.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-yarn-
|
||||||
|
- name: Install Dependencies
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd src/electron
|
||||||
|
node script/yarn install --frozen-lockfile --prefer-offline
|
||||||
5
.github/actions/restore-cache-aks/action.yml
vendored
5
.github/actions/restore-cache-aks/action.yml
vendored
@@ -17,6 +17,11 @@ runs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Persisted cache is $(du -sh $cache_path | cut -f1)"
|
echo "Persisted cache is $(du -sh $cache_path | cut -f1)"
|
||||||
|
if [ `du $cache_path | cut -f1` = "0" ]; then
|
||||||
|
echo "Cache is empty - exiting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir temp-cache
|
mkdir temp-cache
|
||||||
tar -xf $cache_path -C temp-cache
|
tar -xf $cache_path -C temp-cache
|
||||||
echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)"
|
echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)"
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ runs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Obtain SAS Key
|
- name: Obtain SAS Key
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
|
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
sas-token
|
sas-token
|
||||||
key: sas-key-${{ github.run_number }}-1
|
key: sas-key-${{ github.run_number }}-1
|
||||||
- name: Obtain SAS Key
|
- name: Obtain SAS Key
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
|
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
sas-token
|
sas-token
|
||||||
@@ -44,6 +44,11 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "Downloaded cache is $(du -sh $DEPSHASH.tar | cut -f1)"
|
echo "Downloaded cache is $(du -sh $DEPSHASH.tar | cut -f1)"
|
||||||
|
if [ `du $DEPSHASH.tar | cut -f1` = "0" ]; then
|
||||||
|
echo "Cache is empty - exiting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir temp-cache
|
mkdir temp-cache
|
||||||
tar -xf $DEPSHASH.tar -C temp-cache
|
tar -xf $DEPSHASH.tar -C temp-cache
|
||||||
echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)"
|
echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)"
|
||||||
|
|||||||
26
.github/actions/set-chromium-cookie/action.yml
vendored
Normal file
26
.github/actions/set-chromium-cookie/action.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: 'Set Chromium Git Cookie'
|
||||||
|
description: 'Sets an authenticated cookie from Chromium to allow for a higher request limit'
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Set the git cookie from chromium.googlesource.com (Unix)
|
||||||
|
if: ${{ runner.os != 'Windows' && env.CHROMIUM_GIT_COOKIE }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
eval 'set +o history' 2>/dev/null || setopt HIST_IGNORE_SPACE 2>/dev/null
|
||||||
|
touch ~/.gitcookies
|
||||||
|
chmod 0600 ~/.gitcookies
|
||||||
|
|
||||||
|
git config --global http.cookiefile ~/.gitcookies
|
||||||
|
|
||||||
|
tr , \\t <<\__END__ >>~/.gitcookies
|
||||||
|
${{ env.CHROMIUM_GIT_COOKIE }}
|
||||||
|
__END__
|
||||||
|
eval 'set -o history' 2>/dev/null || unsetopt HIST_IGNORE_SPACE 2>/dev/null
|
||||||
|
- name: Set the git cookie from chromium.googlesource.com (Windows)
|
||||||
|
if: ${{ runner.os == 'Windows' && env.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
git config --global http.cookiefile "%USERPROFILE%\.gitcookies"
|
||||||
|
powershell -noprofile -nologo -command Write-Output "${{ env.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}" >>"%USERPROFILE%\.gitcookies"
|
||||||
|
|
||||||
61
.github/workflows/archaeologist-dig.yml
vendored
Normal file
61
.github/workflows/archaeologist-dig.yml
vendored
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
name: Archaeologist
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
archaeologist-dig:
|
||||||
|
name: Archaeologist Dig
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Electron
|
||||||
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 #v4.0.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setting Up Dig Site
|
||||||
|
run: |
|
||||||
|
echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}"
|
||||||
|
echo "sha ${{ github.event.pull_request.head.sha }}"
|
||||||
|
echo "base ref ${{ github.event.pull_request.base.ref }}"
|
||||||
|
git clone https://github.com/electron/electron.git electron
|
||||||
|
cd electron
|
||||||
|
mkdir -p artifacts
|
||||||
|
git remote add fork ${{ github.event.pull_request.head.repo.clone_url }} && git fetch fork
|
||||||
|
git checkout ${{ github.event.pull_request.head.sha }}
|
||||||
|
git merge-base origin/${{ github.event.pull_request.base.ref }} HEAD > .dig-old
|
||||||
|
echo ${{ github.event.pull_request.head.sha }} > .dig-new
|
||||||
|
cp .dig-old artifacts
|
||||||
|
|
||||||
|
- name: Generating Types for SHA in .dig-new
|
||||||
|
uses: ./.github/actions/generate-types
|
||||||
|
with:
|
||||||
|
sha-file: .dig-new
|
||||||
|
filename: electron.new.d.ts
|
||||||
|
- name: Generating Types for SHA in .dig-old
|
||||||
|
uses: ./.github/actions/generate-types
|
||||||
|
with:
|
||||||
|
sha-file: .dig-old
|
||||||
|
filename: electron.old.d.ts
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 #v4.4.0
|
||||||
|
with:
|
||||||
|
name: artifacts
|
||||||
|
path: electron/artifacts
|
||||||
|
include-hidden-files: true
|
||||||
|
- name: Set job output
|
||||||
|
run: |
|
||||||
|
git diff --no-index electron.old.d.ts electron.new.d.ts > patchfile || true
|
||||||
|
if [ -s patchfile ]; then
|
||||||
|
echo "Changes Detected"
|
||||||
|
echo "## Changes Detected" > $GITHUB_STEP_SUMMARY
|
||||||
|
echo "Looks like the \`electron.d.ts\` file changed." >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "\`\`\`\`\`\`diff" >> $GITHUB_STEP_SUMMARY
|
||||||
|
cat patchfile >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "\`\`\`\`\`\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
else
|
||||||
|
echo "No Changes Detected"
|
||||||
|
echo "## No Changes" > $GITHUB_STEP_SUMMARY
|
||||||
|
echo "We couldn't see any changes in the \`electron.d.ts\` artifact" >> $GITHUB_STEP_SUMMARY
|
||||||
|
fi
|
||||||
|
working-directory: ./electron/artifacts
|
||||||
160
.github/workflows/build.yml
vendored
160
.github/workflows/build.yml
vendored
@@ -6,7 +6,7 @@ on:
|
|||||||
build-image-sha:
|
build-image-sha:
|
||||||
type: string
|
type: string
|
||||||
description: 'SHA for electron/build image'
|
description: 'SHA for electron/build image'
|
||||||
default: 'cf814a4d2501e8e843caea071a6b70a48e78b855'
|
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
|
||||||
required: true
|
required: true
|
||||||
skip-macos:
|
skip-macos:
|
||||||
type: boolean
|
type: boolean
|
||||||
@@ -18,6 +18,11 @@ on:
|
|||||||
description: 'Skip Linux builds'
|
description: 'Skip Linux builds'
|
||||||
default: false
|
default: false
|
||||||
required: false
|
required: false
|
||||||
|
skip-windows:
|
||||||
|
type: boolean
|
||||||
|
description: 'Skip Windows builds'
|
||||||
|
default: false
|
||||||
|
required: false
|
||||||
skip-lint:
|
skip-lint:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: 'Skip lint check'
|
description: 'Skip lint check'
|
||||||
@@ -28,7 +33,11 @@ on:
|
|||||||
- main
|
- main
|
||||||
- '[1-9][0-9]-x-y'
|
- '[1-9][0-9]-x-y'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
setup:
|
setup:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -40,7 +49,9 @@ jobs:
|
|||||||
build-image-sha: ${{ steps.set-output.outputs.build-image-sha }}
|
build-image-sha: ${{ steps.set-output.outputs.build-image-sha }}
|
||||||
docs-only: ${{ steps.set-output.outputs.docs-only }}
|
docs-only: ${{ steps.set-output.outputs.docs-only }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.0.2
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.0.2
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
id: filter
|
id: filter
|
||||||
with:
|
with:
|
||||||
@@ -53,7 +64,7 @@ jobs:
|
|||||||
id: set-output
|
id: set-output
|
||||||
run: |
|
run: |
|
||||||
if [ -z "${{ inputs.build-image-sha }}" ]; then
|
if [ -z "${{ inputs.build-image-sha }}" ]; then
|
||||||
echo "build-image-sha=cf814a4d2501e8e843caea071a6b70a48e78b855" >> "$GITHUB_OUTPUT"
|
echo "build-image-sha=bc2f48b2415a670de18d13605b1cf0eb5fdbaae1" >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
|
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
@@ -89,15 +100,17 @@ jobs:
|
|||||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||||
- /var/run/sas:/var/run/sas
|
- /var/run/sas:/var/run/sas
|
||||||
env:
|
env:
|
||||||
|
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||||
outputs:
|
outputs:
|
||||||
build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
|
build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
- name: Checkout & Sync & Save
|
- name: Checkout & Sync & Save
|
||||||
uses: ./src/electron/.github/actions/checkout
|
uses: ./src/electron/.github/actions/checkout
|
||||||
with:
|
with:
|
||||||
@@ -114,19 +127,81 @@ jobs:
|
|||||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||||
- /var/run/sas:/var/run/sas
|
- /var/run/sas:/var/run/sas
|
||||||
env:
|
env:
|
||||||
|
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||||
PATCH_UP_APP_CREDS: ${{ secrets.PATCH_UP_APP_CREDS }}
|
PATCH_UP_APP_CREDS: ${{ secrets.PATCH_UP_APP_CREDS }}
|
||||||
outputs:
|
outputs:
|
||||||
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
|
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
- name: Checkout & Sync & Save
|
- name: Checkout & Sync & Save
|
||||||
uses: ./src/electron/.github/actions/checkout
|
uses: ./src/electron/.github/actions/checkout
|
||||||
|
|
||||||
|
checkout-windows:
|
||||||
|
needs: setup
|
||||||
|
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||||
|
runs-on: electron-arc-linux-amd64-32core
|
||||||
|
container:
|
||||||
|
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||||
|
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
|
||||||
|
volumes:
|
||||||
|
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||||
|
env:
|
||||||
|
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||||
|
CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
|
||||||
|
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
|
||||||
|
TARGET_OS: 'win'
|
||||||
|
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
|
||||||
|
outputs:
|
||||||
|
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
|
||||||
|
steps:
|
||||||
|
- name: Checkout Electron
|
||||||
|
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
||||||
|
with:
|
||||||
|
path: src/electron
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
- name: Checkout & Sync & Save
|
||||||
|
uses: ./src/electron/.github/actions/checkout
|
||||||
|
|
||||||
|
# GN Check Jobs
|
||||||
|
macos-gn-check:
|
||||||
|
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
|
||||||
|
needs: checkout-macos
|
||||||
|
with:
|
||||||
|
target-platform: macos
|
||||||
|
target-archs: x64 arm64
|
||||||
|
check-runs-on: macos-14
|
||||||
|
gn-build-type: testing
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
linux-gn-check:
|
||||||
|
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
|
||||||
|
needs: checkout-linux
|
||||||
|
with:
|
||||||
|
target-platform: linux
|
||||||
|
target-archs: x64 arm arm64
|
||||||
|
check-runs-on: electron-arc-linux-amd64-8core
|
||||||
|
check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||||
|
gn-build-type: testing
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
windows-gn-check:
|
||||||
|
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
|
||||||
|
needs: checkout-windows
|
||||||
|
with:
|
||||||
|
target-platform: win
|
||||||
|
target-archs: x64 x86 arm64
|
||||||
|
check-runs-on: electron-arc-linux-amd64-8core
|
||||||
|
check-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/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||||
|
gn-build-type: testing
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
# Build Jobs - These cascade into testing jobs
|
# Build Jobs - These cascade into testing jobs
|
||||||
macos-x64:
|
macos-x64:
|
||||||
permissions:
|
permissions:
|
||||||
@@ -137,7 +212,6 @@ jobs:
|
|||||||
needs: checkout-macos
|
needs: checkout-macos
|
||||||
with:
|
with:
|
||||||
build-runs-on: macos-14-xlarge
|
build-runs-on: macos-14-xlarge
|
||||||
check-runs-on: macos-14
|
|
||||||
test-runs-on: macos-13
|
test-runs-on: macos-13
|
||||||
target-platform: macos
|
target-platform: macos
|
||||||
target-arch: x64
|
target-arch: x64
|
||||||
@@ -156,7 +230,6 @@ jobs:
|
|||||||
needs: checkout-macos
|
needs: checkout-macos
|
||||||
with:
|
with:
|
||||||
build-runs-on: macos-14-xlarge
|
build-runs-on: macos-14-xlarge
|
||||||
check-runs-on: macos-14
|
|
||||||
test-runs-on: macos-14
|
test-runs-on: macos-14
|
||||||
target-platform: macos
|
target-platform: macos
|
||||||
target-arch: arm64
|
target-arch: arm64
|
||||||
@@ -175,7 +248,6 @@ jobs:
|
|||||||
needs: checkout-linux
|
needs: checkout-linux
|
||||||
with:
|
with:
|
||||||
build-runs-on: electron-arc-linux-amd64-32core
|
build-runs-on: electron-arc-linux-amd64-32core
|
||||||
check-runs-on: electron-arc-linux-amd64-8core
|
|
||||||
test-runs-on: electron-arc-linux-amd64-4core
|
test-runs-on: electron-arc-linux-amd64-4core
|
||||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||||
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
|
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
|
||||||
@@ -196,7 +268,6 @@ jobs:
|
|||||||
needs: checkout-linux
|
needs: checkout-linux
|
||||||
with:
|
with:
|
||||||
build-runs-on: electron-arc-linux-amd64-32core
|
build-runs-on: electron-arc-linux-amd64-32core
|
||||||
check-runs-on: electron-arc-linux-amd64-8core
|
|
||||||
test-runs-on: electron-arc-linux-amd64-4core
|
test-runs-on: electron-arc-linux-amd64-4core
|
||||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||||
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
|
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
|
||||||
@@ -218,7 +289,6 @@ jobs:
|
|||||||
needs: checkout-linux
|
needs: checkout-linux
|
||||||
with:
|
with:
|
||||||
build-runs-on: electron-arc-linux-amd64-32core
|
build-runs-on: electron-arc-linux-amd64-32core
|
||||||
check-runs-on: electron-arc-linux-amd64-8core
|
|
||||||
test-runs-on: electron-arc-linux-arm64-4core
|
test-runs-on: electron-arc-linux-arm64-4core
|
||||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||||
test-container: '{"image":"ghcr.io/electron/test:arm32v7-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init","volumes":["/home/runner/externals:/mnt/runner-externals"]}'
|
test-container: '{"image":"ghcr.io/electron/test:arm32v7-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init","volumes":["/home/runner/externals:/mnt/runner-externals"]}'
|
||||||
@@ -239,7 +309,6 @@ jobs:
|
|||||||
needs: checkout-linux
|
needs: checkout-linux
|
||||||
with:
|
with:
|
||||||
build-runs-on: electron-arc-linux-amd64-32core
|
build-runs-on: electron-arc-linux-amd64-32core
|
||||||
check-runs-on: electron-arc-linux-amd64-8core
|
|
||||||
test-runs-on: electron-arc-linux-arm64-4core
|
test-runs-on: electron-arc-linux-arm64-4core
|
||||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
|
||||||
test-container: '{"image":"ghcr.io/electron/test:arm64v8-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
|
test-container: '{"image":"ghcr.io/electron/test:arm64v8-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
|
||||||
@@ -250,3 +319,70 @@ jobs:
|
|||||||
generate-symbols: false
|
generate-symbols: false
|
||||||
upload-to-storage: '0'
|
upload-to-storage: '0'
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
windows-x64:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: read
|
||||||
|
pull-requests: read
|
||||||
|
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
|
||||||
|
needs: setup
|
||||||
|
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||||
|
with:
|
||||||
|
build-runs-on: electron-arc-windows-amd64-16core
|
||||||
|
test-runs-on: windows-latest
|
||||||
|
target-platform: win
|
||||||
|
target-arch: x64
|
||||||
|
is-release: false
|
||||||
|
gn-build-type: testing
|
||||||
|
generate-symbols: false
|
||||||
|
upload-to-storage: '0'
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
windows-x86:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: read
|
||||||
|
pull-requests: read
|
||||||
|
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
|
||||||
|
needs: setup
|
||||||
|
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||||
|
with:
|
||||||
|
build-runs-on: electron-arc-windows-amd64-16core
|
||||||
|
test-runs-on: windows-latest
|
||||||
|
target-platform: win
|
||||||
|
target-arch: x86
|
||||||
|
is-release: false
|
||||||
|
gn-build-type: testing
|
||||||
|
generate-symbols: false
|
||||||
|
upload-to-storage: '0'
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
windows-arm64:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: read
|
||||||
|
pull-requests: read
|
||||||
|
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
|
||||||
|
needs: setup
|
||||||
|
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||||
|
with:
|
||||||
|
build-runs-on: electron-arc-windows-amd64-16core
|
||||||
|
test-runs-on: electron-hosted-windows-arm64-4core
|
||||||
|
target-platform: win
|
||||||
|
target-arch: arm64
|
||||||
|
is-release: false
|
||||||
|
gn-build-type: testing
|
||||||
|
generate-symbols: false
|
||||||
|
upload-to-storage: '0'
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
gha-done:
|
||||||
|
name: GitHub Actions Completed
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [docs-only, macos-x64, macos-arm64, linux-x64, linux-x64-asan, linux-arm, linux-arm64, windows-x64, windows-x86, windows-arm64]
|
||||||
|
if: always() && !contains(needs.*.result, 'failure')
|
||||||
|
steps:
|
||||||
|
- name: GitHub Actions Jobs Done
|
||||||
|
run: |
|
||||||
|
echo "All GitHub Actions Jobs are done"
|
||||||
|
|||||||
25
.github/workflows/clean-src-cache.yml
vendored
Normal file
25
.github/workflows/clean-src-cache.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
name: Clean Source Cache
|
||||||
|
|
||||||
|
description: |
|
||||||
|
This workflow cleans up the source cache on the cross-instance cache volume
|
||||||
|
to free up space. It runs daily at midnight and clears files older than 15 days.
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * *"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
clean-src-cache:
|
||||||
|
runs-on: electron-arc-linux-amd64-32core
|
||||||
|
container:
|
||||||
|
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||||
|
options: --user root
|
||||||
|
volumes:
|
||||||
|
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||||
|
steps:
|
||||||
|
- name: Cleanup Source Cache
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
df -h /mnt/cross-instance-cache
|
||||||
|
find /mnt/cross-instance-cache -type f -mtime +15 -delete
|
||||||
|
df -h /mnt/cross-instance-cache
|
||||||
14
.github/workflows/config/gclient.diff
vendored
14
.github/workflows/config/gclient.diff
vendored
@@ -1,14 +0,0 @@
|
|||||||
diff --git a/gclient.py b/gclient.py
|
|
||||||
index 59e2b4c5197928bdba1ef69bdbe637d7dfe471c1..b4bae5e48c83c84bd867187afaf40eed16e69851 100755
|
|
||||||
--- a/gclient.py
|
|
||||||
+++ b/gclient.py
|
|
||||||
@@ -783,7 +783,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
|
|
||||||
not condition or "non_git_source" not in condition):
|
|
||||||
continue
|
|
||||||
cipd_root = self.GetCipdRoot()
|
|
||||||
- for package in dep_value.get('packages', []):
|
|
||||||
+ packages = dep_value.get('packages', [])
|
|
||||||
+ for package in (x for x in packages if "infra/3pp/tools/swift-format" not in x.get('package')):
|
|
||||||
deps_to_add.append(
|
|
||||||
CipdDependency(parent=self,
|
|
||||||
name=name,
|
|
||||||
4
.github/workflows/linux-publish.yml
vendored
4
.github/workflows/linux-publish.yml
vendored
@@ -6,7 +6,7 @@ on:
|
|||||||
build-image-sha:
|
build-image-sha:
|
||||||
type: string
|
type: string
|
||||||
description: 'SHA for electron/build image'
|
description: 'SHA for electron/build image'
|
||||||
default: 'cf814a4d2501e8e843caea071a6b70a48e78b855'
|
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
|
||||||
upload-to-storage:
|
upload-to-storage:
|
||||||
description: 'Uploads to Azure storage'
|
description: 'Uploads to Azure storage'
|
||||||
required: false
|
required: false
|
||||||
@@ -30,7 +30,7 @@ jobs:
|
|||||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|||||||
40
.github/workflows/macos-publish.yml
vendored
40
.github/workflows/macos-publish.yml
vendored
@@ -6,7 +6,7 @@ on:
|
|||||||
build-image-sha:
|
build-image-sha:
|
||||||
type: string
|
type: string
|
||||||
description: 'SHA for electron/build image'
|
description: 'SHA for electron/build image'
|
||||||
default: 'cf814a4d2501e8e843caea071a6b70a48e78b855'
|
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
|
||||||
required: true
|
required: true
|
||||||
upload-to-storage:
|
upload-to-storage:
|
||||||
description: 'Uploads to Azure storage'
|
description: 'Uploads to Azure storage'
|
||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
@@ -40,7 +40,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
generate-sas-token: 'true'
|
generate-sas-token: 'true'
|
||||||
|
|
||||||
publish-x64:
|
publish-x64-darwin:
|
||||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||||
needs: checkout-macos
|
needs: checkout-macos
|
||||||
with:
|
with:
|
||||||
@@ -48,13 +48,29 @@ jobs:
|
|||||||
build-runs-on: macos-14-xlarge
|
build-runs-on: macos-14-xlarge
|
||||||
target-platform: macos
|
target-platform: macos
|
||||||
target-arch: x64
|
target-arch: x64
|
||||||
|
target-variant: darwin
|
||||||
is-release: true
|
is-release: true
|
||||||
gn-build-type: release
|
gn-build-type: release
|
||||||
generate-symbols: true
|
generate-symbols: true
|
||||||
upload-to-storage: ${{ inputs.upload-to-storage }}
|
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
publish-arm64:
|
publish-x64-mas:
|
||||||
|
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||||
|
needs: checkout-macos
|
||||||
|
with:
|
||||||
|
environment: production-release
|
||||||
|
build-runs-on: macos-14-xlarge
|
||||||
|
target-platform: macos
|
||||||
|
target-arch: x64
|
||||||
|
target-variant: mas
|
||||||
|
is-release: true
|
||||||
|
gn-build-type: release
|
||||||
|
generate-symbols: true
|
||||||
|
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
publish-arm64-darwin:
|
||||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||||
needs: checkout-macos
|
needs: checkout-macos
|
||||||
with:
|
with:
|
||||||
@@ -62,6 +78,22 @@ jobs:
|
|||||||
build-runs-on: macos-14-xlarge
|
build-runs-on: macos-14-xlarge
|
||||||
target-platform: macos
|
target-platform: macos
|
||||||
target-arch: arm64
|
target-arch: arm64
|
||||||
|
target-variant: darwin
|
||||||
|
is-release: true
|
||||||
|
gn-build-type: release
|
||||||
|
generate-symbols: true
|
||||||
|
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
publish-arm64-mas:
|
||||||
|
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||||
|
needs: checkout-macos
|
||||||
|
with:
|
||||||
|
environment: production-release
|
||||||
|
build-runs-on: macos-14-xlarge
|
||||||
|
target-platform: macos
|
||||||
|
target-arch: arm64
|
||||||
|
target-variant: mas
|
||||||
is-release: true
|
is-release: true
|
||||||
gn-build-type: release
|
gn-build-type: release
|
||||||
generate-symbols: true
|
generate-symbols: true
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ on:
|
|||||||
inputs:
|
inputs:
|
||||||
target-platform:
|
target-platform:
|
||||||
type: string
|
type: string
|
||||||
description: 'Platform to run on, can be macos or linux'
|
description: 'Platform to run on, can be macos, win or linux.'
|
||||||
required: true
|
required: true
|
||||||
target-arch:
|
target-arch:
|
||||||
type: string
|
type: string
|
||||||
@@ -15,10 +15,6 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
description: 'What host to run the build'
|
description: 'What host to run the build'
|
||||||
required: true
|
required: true
|
||||||
check-runs-on:
|
|
||||||
type: string
|
|
||||||
description: 'What host to run the gn-check'
|
|
||||||
required: true
|
|
||||||
test-runs-on:
|
test-runs-on:
|
||||||
type: string
|
type: string
|
||||||
description: 'What host to run the tests on'
|
description: 'What host to run the tests on'
|
||||||
@@ -60,8 +56,8 @@ on:
|
|||||||
default: false
|
default: false
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: electron-build-and-test-and-nan-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
|
group: electron-build-and-test-and-nan-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }}
|
||||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
|
cancel-in-progress: ${{ github.ref_protected != true }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -76,16 +72,6 @@ jobs:
|
|||||||
generate-symbols: ${{ inputs.generate-symbols }}
|
generate-symbols: ${{ inputs.generate-symbols }}
|
||||||
upload-to-storage: ${{ inputs.upload-to-storage }}
|
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
gn-check:
|
|
||||||
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
|
|
||||||
with:
|
|
||||||
target-platform: ${{ inputs.target-platform }}
|
|
||||||
target-arch: ${{ inputs.target-arch }}
|
|
||||||
check-runs-on: ${{ inputs.check-runs-on }}
|
|
||||||
check-container: ${{ inputs.build-container }}
|
|
||||||
gn-build-type: ${{ inputs.gn-build-type }}
|
|
||||||
is-asan: ${{ inputs.is-asan }}
|
|
||||||
secrets: inherit
|
|
||||||
test:
|
test:
|
||||||
uses: ./.github/workflows/pipeline-segment-electron-test.yml
|
uses: ./.github/workflows/pipeline-segment-electron-test.yml
|
||||||
needs: build
|
needs: build
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ on:
|
|||||||
inputs:
|
inputs:
|
||||||
target-platform:
|
target-platform:
|
||||||
type: string
|
type: string
|
||||||
description: 'Platform to run on, can be macos or linux'
|
description: 'Platform to run on, can be macos, win or linux'
|
||||||
required: true
|
required: true
|
||||||
target-arch:
|
target-arch:
|
||||||
type: string
|
type: string
|
||||||
@@ -15,10 +15,6 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
description: 'What host to run the build'
|
description: 'What host to run the build'
|
||||||
required: true
|
required: true
|
||||||
check-runs-on:
|
|
||||||
type: string
|
|
||||||
description: 'What host to run the gn-check'
|
|
||||||
required: true
|
|
||||||
test-runs-on:
|
test-runs-on:
|
||||||
type: string
|
type: string
|
||||||
description: 'What host to run the tests on'
|
description: 'What host to run the tests on'
|
||||||
@@ -60,8 +56,8 @@ on:
|
|||||||
default: false
|
default: false
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
|
group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }}
|
||||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
|
cancel-in-progress: ${{ github.ref_protected != true }}
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -82,16 +78,6 @@ jobs:
|
|||||||
upload-to-storage: ${{ inputs.upload-to-storage }}
|
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||||
is-asan: ${{ inputs.is-asan}}
|
is-asan: ${{ inputs.is-asan}}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
gn-check:
|
|
||||||
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
|
|
||||||
with:
|
|
||||||
target-platform: ${{ inputs.target-platform }}
|
|
||||||
target-arch: ${{ inputs.target-arch }}
|
|
||||||
check-runs-on: ${{ inputs.check-runs-on }}
|
|
||||||
check-container: ${{ inputs.build-container }}
|
|
||||||
gn-build-type: ${{ inputs.gn-build-type }}
|
|
||||||
is-asan: ${{ inputs.is-asan }}
|
|
||||||
secrets: inherit
|
|
||||||
test:
|
test:
|
||||||
uses: ./.github/workflows/pipeline-segment-electron-test.yml
|
uses: ./.github/workflows/pipeline-segment-electron-test.yml
|
||||||
needs: build
|
needs: build
|
||||||
|
|||||||
@@ -20,14 +20,13 @@ jobs:
|
|||||||
container: ${{ fromJSON(inputs.container) }}
|
container: ${{ fromJSON(inputs.container) }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
uses: ./src/electron/.github/actions/install-dependencies
|
||||||
cd src/electron
|
|
||||||
node script/yarn install --frozen-lockfile
|
|
||||||
- name: Run TS/JS compile
|
- name: Run TS/JS compile
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
16
.github/workflows/pipeline-electron-lint.yml
vendored
16
.github/workflows/pipeline-electron-lint.yml
vendored
@@ -9,8 +9,11 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: electron-lint-${{ github.ref }}
|
group: electron-lint-${{ github.ref_protected == true && github.run_id || github.ref }}
|
||||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
|
cancel-in-progress: ${{ github.ref_protected != true }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
@@ -20,14 +23,15 @@ jobs:
|
|||||||
container: ${{ fromJSON(inputs.container) }}
|
container: ${{ fromJSON(inputs.container) }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
uses: ./src/electron/.github/actions/install-dependencies
|
||||||
cd src/electron
|
- name: Set Chromium Git Cookie
|
||||||
node script/yarn install --frozen-lockfile
|
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||||
- name: Setup third_party Depot Tools
|
- name: Setup third_party Depot Tools
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -9,12 +9,16 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
target-platform:
|
target-platform:
|
||||||
type: string
|
type: string
|
||||||
description: 'Platform to run on, can be macos or linux'
|
description: 'Platform to run on, can be macos, win or linux'
|
||||||
required: true
|
required: true
|
||||||
target-arch:
|
target-arch:
|
||||||
type: string
|
type: string
|
||||||
description: 'Arch to build for, can be x64, arm64 or arm'
|
description: 'Arch to build for, can be x64, arm64, ia32 or arm'
|
||||||
required: true
|
required: true
|
||||||
|
target-variant:
|
||||||
|
type: string
|
||||||
|
description: 'Variant to build for, no effect on non-macOS target platforms. Can be darwin, mas or all.'
|
||||||
|
default: all
|
||||||
build-runs-on:
|
build-runs-on:
|
||||||
type: string
|
type: string
|
||||||
description: 'What host to run the build'
|
description: 'What host to run the build'
|
||||||
@@ -57,18 +61,24 @@ on:
|
|||||||
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref }}
|
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }}
|
||||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
|
cancel-in-progress: ${{ github.ref_protected != true }}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||||
|
CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
|
||||||
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
|
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
|
||||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||||
ELECTRON_GITHUB_TOKEN: ${{ secrets.ELECTRON_GITHUB_TOKEN }}
|
SUDOWOODO_EXCHANGE_URL: ${{ secrets.SUDOWOODO_EXCHANGE_URL }}
|
||||||
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
|
SUDOWOODO_EXCHANGE_TOKEN: ${{ secrets.SUDOWOODO_EXCHANGE_TOKEN }}
|
||||||
|
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || inputs.target-platform == 'win' && '--custom-var=checkout_win=True' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
|
||||||
ELECTRON_OUT_DIR: Default
|
ELECTRON_OUT_DIR: Default
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
runs-on: ${{ inputs.build-runs-on }}
|
runs-on: ${{ inputs.build-runs-on }}
|
||||||
container: ${{ fromJSON(inputs.build-container) }}
|
container: ${{ fromJSON(inputs.build-container) }}
|
||||||
environment: ${{ inputs.environment }}
|
environment: ${{ inputs.environment }}
|
||||||
@@ -76,23 +86,29 @@ jobs:
|
|||||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
TARGET_ARCH: ${{ inputs.target-arch }}
|
||||||
steps:
|
steps:
|
||||||
- name: Create src dir
|
- name: Create src dir
|
||||||
run: mkdir src
|
run: |
|
||||||
|
mkdir src
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
- name: Free up space (macOS)
|
||||||
|
if: ${{ inputs.target-platform == 'macos' }}
|
||||||
|
uses: ./src/electron/.github/actions/free-space-macos
|
||||||
|
- name: Check disk space after freeing up space
|
||||||
|
if: ${{ inputs.target-platform == 'macos' }}
|
||||||
|
run: df -h
|
||||||
- name: Setup Node.js/npm
|
- name: Setup Node.js/npm
|
||||||
if: ${{ inputs.target-platform == 'macos' }}
|
if: ${{ inputs.target-platform == 'macos' }}
|
||||||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
|
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
|
||||||
with:
|
with:
|
||||||
node-version: 20.11.x
|
node-version: 20.11.x
|
||||||
cache: yarn
|
cache: yarn
|
||||||
cache-dependency-path: src/electron/yarn.lock
|
cache-dependency-path: src/electron/yarn.lock
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
uses: ./src/electron/.github/actions/install-dependencies
|
||||||
cd src/electron
|
|
||||||
node script/yarn install --frozen-lockfile
|
|
||||||
- name: Install AZCopy
|
- name: Install AZCopy
|
||||||
if: ${{ inputs.target-platform == 'macos' }}
|
if: ${{ inputs.target-platform == 'macos' }}
|
||||||
run: brew install azcopy
|
run: brew install azcopy
|
||||||
@@ -111,6 +127,8 @@ jobs:
|
|||||||
GN_EXTRA_ARGS='is_asan=true'
|
GN_EXTRA_ARGS='is_asan=true'
|
||||||
fi
|
fi
|
||||||
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
|
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
|
||||||
|
- name: Set Chromium Git Cookie
|
||||||
|
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||||
- name: Get Depot Tools
|
- name: Get Depot Tools
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
run: |
|
run: |
|
||||||
@@ -126,16 +144,13 @@ jobs:
|
|||||||
|
|
||||||
# Ensure depot_tools does not update.
|
# Ensure depot_tools does not update.
|
||||||
test -d depot_tools && cd depot_tools
|
test -d depot_tools && cd depot_tools
|
||||||
if [ "`uname`" = "Linux" ]; then
|
|
||||||
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
|
|
||||||
fi
|
|
||||||
touch .disable_auto_update
|
touch .disable_auto_update
|
||||||
- name: Add Depot Tools to PATH
|
- name: Add Depot Tools to PATH
|
||||||
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
||||||
- name: Generate DEPS Hash
|
- name: Generate DEPS Hash
|
||||||
run: |
|
run: |
|
||||||
node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
|
node src/electron/script/generate-deps-hash.js
|
||||||
DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')
|
DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)
|
||||||
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
|
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
|
||||||
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
|
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
|
||||||
- name: Restore src cache via AZCopy
|
- name: Restore src cache via AZCopy
|
||||||
@@ -144,62 +159,60 @@ jobs:
|
|||||||
- name: Restore src cache via AKS
|
- name: Restore src cache via AKS
|
||||||
if: ${{ inputs.target-platform == 'linux' }}
|
if: ${{ inputs.target-platform == 'linux' }}
|
||||||
uses: ./src/electron/.github/actions/restore-cache-aks
|
uses: ./src/electron/.github/actions/restore-cache-aks
|
||||||
|
- name: Checkout src via gclient sync
|
||||||
|
if: ${{ inputs.target-platform == 'win' }}
|
||||||
|
uses: ./src/electron/.github/actions/checkout
|
||||||
|
with:
|
||||||
|
use-cache: 'false'
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
- name: Install Build Tools
|
- name: Install Build Tools
|
||||||
uses: ./src/electron/.github/actions/install-build-tools
|
uses: ./src/electron/.github/actions/install-build-tools
|
||||||
- name: Init Build Tools
|
- name: Init Build Tools
|
||||||
run: |
|
run: |
|
||||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} --only-sdk
|
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
|
||||||
- name: Run Electron Only Hooks
|
- name: Run Electron Only Hooks
|
||||||
run: |
|
run: |
|
||||||
gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
|
e d gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
|
||||||
- name: Regenerate DEPS Hash
|
- name: Regenerate DEPS Hash
|
||||||
run: |
|
run: |
|
||||||
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
|
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js
|
||||||
echo "DEPSHASH=$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
|
echo "DEPSHASH=$(cat src/electron/.depshash)" >> $GITHUB_ENV
|
||||||
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
|
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
|
||||||
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
|
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
|
||||||
- name: Fix Sync (macOS)
|
- name: Fix Sync (macOS)
|
||||||
if: ${{ inputs.target-platform == 'macos' }}
|
if: ${{ inputs.target-platform == 'macos' }}
|
||||||
uses: ./src/electron/.github/actions/fix-sync-macos
|
uses: ./src/electron/.github/actions/fix-sync-macos
|
||||||
- name: Install build-tools & Setup RBE
|
- name: Setup Number of Ninja Processes
|
||||||
run: |
|
run: |
|
||||||
echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform == 'linux' && '300' || '200' }}" >> $GITHUB_ENV
|
echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform != 'macos' && '300' || '200' }}" >> $GITHUB_ENV
|
||||||
cd ~/.electron_build_tools
|
|
||||||
npx yarn --ignore-engines
|
|
||||||
# Pull down credential helper and print status
|
|
||||||
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
|
|
||||||
HELPER=$(node -p "require('./src/utils/reclient.js').helperPath({})")
|
|
||||||
$HELPER login
|
|
||||||
echo 'RBE_service='`node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"` >> $GITHUB_ENV
|
|
||||||
echo 'RBE_experimental_credentials_helper='`node -e "console.log(require('./src/utils/reclient.js').helperPath({}))"` >> $GITHUB_ENV
|
|
||||||
echo 'RBE_experimental_credentials_helper_args=print' >> $GITHUB_ENV
|
|
||||||
- name: Free up space (macOS)
|
- name: Free up space (macOS)
|
||||||
if: ${{ inputs.target-platform == 'macos' }}
|
if: ${{ inputs.target-platform == 'macos' }}
|
||||||
uses: ./src/electron/.github/actions/free-space-macos
|
uses: ./src/electron/.github/actions/free-space-macos
|
||||||
- name: Build Electron
|
- name: Build Electron
|
||||||
|
if: ${{ inputs.target-platform != 'macos' || (inputs.target-variant == 'all' || inputs.target-variant == 'darwin') }}
|
||||||
uses: ./src/electron/.github/actions/build-electron
|
uses: ./src/electron/.github/actions/build-electron
|
||||||
with:
|
with:
|
||||||
target-arch: ${{ inputs.target-arch }}
|
target-arch: ${{ inputs.target-arch }}
|
||||||
target-platform: ${{ inputs.target-platform }}
|
target-platform: ${{ inputs.target-platform }}
|
||||||
artifact-platform: ${{ inputs.target-platform == 'linux' && 'linux' || 'darwin' }}
|
artifact-platform: ${{ inputs.target-platform == 'macos' && 'darwin' || inputs.target-platform }}
|
||||||
is-release: '${{ inputs.is-release }}'
|
is-release: '${{ inputs.is-release }}'
|
||||||
generate-symbols: '${{ inputs.generate-symbols }}'
|
generate-symbols: '${{ inputs.generate-symbols }}'
|
||||||
strip-binaries: '${{ inputs.strip-binaries }}'
|
strip-binaries: '${{ inputs.strip-binaries }}'
|
||||||
upload-to-storage: '${{ inputs.upload-to-storage }}'
|
upload-to-storage: '${{ inputs.upload-to-storage }}'
|
||||||
is-asan: '${{ inputs.is-asan }}'
|
is-asan: '${{ inputs.is-asan }}'
|
||||||
- name: Set GN_EXTRA_ARGS for MAS Build
|
- name: Set GN_EXTRA_ARGS for MAS Build
|
||||||
if: ${{ inputs.target-platform == 'macos' }}
|
if: ${{ inputs.target-platform == 'macos' && (inputs.target-variant == 'all' || inputs.target-variant == 'mas') }}
|
||||||
run: |
|
run: |
|
||||||
echo "MAS_BUILD=true" >> $GITHUB_ENV
|
echo "MAS_BUILD=true" >> $GITHUB_ENV
|
||||||
GN_EXTRA_ARGS='is_mas_build=true'
|
GN_EXTRA_ARGS='is_mas_build=true'
|
||||||
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
|
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
|
||||||
- name: Build Electron (MAS)
|
- name: Build Electron (MAS)
|
||||||
if: ${{ inputs.target-platform == 'macos' }}
|
if: ${{ inputs.target-platform == 'macos' && (inputs.target-variant == 'all' || inputs.target-variant == 'mas') }}
|
||||||
uses: ./src/electron/.github/actions/build-electron
|
uses: ./src/electron/.github/actions/build-electron
|
||||||
with:
|
with:
|
||||||
target-arch: ${{ inputs.target-arch }}
|
target-arch: ${{ inputs.target-arch }}
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ on:
|
|||||||
inputs:
|
inputs:
|
||||||
target-platform:
|
target-platform:
|
||||||
type: string
|
type: string
|
||||||
description: 'Platform to run on, can be macos or linux'
|
description: 'Platform to run on, can be macos, win or linux'
|
||||||
required: true
|
required: true
|
||||||
target-arch:
|
target-archs:
|
||||||
type: string
|
type: string
|
||||||
description: 'Arch to build for, can be x64, arm64 or arm'
|
description: 'Archs to check for, can be x64, x86, arm64 or arm space separated'
|
||||||
required: true
|
required: true
|
||||||
check-runs-on:
|
check-runs-on:
|
||||||
type: string
|
type: string
|
||||||
@@ -25,116 +25,130 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
default: testing
|
default: testing
|
||||||
is-asan:
|
|
||||||
description: 'Building the Address Sanitizer (ASan) Linux build'
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: electron-gn-check-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref }}
|
group: electron-gn-check-${{ inputs.target-platform }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||||
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
|
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || (inputs.target-platform == 'linux' && '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' || '--custom-var=checkout_win=True') }}
|
||||||
ELECTRON_OUT_DIR: Default
|
ELECTRON_OUT_DIR: Default
|
||||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
gn-check:
|
gn-check:
|
||||||
# TODO(codebytere): Change this to medium VM
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
runs-on: ${{ inputs.check-runs-on }}
|
runs-on: ${{ inputs.check-runs-on }}
|
||||||
container: ${{ fromJSON(inputs.check-container) }}
|
container: ${{ fromJSON(inputs.check-container) }}
|
||||||
env:
|
|
||||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
- name: Cleanup disk space on macOS
|
||||||
|
if: ${{ inputs.target-platform == 'macos' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sudo mkdir -p $TMPDIR/del-target
|
||||||
|
|
||||||
|
tmpify() {
|
||||||
|
if [ -d "$1" ]; then
|
||||||
|
sudo mv "$1" $TMPDIR/del-target/$(echo $1|shasum -a 256|head -n1|cut -d " " -f1)
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
tmpify /Library/Developer/CoreSimulator
|
||||||
|
tmpify ~/Library/Developer/CoreSimulator
|
||||||
|
sudo rm -rf $TMPDIR/del-target
|
||||||
|
- name: Check disk space after freeing up space
|
||||||
|
if: ${{ inputs.target-platform == 'macos' }}
|
||||||
|
run: df -h
|
||||||
- name: Install Build Tools
|
- name: Install Build Tools
|
||||||
uses: ./src/electron/.github/actions/install-build-tools
|
uses: ./src/electron/.github/actions/install-build-tools
|
||||||
- name: Init Build Tools
|
- name: Enable windows toolchain
|
||||||
|
if: ${{ inputs.target-platform == 'win' }}
|
||||||
run: |
|
run: |
|
||||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} --only-sdk
|
echo "ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN=1" >> $GITHUB_ENV
|
||||||
- name: Get Depot Tools
|
|
||||||
timeout-minutes: 5
|
|
||||||
run: |
|
|
||||||
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
|
||||||
|
|
||||||
SEDOPTION="-i"
|
|
||||||
if [ "`uname`" = "Darwin" ]; then
|
|
||||||
SEDOPTION="-i ''"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
|
|
||||||
sed $SEDOPTION '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
|
|
||||||
|
|
||||||
# Ensure depot_tools does not update.
|
|
||||||
test -d depot_tools && cd depot_tools
|
|
||||||
if [ "`uname`" = "Linux" ]; then
|
|
||||||
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
|
|
||||||
fi
|
|
||||||
touch .disable_auto_update
|
|
||||||
- name: Add Depot Tools to PATH
|
|
||||||
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
|
||||||
- name: Set GN_EXTRA_ARGS for Linux
|
|
||||||
if: ${{ inputs.target-platform == 'linux' }}
|
|
||||||
run: |
|
|
||||||
if [ "${{ inputs.target-arch }}" = "arm" ]; then
|
|
||||||
GN_EXTRA_ARGS='build_tflite_with_xnnpack=false'
|
|
||||||
elif [ "${{ inputs.target-arch }}" = "arm64" ]; then
|
|
||||||
GN_EXTRA_ARGS='fatal_linker_warnings=false enable_linux_installer=false'
|
|
||||||
fi
|
|
||||||
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
|
|
||||||
- name: Generate DEPS Hash
|
- name: Generate DEPS Hash
|
||||||
run: |
|
run: |
|
||||||
node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
|
node src/electron/script/generate-deps-hash.js
|
||||||
DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')
|
DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)
|
||||||
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
|
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
|
||||||
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
|
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
|
||||||
- name: Restore src cache via AZCopy
|
- name: Restore src cache via AZCopy
|
||||||
if: ${{ inputs.target-platform == 'macos' }}
|
if: ${{ inputs.target-platform == 'macos' }}
|
||||||
uses: ./src/electron/.github/actions/restore-cache-azcopy
|
uses: ./src/electron/.github/actions/restore-cache-azcopy
|
||||||
- name: Restore src cache via AKS
|
- name: Restore src cache via AKS
|
||||||
if: ${{ inputs.target-platform == 'linux' }}
|
if: ${{ inputs.target-platform == 'linux' || inputs.target-platform == 'win' }}
|
||||||
uses: ./src/electron/.github/actions/restore-cache-aks
|
uses: ./src/electron/.github/actions/restore-cache-aks
|
||||||
- name: Run Electron Only Hooks
|
- name: Run Electron Only Hooks
|
||||||
run: |
|
run: |
|
||||||
gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
|
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 "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False,'install_sysroot':False,'checkout_win':True},'managed':False}]" > tmpgclient
|
||||||
|
echo "target_os=['win']" >> tmpgclient
|
||||||
|
fi
|
||||||
|
e d gclient runhooks --gclientfile=tmpgclient
|
||||||
|
|
||||||
|
# Fix VS Toolchain
|
||||||
|
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||||
|
rm -rf src/third_party/depot_tools/win_toolchain/vs_files
|
||||||
|
e d python3 src/build/vs_toolchain.py update --force
|
||||||
|
fi
|
||||||
- name: Regenerate DEPS Hash
|
- name: Regenerate DEPS Hash
|
||||||
run: |
|
run: |
|
||||||
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
|
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js
|
||||||
echo "DEPSHASH=$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
|
echo "DEPSHASH=$(cat src/electron/.depshash)" >> $GITHUB_ENV
|
||||||
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
|
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
|
||||||
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
|
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
- name: Install Dependencies
|
||||||
|
uses: ./src/electron/.github/actions/install-dependencies
|
||||||
- name: Default GN gen
|
- name: Default GN gen
|
||||||
run: |
|
run: |
|
||||||
cd src/electron
|
cd src/electron
|
||||||
git pack-refs
|
git pack-refs
|
||||||
cd ..
|
- name: Run GN Check for ${{ inputs.target-archs }}
|
||||||
|
|
||||||
e build --only-gen
|
|
||||||
- name: Run GN Check
|
|
||||||
run: |
|
run: |
|
||||||
cd src
|
for target_cpu in ${{ inputs.target-archs }}
|
||||||
gn check out/Default //electron:electron_lib
|
do
|
||||||
gn check out/Default //electron:electron_app
|
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu $target_cpu
|
||||||
gn check out/Default //electron/shell/common:mojo
|
cd src
|
||||||
gn check out/Default //electron/shell/common:plugin
|
export GN_EXTRA_ARGS="target_cpu=\"$target_cpu\""
|
||||||
|
if [ "${{ inputs.target-platform }}" = "linux" ]; then
|
||||||
|
if [ "$target_cpu" = "arm" ]; then
|
||||||
|
export GN_EXTRA_ARGS="$GN_EXTRA_ARGS build_tflite_with_xnnpack=false"
|
||||||
|
elif [ "$target_cpu" = "arm64" ]; then
|
||||||
|
export GN_EXTRA_ARGS="$GN_EXTRA_ARGS fatal_linker_warnings=false enable_linux_installer=false"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||||
|
export GN_EXTRA_ARGS="$GN_EXTRA_ARGS use_v8_context_snapshot=true target_os=\"win\""
|
||||||
|
fi
|
||||||
|
|
||||||
# Check the hunspell filenames
|
e build --only-gen
|
||||||
node electron/script/gen-hunspell-filenames.js --check
|
|
||||||
node electron/script/gen-libc++-filenames.js --check
|
e d gn check out/Default //electron:electron_lib
|
||||||
|
e d gn check out/Default //electron:electron_app
|
||||||
|
e d gn check out/Default //electron/shell/common:mojo
|
||||||
|
e d gn check out/Default //electron/shell/common:plugin
|
||||||
|
|
||||||
|
# Check the hunspell filenames
|
||||||
|
node electron/script/gen-hunspell-filenames.js --check
|
||||||
|
node electron/script/gen-libc++-filenames.js --check
|
||||||
|
cd ..
|
||||||
|
done
|
||||||
- name: Wait for active SSH sessions
|
- name: Wait for active SSH sessions
|
||||||
if: always() && !cancelled()
|
if: always() && !cancelled()
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
while [ -f /var/.ssh-lock ]
|
while [ -f /var/.ssh-lock ]
|
||||||
do
|
do
|
||||||
|
|||||||
107
.github/workflows/pipeline-segment-electron-test.yml
vendored
107
.github/workflows/pipeline-segment-electron-test.yml
vendored
@@ -5,7 +5,7 @@ on:
|
|||||||
inputs:
|
inputs:
|
||||||
target-platform:
|
target-platform:
|
||||||
type: string
|
type: string
|
||||||
description: 'Platform to run on, can be macos or linux'
|
description: 'Platform to run on, can be macos, win or linux'
|
||||||
required: true
|
required: true
|
||||||
target-arch:
|
target-arch:
|
||||||
type: string
|
type: string
|
||||||
@@ -27,8 +27,8 @@ on:
|
|||||||
default: false
|
default: false
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref }}
|
group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }}
|
||||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
|
cancel-in-progress: ${{ github.ref_protected != true }}
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -36,28 +36,52 @@ permissions:
|
|||||||
pull-requests: read
|
pull-requests: read
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||||
|
CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
|
||||||
ELECTRON_OUT_DIR: Default
|
ELECTRON_OUT_DIR: Default
|
||||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||||
ELECTRON_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
runs-on: ${{ inputs.test-runs-on }}
|
runs-on: ${{ inputs.test-runs-on }}
|
||||||
container: ${{ fromJSON(inputs.test-container) }}
|
container: ${{ fromJSON(inputs.test-container) }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
build-type: ${{ inputs.target-platform == 'macos' && fromJSON('["darwin","mas"]') || fromJSON('["linux"]') }}
|
build-type: ${{ inputs.target-platform == 'macos' && fromJSON('["darwin","mas"]') || (inputs.target-platform == 'win' && fromJSON('["win"]') || fromJSON('["linux"]')) }}
|
||||||
shard: ${{ inputs.target-platform == 'macos' && fromJSON('[1, 2]') || fromJSON('[1, 2, 3]') }}
|
shard: ${{ inputs.target-platform == 'linux' && fromJSON('[1, 2, 3]') || fromJSON('[1, 2]') }}
|
||||||
env:
|
env:
|
||||||
BUILD_TYPE: ${{ matrix.build-type }}
|
BUILD_TYPE: ${{ matrix.build-type }}
|
||||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
TARGET_ARCH: ${{ inputs.target-arch }}
|
||||||
ARTIFACT_KEY: ${{ matrix.build-type }}_${{ inputs.target-arch }}
|
ARTIFACT_KEY: ${{ matrix.build-type }}_${{ inputs.target-arch }}
|
||||||
steps:
|
steps:
|
||||||
- name: Fix node20 on arm32 runners
|
- name: Fix node20 on arm32 runners
|
||||||
if: ${{ inputs.target-arch == 'arm' }}
|
if: ${{ inputs.target-arch == 'arm' && inputs.target-platform == 'linux' }}
|
||||||
run: |
|
run: |
|
||||||
cp $(which node) /mnt/runner-externals/node20/bin/
|
cp $(which node) /mnt/runner-externals/node20/bin/
|
||||||
|
- name: Install Git on Windows arm64 runners
|
||||||
|
if: ${{ inputs.target-arch == 'arm64' && inputs.target-platform == 'win' }}
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||||
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||||
|
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||||
|
choco install -y --no-progress git.install --params "'/GitAndUnixToolsOnPath'"
|
||||||
|
choco install -y --no-progress git
|
||||||
|
choco install -y --no-progress python --version 3.11.9
|
||||||
|
choco install -y --no-progress visualstudio2022-workload-vctools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.ARM64"
|
||||||
|
echo "C:\Program Files\Git\cmd" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
|
echo "C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
|
echo "C:\Python311" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
|
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
|
||||||
|
- name: Setup Node.js/npm
|
||||||
|
if: ${{ inputs.target-platform == 'win' }}
|
||||||
|
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
|
||||||
|
with:
|
||||||
|
node-version: 20.11.x
|
||||||
- name: Add TCC permissions on macOS
|
- name: Add TCC permissions on macOS
|
||||||
if: ${{ inputs.target-platform == 'macos' }}
|
if: ${{ inputs.target-platform == 'macos' }}
|
||||||
run: |
|
run: |
|
||||||
@@ -92,28 +116,24 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
uses: ./src/electron/.github/actions/install-dependencies
|
||||||
cd src/electron
|
- name: Set Chromium Git Cookie
|
||||||
node script/yarn install --frozen-lockfile
|
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||||
- name: Get Depot Tools
|
- name: Get Depot Tools
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
run: |
|
run: |
|
||||||
|
git config --global core.filemode false
|
||||||
|
git config --global core.autocrlf false
|
||||||
|
git config --global branch.autosetuprebase always
|
||||||
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||||
# Ensure depot_tools does not update.
|
# Ensure depot_tools does not update.
|
||||||
test -d depot_tools && cd depot_tools
|
test -d depot_tools && cd depot_tools
|
||||||
if [ "`uname`" = "Darwin" ]; then
|
|
||||||
# remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
|
|
||||||
sed -i '' '/ninjalog_uploader_wrapper.py/d' ./autoninja
|
|
||||||
else
|
|
||||||
sed -i '/ninjalog_uploader_wrapper.py/d' ./autoninja
|
|
||||||
# Remove swift-format dep from cipd on macOS until we send a patch upstream.
|
|
||||||
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
|
|
||||||
fi
|
|
||||||
touch .disable_auto_update
|
touch .disable_auto_update
|
||||||
- name: Add Depot Tools to PATH
|
- name: Add Depot Tools to PATH
|
||||||
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
||||||
@@ -135,7 +155,17 @@ jobs:
|
|||||||
path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
|
path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
|
||||||
- name: Restore Generated Artifacts
|
- name: Restore Generated Artifacts
|
||||||
run: ./src/electron/script/actions/restore-artifacts.sh
|
run: ./src/electron/script/actions/restore-artifacts.sh
|
||||||
- name: Unzip Dist, Mksnapshot & Chromedriver
|
- name: Unzip Dist, Mksnapshot & Chromedriver (win)
|
||||||
|
if: ${{ inputs.target-platform == 'win' }}
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||||
|
cd src/out/Default
|
||||||
|
Expand-Archive -Force dist.zip -DestinationPath ./
|
||||||
|
Expand-Archive -Force chromedriver.zip -DestinationPath ./
|
||||||
|
Expand-Archive -Force mksnapshot.zip -DestinationPath ./
|
||||||
|
- name: Unzip Dist, Mksnapshot & Chromedriver (unix)
|
||||||
|
if: ${{ inputs.target-platform != 'win' }}
|
||||||
run: |
|
run: |
|
||||||
cd src/out/Default
|
cd src/out/Default
|
||||||
unzip -:o dist.zip
|
unzip -:o dist.zip
|
||||||
@@ -147,23 +177,36 @@ jobs:
|
|||||||
sudo security authorizationdb write com.apple.trust-settings.admin allow
|
sudo security authorizationdb write com.apple.trust-settings.admin allow
|
||||||
cd src/electron
|
cd src/electron
|
||||||
./script/codesign/generate-identity.sh
|
./script/codesign/generate-identity.sh
|
||||||
|
- name: Install Datadog CLI
|
||||||
|
run: |
|
||||||
|
cd src/electron
|
||||||
|
node script/yarn global add @datadog/datadog-ci
|
||||||
- name: Run Electron Tests
|
- name: Run Electron Tests
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
MOCHA_REPORTER: mocha-multi-reporters
|
MOCHA_REPORTER: mocha-multi-reporters
|
||||||
ELECTRON_TEST_RESULTS_DIR: junit
|
|
||||||
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
||||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
||||||
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
||||||
DISPLAY: ':99.0'
|
DISPLAY: ':99.0'
|
||||||
|
NPM_CONFIG_MSVS_VERSION: '2022'
|
||||||
run: |
|
run: |
|
||||||
cd src/electron
|
cd src/electron
|
||||||
|
export ELECTRON_TEST_RESULTS_DIR=`pwd`/junit
|
||||||
# Get which tests are on this shard
|
# Get which tests are on this shard
|
||||||
tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ inputs.target-platform == 'macos' && 2 || 3 }})
|
tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ inputs.target-platform == 'linux' && 3 || 2 }})
|
||||||
|
|
||||||
# Run tests
|
# Run tests
|
||||||
if [ "`uname`" = "Darwin" ]; then
|
if [ "${{ inputs.target-platform }}" != "linux" ]; then
|
||||||
echo "About to start tests"
|
echo "About to start tests"
|
||||||
|
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||||
|
if [ "${{ inputs.target-arch }}" = "x86" ]; then
|
||||||
|
export npm_config_arch="ia32"
|
||||||
|
fi
|
||||||
|
if [ "${{ inputs.target-arch }}" = "arm64" ]; then
|
||||||
|
export ELECTRON_FORCE_TEST_SUITE_EXIT="true"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
node script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
|
node script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
|
||||||
else
|
else
|
||||||
chown :builduser .. && chmod g+w ..
|
chown :builduser .. && chmod g+w ..
|
||||||
@@ -186,15 +229,29 @@ jobs:
|
|||||||
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
|
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
- name: Upload Test results to Datadog
|
||||||
|
env:
|
||||||
|
DD_ENV: ci
|
||||||
|
DD_SERVICE: electron
|
||||||
|
DD_API_KEY: ${{ secrets.DD_API_KEY }}
|
||||||
|
DD_CIVISIBILITY_LOGS_ENABLED: true
|
||||||
|
DD_TAGS: "os.architecture:${{ inputs.target-arch }},os.family:${{ inputs.target-platform }},os.platform:${{ inputs.target-platform }},asan:${{ inputs.is-asan }}"
|
||||||
|
run: |
|
||||||
|
if ! [ -z $DD_API_KEY ] && [ -f src/electron/junit/test-results-main.xml ]; then
|
||||||
|
export DATADOG_PATH=`node src/electron/script/yarn global bin`
|
||||||
|
$DATADOG_PATH/datadog-ci junit upload src/electron/junit/test-results-main.xml
|
||||||
|
fi
|
||||||
|
if: always() && !cancelled()
|
||||||
- name: Upload Test Artifacts
|
- name: Upload Test Artifacts
|
||||||
if: always() && !cancelled()
|
if: always() && !cancelled()
|
||||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
|
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
|
||||||
with:
|
with:
|
||||||
name: test_artifacts_${{ env.ARTIFACT_KEY }}
|
name: test_artifacts_${{ env.ARTIFACT_KEY }}_${{ matrix.shard }}
|
||||||
path: src/electron/spec/artifacts
|
path: src/electron/spec/artifacts
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
- name: Wait for active SSH sessions
|
- name: Wait for active SSH sessions
|
||||||
if: always() && !cancelled()
|
if: always() && !cancelled()
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
while [ -f /var/.ssh-lock ]
|
while [ -f /var/.ssh-lock ]
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ on:
|
|||||||
inputs:
|
inputs:
|
||||||
target-platform:
|
target-platform:
|
||||||
type: string
|
type: string
|
||||||
description: 'Platform to run on, can be macos or linux'
|
description: 'Platform to run on, can be macos, win or linux'
|
||||||
required: true
|
required: true
|
||||||
target-arch:
|
target-arch:
|
||||||
type: string
|
type: string
|
||||||
@@ -27,10 +27,11 @@ on:
|
|||||||
default: testing
|
default: testing
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: electron-node-nan-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
|
group: electron-node-nan-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }}
|
||||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
|
cancel-in-progress: ${{ github.ref_protected != true }}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||||
ELECTRON_OUT_DIR: Default
|
ELECTRON_OUT_DIR: Default
|
||||||
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
||||||
|
|
||||||
@@ -38,34 +39,33 @@ jobs:
|
|||||||
node-tests:
|
node-tests:
|
||||||
name: Run Node.js Tests
|
name: Run Node.js Tests
|
||||||
runs-on: electron-arc-linux-amd64-8core
|
runs-on: electron-arc-linux-amd64-8core
|
||||||
timeout-minutes: 20
|
timeout-minutes: 30
|
||||||
env:
|
env:
|
||||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
TARGET_ARCH: ${{ inputs.target-arch }}
|
||||||
BUILD_TYPE: linux
|
BUILD_TYPE: linux
|
||||||
container: ${{ fromJSON(inputs.test-container) }}
|
container: ${{ fromJSON(inputs.test-container) }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
- name: Install Build Tools
|
- name: Install Build Tools
|
||||||
uses: ./src/electron/.github/actions/install-build-tools
|
uses: ./src/electron/.github/actions/install-build-tools
|
||||||
- name: Init Build Tools
|
- name: Init Build Tools
|
||||||
run: |
|
run: |
|
||||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
|
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
uses: ./src/electron/.github/actions/install-dependencies
|
||||||
cd src/electron
|
- name: Set Chromium Git Cookie
|
||||||
node script/yarn install --frozen-lockfile
|
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||||
- name: Get Depot Tools
|
- name: Get Depot Tools
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
run: |
|
run: |
|
||||||
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||||
sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
|
|
||||||
# Ensure depot_tools does not update.
|
# Ensure depot_tools does not update.
|
||||||
test -d depot_tools && cd depot_tools
|
test -d depot_tools && cd depot_tools
|
||||||
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
|
|
||||||
touch .disable_auto_update
|
touch .disable_auto_update
|
||||||
- name: Add Depot Tools to PATH
|
- name: Add Depot Tools to PATH
|
||||||
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
||||||
@@ -93,6 +93,7 @@ jobs:
|
|||||||
node electron/script/node-spec-runner.js --default --jUnitDir=junit
|
node electron/script/node-spec-runner.js --default --jUnitDir=junit
|
||||||
- name: Wait for active SSH sessions
|
- name: Wait for active SSH sessions
|
||||||
if: always() && !cancelled()
|
if: always() && !cancelled()
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
while [ -f /var/.ssh-lock ]
|
while [ -f /var/.ssh-lock ]
|
||||||
do
|
do
|
||||||
@@ -101,34 +102,33 @@ jobs:
|
|||||||
nan-tests:
|
nan-tests:
|
||||||
name: Run Nan Tests
|
name: Run Nan Tests
|
||||||
runs-on: electron-arc-linux-amd64-4core
|
runs-on: electron-arc-linux-amd64-4core
|
||||||
timeout-minutes: 20
|
timeout-minutes: 30
|
||||||
env:
|
env:
|
||||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
TARGET_ARCH: ${{ inputs.target-arch }}
|
||||||
BUILD_TYPE: linux
|
BUILD_TYPE: linux
|
||||||
container: ${{ fromJSON(inputs.test-container) }}
|
container: ${{ fromJSON(inputs.test-container) }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Electron
|
- name: Checkout Electron
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
||||||
with:
|
with:
|
||||||
path: src/electron
|
path: src/electron
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
- name: Install Build Tools
|
- name: Install Build Tools
|
||||||
uses: ./src/electron/.github/actions/install-build-tools
|
uses: ./src/electron/.github/actions/install-build-tools
|
||||||
- name: Init Build Tools
|
- name: Init Build Tools
|
||||||
run: |
|
run: |
|
||||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }}
|
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }}
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
uses: ./src/electron/.github/actions/install-dependencies
|
||||||
cd src/electron
|
- name: Set Chromium Git Cookie
|
||||||
node script/yarn install --frozen-lockfile
|
uses: ./src/electron/.github/actions/set-chromium-cookie
|
||||||
- name: Get Depot Tools
|
- name: Get Depot Tools
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
run: |
|
run: |
|
||||||
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||||
sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
|
|
||||||
# Ensure depot_tools does not update.
|
# Ensure depot_tools does not update.
|
||||||
test -d depot_tools && cd depot_tools
|
test -d depot_tools && cd depot_tools
|
||||||
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
|
|
||||||
touch .disable_auto_update
|
touch .disable_auto_update
|
||||||
- name: Add Depot Tools to PATH
|
- name: Add Depot Tools to PATH
|
||||||
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
||||||
@@ -155,6 +155,7 @@ jobs:
|
|||||||
cd src
|
cd src
|
||||||
node electron/script/nan-spec-runner.js
|
node electron/script/nan-spec-runner.js
|
||||||
- name: Wait for active SSH sessions
|
- name: Wait for active SSH sessions
|
||||||
|
shell: bash
|
||||||
if: always() && !cancelled()
|
if: always() && !cancelled()
|
||||||
run: |
|
run: |
|
||||||
while [ -f /var/.ssh-lock ]
|
while [ -f /var/.ssh-lock ]
|
||||||
|
|||||||
2
.github/workflows/pull-request-labeled.yml
vendored
2
.github/workflows/pull-request-labeled.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Trigger Slack workflow
|
- name: Trigger Slack workflow
|
||||||
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
|
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
|
||||||
with:
|
with:
|
||||||
payload: |
|
payload: |
|
||||||
{
|
{
|
||||||
|
|||||||
6
.github/workflows/scorecards.yml
vendored
6
.github/workflows/scorecards.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout code"
|
- name: "Checkout code"
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ jobs:
|
|||||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||||
# format to the repository Actions tab.
|
# format to the repository Actions tab.
|
||||||
- name: "Upload artifact"
|
- name: "Upload artifact"
|
||||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
|
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
|
||||||
with:
|
with:
|
||||||
name: SARIF file
|
name: SARIF file
|
||||||
path: results.sarif
|
path: results.sarif
|
||||||
@@ -50,6 +50,6 @@ jobs:
|
|||||||
|
|
||||||
# Upload the results to GitHub's code scanning dashboard.
|
# Upload the results to GitHub's code scanning dashboard.
|
||||||
- name: "Upload to code-scanning"
|
- name: "Upload to code-scanning"
|
||||||
uses: github/codeql-action/upload-sarif@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3
|
uses: github/codeql-action/upload-sarif@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
|
||||||
with:
|
with:
|
||||||
sarif_file: results.sarif
|
sarif_file: results.sarif
|
||||||
|
|||||||
73
.github/workflows/update_appveyor_image.yml
vendored
73
.github/workflows/update_appveyor_image.yml
vendored
@@ -1,73 +0,0 @@
|
|||||||
name: Update AppVeyor Image
|
|
||||||
|
|
||||||
# Run chron daily Mon-Fri
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 8 * * 1-5' # runs 8:00 every business day (see https://crontab.guru)
|
|
||||||
|
|
||||||
permissions: {}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
bake-appveyor-image:
|
|
||||||
name: Bake AppVeyor Image
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Generate GitHub App token
|
|
||||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
|
||||||
id: generate-token
|
|
||||||
with:
|
|
||||||
creds: ${{ secrets.APPVEYOR_UPDATER_GH_APP_CREDS }}
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
token: ${{ steps.generate-token.outputs.token }}
|
|
||||||
- name: Yarn install
|
|
||||||
run: |
|
|
||||||
node script/yarn.js install --frozen-lockfile
|
|
||||||
- name: Set Repo for Commit
|
|
||||||
run: git config --global --add safe.directory $GITHUB_WORKSPACE
|
|
||||||
- name: Check AppVeyor Image
|
|
||||||
env:
|
|
||||||
APPVEYOR_TOKEN: ${{ secrets.APPVEYOR_TOKEN }}
|
|
||||||
run: |
|
|
||||||
node ./script/prepare-appveyor
|
|
||||||
if [ -f ./image_version.txt ]; then
|
|
||||||
echo "APPVEYOR_IMAGE_VERSION="$(cat image_version.txt)"" >> $GITHUB_ENV
|
|
||||||
rm image_version.txt
|
|
||||||
fi
|
|
||||||
- name: (Optionally) Update Appveyor Image
|
|
||||||
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
|
||||||
uses: mikefarah/yq@bbdd97482f2d439126582a59689eb1c855944955 # v4.44.3
|
|
||||||
with:
|
|
||||||
cmd: |
|
|
||||||
yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor.yml" > "appveyor2.yml"
|
|
||||||
yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor-woa.yml" > "appveyor-woa2.yml"
|
|
||||||
- name: (Optionally) Generate Commit Diff
|
|
||||||
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
|
||||||
run: |
|
|
||||||
diff -w -B appveyor.yml appveyor2.yml > appveyor.diff || true
|
|
||||||
patch -f appveyor.yml < appveyor.diff
|
|
||||||
rm appveyor2.yml appveyor.diff
|
|
||||||
git add appveyor.yml
|
|
||||||
- name: (Optionally) Generate Commit Diff for WOA
|
|
||||||
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
|
||||||
run: |
|
|
||||||
diff -w -B appveyor-woa.yml appveyor-woa2.yml > appveyor-woa.diff || true
|
|
||||||
patch -f appveyor-woa.yml < appveyor-woa.diff
|
|
||||||
rm appveyor-woa2.yml appveyor-woa.diff
|
|
||||||
git add appveyor-woa.yml
|
|
||||||
- name: (Optionally) Commit to Branch
|
|
||||||
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
|
||||||
uses: dsanders11/github-app-commit-action@43de6da2f4d927e997c0784c7a0b61bd19ad6aac # v1.5.0
|
|
||||||
with:
|
|
||||||
message: 'build: update appveyor image to latest version'
|
|
||||||
ref: bump-appveyor-image
|
|
||||||
token: ${{ steps.generate-token.outputs.token }}
|
|
||||||
- name: (Optionally) Create Pull Request
|
|
||||||
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
|
|
||||||
run: |
|
|
||||||
printf "This PR updates appveyor.yml to the latest baked image, ${{ env.APPVEYOR_IMAGE_VERSION }}.\n\nNotes: none" | gh pr create --head bump-appveyor-image --label no-backport --label semver/none --title 'build: update appveyor image to latest version' --body-file=-
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
|
||||||
84
.github/workflows/windows-publish.yml
vendored
Normal file
84
.github/workflows/windows-publish.yml
vendored
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
name: Publish Windows
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
build-image-sha:
|
||||||
|
type: string
|
||||||
|
description: 'SHA for electron/build image'
|
||||||
|
default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
|
||||||
|
required: true
|
||||||
|
upload-to-storage:
|
||||||
|
description: 'Uploads to Azure storage'
|
||||||
|
required: false
|
||||||
|
default: '1'
|
||||||
|
type: string
|
||||||
|
run-windows-publish:
|
||||||
|
description: 'Run the publish jobs vs just the build jobs'
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
checkout-windows:
|
||||||
|
runs-on: electron-arc-linux-amd64-32core
|
||||||
|
container:
|
||||||
|
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
|
||||||
|
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
|
||||||
|
volumes:
|
||||||
|
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||||
|
env:
|
||||||
|
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
|
||||||
|
TARGET_OS: 'win'
|
||||||
|
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
|
||||||
|
outputs:
|
||||||
|
build-image-sha: ${{ inputs.build-image-sha }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout Electron
|
||||||
|
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
||||||
|
with:
|
||||||
|
path: src/electron
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Checkout & Sync & Save
|
||||||
|
uses: ./src/electron/.github/actions/checkout
|
||||||
|
|
||||||
|
publish-x64-win:
|
||||||
|
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||||
|
needs: checkout-windows
|
||||||
|
with:
|
||||||
|
environment: production-release
|
||||||
|
build-runs-on: electron-arc-windows-amd64-16core
|
||||||
|
target-platform: win
|
||||||
|
target-arch: x64
|
||||||
|
is-release: true
|
||||||
|
gn-build-type: release
|
||||||
|
generate-symbols: true
|
||||||
|
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
publish-arm64-win:
|
||||||
|
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||||
|
needs: checkout-windows
|
||||||
|
with:
|
||||||
|
environment: production-release
|
||||||
|
build-runs-on: electron-arc-windows-amd64-16core
|
||||||
|
target-platform: win
|
||||||
|
target-arch: arm64
|
||||||
|
is-release: true
|
||||||
|
gn-build-type: release
|
||||||
|
generate-symbols: true
|
||||||
|
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
publish-x86-win:
|
||||||
|
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||||
|
needs: checkout-windows
|
||||||
|
with:
|
||||||
|
environment: production-release
|
||||||
|
build-runs-on: electron-arc-windows-amd64-16core
|
||||||
|
target-platform: win
|
||||||
|
target-arch: x86
|
||||||
|
is-release: true
|
||||||
|
gn-build-type: release
|
||||||
|
generate-symbols: true
|
||||||
|
upload-to-storage: ${{ inputs.upload-to-storage }}
|
||||||
|
secrets: inherit
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -48,7 +48,6 @@ ts-gen
|
|||||||
|
|
||||||
# Used to accelerate CI builds
|
# Used to accelerate CI builds
|
||||||
.depshash
|
.depshash
|
||||||
.depshash-target
|
|
||||||
|
|
||||||
# Used to accelerate builds after sync
|
# Used to accelerate builds after sync
|
||||||
patches/mtime-cache.json
|
patches/mtime-cache.json
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
"autolink": false,
|
"autolink": false,
|
||||||
"shortcut": false
|
"shortcut": false
|
||||||
},
|
},
|
||||||
|
"MD049": {
|
||||||
|
"style": "underscore"
|
||||||
|
},
|
||||||
"no-angle-brackets": true,
|
"no-angle-brackets": true,
|
||||||
"no-curly-braces": true,
|
"no-curly-braces": true,
|
||||||
"no-inline-html": {
|
"no-inline-html": {
|
||||||
|
|||||||
6
BUILD.gn
6
BUILD.gn
@@ -74,7 +74,7 @@ if (is_linux) {
|
|||||||
"notify_notification_set_image_from_pixbuf",
|
"notify_notification_set_image_from_pixbuf",
|
||||||
"notify_notification_set_timeout",
|
"notify_notification_set_timeout",
|
||||||
"notify_notification_set_urgency",
|
"notify_notification_set_urgency",
|
||||||
"notify_notification_set_hint_string",
|
"notify_notification_set_hint",
|
||||||
"notify_notification_show",
|
"notify_notification_show",
|
||||||
"notify_notification_close",
|
"notify_notification_close",
|
||||||
]
|
]
|
||||||
@@ -427,6 +427,7 @@ source_set("electron_lib") {
|
|||||||
"chromium_src:chrome_spellchecker",
|
"chromium_src:chrome_spellchecker",
|
||||||
"shell/common:mojo",
|
"shell/common:mojo",
|
||||||
"shell/common:plugin",
|
"shell/common:plugin",
|
||||||
|
"shell/common:web_contents_utility",
|
||||||
"shell/services/node/public/mojom",
|
"shell/services/node/public/mojom",
|
||||||
"//base:base_static",
|
"//base:base_static",
|
||||||
"//base/allocator:buildflags",
|
"//base/allocator:buildflags",
|
||||||
@@ -674,6 +675,8 @@ source_set("electron_lib") {
|
|||||||
|
|
||||||
if (enable_plugins) {
|
if (enable_plugins) {
|
||||||
sources += [
|
sources += [
|
||||||
|
"shell/browser/electron_plugin_info_host_impl.cc",
|
||||||
|
"shell/browser/electron_plugin_info_host_impl.h",
|
||||||
"shell/common/plugin_info.cc",
|
"shell/common/plugin_info.cc",
|
||||||
"shell/common/plugin_info.h",
|
"shell/common/plugin_info.h",
|
||||||
]
|
]
|
||||||
@@ -733,6 +736,7 @@ source_set("electron_lib") {
|
|||||||
"//components/pdf/common:util",
|
"//components/pdf/common:util",
|
||||||
"//components/pdf/renderer",
|
"//components/pdf/renderer",
|
||||||
"//pdf",
|
"//pdf",
|
||||||
|
"//pdf:content_restriction",
|
||||||
]
|
]
|
||||||
sources += [
|
sources += [
|
||||||
"shell/browser/electron_pdf_document_helper_client.cc",
|
"shell/browser/electron_pdf_document_helper_client.cc",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ propose changes to this document in a pull request.
|
|||||||
|
|
||||||
## [Issues](https://electronjs.org/docs/development/issues)
|
## [Issues](https://electronjs.org/docs/development/issues)
|
||||||
|
|
||||||
Issues are created [here](https://github.com/electron/electron/issues/new).
|
Issues are created [here](https://github.com/electron/electron/issues/new/choose).
|
||||||
|
|
||||||
* [How to Contribute in Issues](https://electronjs.org/docs/development/issues#how-to-contribute-in-issues)
|
* [How to Contribute in Issues](https://electronjs.org/docs/development/issues#how-to-contribute-in-issues)
|
||||||
* [Asking for General Help](https://electronjs.org/docs/development/issues#asking-for-general-help)
|
* [Asking for General Help](https://electronjs.org/docs/development/issues#asking-for-general-help)
|
||||||
|
|||||||
4
DEPS
4
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
|||||||
|
|
||||||
vars = {
|
vars = {
|
||||||
'chromium_version':
|
'chromium_version':
|
||||||
'129.0.6668.0',
|
'130.0.6723.191',
|
||||||
'node_version':
|
'node_version':
|
||||||
'v20.16.0',
|
'v20.18.3',
|
||||||
'nan_version':
|
'nan_version':
|
||||||
'e14bdcd1f72d62bca1d541b66da43130384ec213',
|
'e14bdcd1f72d62bca1d541b66da43130384ec213',
|
||||||
'squirrel.mac_version':
|
'squirrel.mac_version':
|
||||||
|
|||||||
@@ -1,107 +0,0 @@
|
|||||||
# The config is used to bake appveyor images, not for running CI jobs.
|
|
||||||
# The config expects the following environment variables to be set:
|
|
||||||
# - "APPVEYOR_BAKE_IMAGE" e.g. 'electron-99.0.4767.0'. Name of the image to be baked.
|
|
||||||
# Typically named after the Chromium version on which the image is built.
|
|
||||||
# This can be set dynamically in the prepare-appveyor script.
|
|
||||||
|
|
||||||
version: 1.0.{build}
|
|
||||||
build_cloud: electronhq-16-core
|
|
||||||
image: base-bake-image
|
|
||||||
environment:
|
|
||||||
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
|
||||||
ELECTRON_OUT_DIR: Default
|
|
||||||
ELECTRON_ENABLE_STACK_DUMPING: 1
|
|
||||||
MOCHA_REPORTER: mocha-multi-reporters
|
|
||||||
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
|
|
||||||
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
|
|
||||||
PYTHONIOENCODING: UTF-8
|
|
||||||
|
|
||||||
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
|
|
||||||
# init:
|
|
||||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
||||||
# - appveyor version
|
|
||||||
# - ps: $ErrorActionPreference = 'Stop'
|
|
||||||
# - ps: 'Write-Host "OS Build: $((Get-CimInstance Win32_OperatingSystem).BuildNumber)"'
|
|
||||||
|
|
||||||
# clone_folder: '%USERPROFILE%\image-bake-scripts'
|
|
||||||
|
|
||||||
# clone_script:
|
|
||||||
# - ps: Invoke-WebRequest "https://github.com/appveyor/build-images/archive/1f90d94e74c8243c909a09b994e527584dfcb838.zip" -OutFile "$env:temp\scripts.zip"
|
|
||||||
# - ps: Expand-Archive -Path "$env:temp\scripts.zip" -DestinationPath "$env:temp\scripts" -Force
|
|
||||||
# - ps: Copy-Item -Path "$env:temp\scripts\build-images-1f90d94e74c8243c909a09b994e527584dfcb838\scripts\Windows\*" -Destination $env:APPVEYOR_BUILD_FOLDER -Recurse
|
|
||||||
|
|
||||||
build_script:
|
|
||||||
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
|
|
||||||
# - ps: .\init_server.ps1
|
|
||||||
# - ps: .\extend_system_volume.ps1
|
|
||||||
|
|
||||||
# # Restart VM
|
|
||||||
# - ps: Start-Sleep -s 5; Restart-Computer
|
|
||||||
# - ps: Start-Sleep -s 5
|
|
||||||
|
|
||||||
# - appveyor version
|
|
||||||
# - ps: .\install_path_utils.ps1
|
|
||||||
# - ps: .\install_powershell_core.ps1
|
|
||||||
# - ps: .\install_powershell_get.ps1
|
|
||||||
# - ps: .\install_7zip.ps1
|
|
||||||
# - ps: .\install_chocolatey.ps1
|
|
||||||
# - ps: .\install_webpi.ps1
|
|
||||||
# - ps: .\install_nuget.ps1
|
|
||||||
# - ps: .\install_pstools.ps1
|
|
||||||
|
|
||||||
# - ps: .\install_git.ps1
|
|
||||||
# - ps: .\install_git_lfs.ps1
|
|
||||||
|
|
||||||
# # Restart VM
|
|
||||||
# - ps: Start-Sleep -s 5; Restart-Computer
|
|
||||||
# - ps: Start-Sleep -s 5
|
|
||||||
# END LINES FOR COMPLETELY NEW IMAGE
|
|
||||||
|
|
||||||
- git config --global core.longpaths true
|
|
||||||
- ps: >-
|
|
||||||
if (-not (Test-Path -Path C:\projects\src)) {
|
|
||||||
New-Item -Path C:\projects\src -ItemType Directory
|
|
||||||
}
|
|
||||||
- cd C:\projects\
|
|
||||||
- git clone -q --branch=%APPVEYOR_REPO_BRANCH% https://github.com/electron/electron.git C:\projects\src\electron
|
|
||||||
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
|
||||||
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
|
|
||||||
- update_depot_tools.bat
|
|
||||||
# Uncomment the following line if windows deps change
|
|
||||||
# - src\electron\script\setup-win-for-dev.bat
|
|
||||||
- >-
|
|
||||||
gclient config
|
|
||||||
--name "src\electron"
|
|
||||||
--unmanaged
|
|
||||||
%GCLIENT_EXTRA_ARGS%
|
|
||||||
"https://github.com/electron/electron"
|
|
||||||
- ps: cd src\electron
|
|
||||||
- ps: node script\generate-deps-hash.js
|
|
||||||
- ps: $depshash = Get-Content .\.depshash -Raw
|
|
||||||
- ps: Copy-Item -path .\.depshash -destination ..\.depshash
|
|
||||||
- ps: cd ..\..
|
|
||||||
- gclient sync --with_branch_heads --with_tags --nohooks
|
|
||||||
- ps: regsvr32 /s "C:\Program Files\Microsoft Visual Studio\2022\Community\DIA SDK\bin\amd64\msdia140.dll"
|
|
||||||
- ps: set vs2022_install="C:\Program Files\Microsoft Visual Studio\2022\Community"
|
|
||||||
|
|
||||||
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
|
|
||||||
# # Restart VM
|
|
||||||
# - ps: Start-Sleep -s 5; Restart-Computer
|
|
||||||
# - ps: Start-Sleep -s 5
|
|
||||||
|
|
||||||
# - cd %USERPROFILE%\image-bake-scripts
|
|
||||||
# - appveyor version
|
|
||||||
# - ps: .\optimize_dotnet_runtime.ps1
|
|
||||||
# - ps: .\disable_windows_background_services.ps1
|
|
||||||
# - ps: .\enforce_windows_firewall.ps1
|
|
||||||
# - ps: .\cleanup_windows.ps1
|
|
||||||
# END LINES FOR COMPLETELY NEW IMAGE
|
|
||||||
on_image_bake:
|
|
||||||
- ps: >-
|
|
||||||
echo "Baking image: $env:APPVEYOR_BAKE_IMAGE at dir $PWD"
|
|
||||||
- ps: Remove-Item -Recurse -Force C:\projects\depot_tools
|
|
||||||
- ps: Remove-Item -Recurse -Force C:\projects\src\electron
|
|
||||||
# Uncomment these lines and set APPVEYOR_RDP_PASSWORD in project settings to enable RDP after bake is done
|
|
||||||
# # on_finish:
|
|
||||||
# - ps: >-
|
|
||||||
# $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
||||||
321
appveyor-woa.yml
321
appveyor-woa.yml
@@ -1,321 +0,0 @@
|
|||||||
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor.yml
|
|
||||||
# IF APPLICABLE!!!!
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# The config expects the following environment variables to be set:
|
|
||||||
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
|
|
||||||
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
|
|
||||||
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
|
|
||||||
# https://gn.googlesource.com/gn/+/main/docs/reference.md#var_target_cpu
|
|
||||||
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
|
|
||||||
# if you pass a custom value for 'target_cpu'.
|
|
||||||
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
|
|
||||||
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
|
|
||||||
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
|
|
||||||
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64'}.
|
|
||||||
# Is used in some publishing scripts, but does NOT affect the Electron binary.
|
|
||||||
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
|
|
||||||
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
|
|
||||||
# Otherwise the release will be uploaded to the GitHub Releases.
|
|
||||||
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
|
|
||||||
#
|
|
||||||
# The publishing scripts expect access tokens to be defined as env vars,
|
|
||||||
# but those are not covered here.
|
|
||||||
#
|
|
||||||
# AppVeyor docs on variables:
|
|
||||||
# https://www.appveyor.com/docs/environment-variables/
|
|
||||||
# https://www.appveyor.com/docs/build-configuration/#secure-variables
|
|
||||||
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
|
|
||||||
|
|
||||||
version: 1.0.{build}
|
|
||||||
build_cloud: electronhq-16-core
|
|
||||||
image: e-129.0.6656.0
|
|
||||||
environment:
|
|
||||||
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
|
||||||
ELECTRON_OUT_DIR: Default
|
|
||||||
ELECTRON_ENABLE_STACK_DUMPING: 1
|
|
||||||
ELECTRON_ALSO_LOG_TO_STDERR: 1
|
|
||||||
MOCHA_REPORTER: mocha-multi-reporters
|
|
||||||
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap"
|
|
||||||
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
|
|
||||||
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
|
|
||||||
GYP_MSVS_HASH_7393122652: 3ba76c5c20
|
|
||||||
PYTHONIOENCODING: UTF-8
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
|
|
||||||
- job_name: Build Arm on X64 Windows
|
|
||||||
- job_name: Test On Windows On Arm Hardware
|
|
||||||
job_depends_on: Build Arm on X64 Windows
|
|
||||||
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
|
|
||||||
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
|
|
||||||
|
|
||||||
clone_script:
|
|
||||||
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
|
|
||||||
- ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
|
|
||||||
- ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
|
|
||||||
|
|
||||||
clone_folder: C:\projects\src\electron
|
|
||||||
|
|
||||||
skip_branch_with_pr: true
|
|
||||||
|
|
||||||
# the first failed job cancels other jobs and fails entire build
|
|
||||||
matrix:
|
|
||||||
fast_finish: true
|
|
||||||
|
|
||||||
for:
|
|
||||||
|
|
||||||
- matrix:
|
|
||||||
only:
|
|
||||||
- job_name: Build Arm on X64 Windows
|
|
||||||
|
|
||||||
build_script:
|
|
||||||
- ps: |
|
|
||||||
node script/yarn.js install --frozen-lockfile
|
|
||||||
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
|
|
||||||
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
|
|
||||||
if ($LASTEXITCODE -eq 0) {
|
|
||||||
Write-warning "Skipping build for doc-only change"
|
|
||||||
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
|
|
||||||
Exit-AppveyorBuild
|
|
||||||
} else {
|
|
||||||
$global:LASTEXITCODE = 0
|
|
||||||
}
|
|
||||||
- cd ..
|
|
||||||
- ps: Write-Host "Building $env:GN_CONFIG build"
|
|
||||||
- git config --global core.longpaths true
|
|
||||||
- ps: >-
|
|
||||||
if (Test-Path -Path "$pwd\depot_tools") {
|
|
||||||
Remove-Item -Recurse -Force $pwd\depot_tools
|
|
||||||
}
|
|
||||||
- ps: >-
|
|
||||||
if (Test-Path -Path "$pwd\build-tools") {
|
|
||||||
Remove-Item -Recurse -Force $pwd\build-tools
|
|
||||||
}
|
|
||||||
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
|
||||||
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
|
|
||||||
- depot_tools\bootstrap\win_tools.bat
|
|
||||||
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
|
|
||||||
- ps: >-
|
|
||||||
if (Test-Path -Path "$pwd\src\electron") {
|
|
||||||
Remove-Item -Recurse -Force $pwd\src\electron
|
|
||||||
}
|
|
||||||
- git clone https://github.com/electron/build-tools.git
|
|
||||||
- cd build-tools
|
|
||||||
- npx yarn --ignore-engines
|
|
||||||
- mkdir third_party
|
|
||||||
- ps: >-
|
|
||||||
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
|
|
||||||
- ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath({})"
|
|
||||||
- ps: >-
|
|
||||||
& $env:RECLIENT_HELPER login
|
|
||||||
- ps: >-
|
|
||||||
$env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
|
|
||||||
- ps: >-
|
|
||||||
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
|
|
||||||
- ps: >-
|
|
||||||
$env:RBE_experimental_credentials_helper_args = "print"
|
|
||||||
- cd ..\..
|
|
||||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
|
||||||
- ps: >-
|
|
||||||
if ($env:GN_CONFIG -ne 'release') {
|
|
||||||
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
|
|
||||||
}
|
|
||||||
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
|
|
||||||
# Patches are applied in the image bake. Check depshash to see if patches have changed.
|
|
||||||
- ps: $env:RUN_GCLIENT_SYNC="false"
|
|
||||||
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
|
|
||||||
- ps: cd src\electron
|
|
||||||
- ps: node script\generate-deps-hash.js
|
|
||||||
- ps: $depshash = Get-Content .\.depshash -Raw
|
|
||||||
- ps: cd ..\..
|
|
||||||
- ps: >-
|
|
||||||
if ($depshash_baked -ne $depshash) {
|
|
||||||
$env:RUN_GCLIENT_SYNC="true"
|
|
||||||
}
|
|
||||||
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
|
|
||||||
- cd src
|
|
||||||
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
|
|
||||||
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
|
|
||||||
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% "
|
|
||||||
- gn check out/Default //electron:electron_lib
|
|
||||||
- gn check out/Default //electron:electron_app
|
|
||||||
- gn check out/Default //electron/shell/common:mojo
|
|
||||||
- gn check out/Default //electron/shell/common:plugin
|
|
||||||
- if DEFINED ELECTRON_RBE_JWT (autoninja -j 300 -C out/Default electron:electron_app) else (autoninja -C out/Default electron:electron_app)
|
|
||||||
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
|
|
||||||
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
|
|
||||||
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
|
|
||||||
- autoninja -C out/Default electron:electron_dist_zip
|
|
||||||
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
|
|
||||||
# Remove unused args from mksnapshot_args
|
|
||||||
- ps: >-
|
|
||||||
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
|
|
||||||
- autoninja -C out/Default electron:electron_mksnapshot_zip
|
|
||||||
- cd out\Default
|
|
||||||
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
|
|
||||||
- cd ..\..
|
|
||||||
- autoninja -C out/Default electron:hunspell_dictionaries_zip
|
|
||||||
- autoninja -C out/Default electron:electron_chromedriver_zip
|
|
||||||
- autoninja -C out/Default electron:node_headers
|
|
||||||
- ps: >-
|
|
||||||
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
|
|
||||||
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
|
|
||||||
- 7z a node_headers.zip out\Default\gen\node_headers
|
|
||||||
- 7z a nan.zip third_party\nan
|
|
||||||
- ps: >-
|
|
||||||
if ($env:GN_CONFIG -eq 'release') {
|
|
||||||
# Needed for msdia140.dll on 64-bit windows
|
|
||||||
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
|
||||||
autoninja -C out/Default electron:electron_symbols
|
|
||||||
}
|
|
||||||
- ps: >-
|
|
||||||
if ($env:GN_CONFIG -eq 'release') {
|
|
||||||
python3 electron\script\zip-symbols.py
|
|
||||||
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
|
|
||||||
} else {
|
|
||||||
# It's useful to have pdb files when debugging testing builds that are
|
|
||||||
# built on CI.
|
|
||||||
7z a pdb.zip out\Default\*.pdb
|
|
||||||
}
|
|
||||||
- ps: |
|
|
||||||
$manifest_file = "electron/script/zip_manifests/dist_zip.win.$env:TARGET_ARCH.manifest"
|
|
||||||
python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip $manifest_file
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
|
||||||
throw "Zip contains files not listed in the manifest $manifest_file"
|
|
||||||
}
|
|
||||||
- ps: |
|
|
||||||
cd C:\projects\src
|
|
||||||
$missing_artifacts = $false
|
|
||||||
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
|
|
||||||
Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
|
|
||||||
} else {
|
|
||||||
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip','nan.zip'
|
|
||||||
foreach($artifact_name in $artifacts_to_validate) {
|
|
||||||
if ($artifact_name -eq 'ffmpeg.zip') {
|
|
||||||
$artifact_file = "out\ffmpeg\ffmpeg.zip"
|
|
||||||
} elseif (
|
|
||||||
$artifact_name -eq 'node_headers.zip') {
|
|
||||||
$artifact_file = $artifact_name
|
|
||||||
} elseif (
|
|
||||||
$artifact_name -eq 'nan.zip') {
|
|
||||||
$artifact_file = $artifact_name
|
|
||||||
} else {
|
|
||||||
$artifact_file = "out\Default\$artifact_name"
|
|
||||||
}
|
|
||||||
if (-not(Test-Path $artifact_file)) {
|
|
||||||
Write-warning "$artifact_name is missing and cannot be added to artifacts"
|
|
||||||
$missing_artifacts = $true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($missing_artifacts) {
|
|
||||||
throw "Build failed due to missing artifacts"
|
|
||||||
}
|
|
||||||
|
|
||||||
deploy_script:
|
|
||||||
- cd electron
|
|
||||||
- ps: >-
|
|
||||||
if (Test-Path Env:\ELECTRON_RELEASE) {
|
|
||||||
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
|
|
||||||
Write-Output "Uploading Electron release distribution to azure"
|
|
||||||
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
|
|
||||||
} else {
|
|
||||||
Write-Output "Uploading Electron release distribution to github releases"
|
|
||||||
& python3 script\release\uploaders\upload.py --verbose
|
|
||||||
}
|
|
||||||
}
|
|
||||||
on_finish:
|
|
||||||
# Uncomment this lines to enable RDP
|
|
||||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
||||||
- cd C:\projects\src
|
|
||||||
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
|
|
||||||
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
|
|
||||||
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
|
|
||||||
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
|
|
||||||
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
|
|
||||||
- if exist nan.zip (appveyor-retry appveyor PushArtifact nan.zip)
|
|
||||||
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
|
|
||||||
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
|
|
||||||
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
|
|
||||||
- ps: >-
|
|
||||||
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
|
|
||||||
appveyor-retry appveyor PushArtifact pdb.zip
|
|
||||||
}
|
|
||||||
- matrix:
|
|
||||||
only:
|
|
||||||
- job_name: Test On Windows On Arm Hardware
|
|
||||||
|
|
||||||
environment:
|
|
||||||
IGNORE_YARN_INSTALL_ERROR: 1
|
|
||||||
ELECTRON_TEST_RESULTS_DIR: junit
|
|
||||||
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
|
|
||||||
MOCHA_REPORTER: mocha-multi-reporters
|
|
||||||
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
|
||||||
|
|
||||||
build_script:
|
|
||||||
- ps: |
|
|
||||||
node script/yarn.js install --frozen-lockfile
|
|
||||||
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
|
|
||||||
if ($LASTEXITCODE -eq 0) {
|
|
||||||
Write-warning "Skipping build for doc only change"
|
|
||||||
Exit-AppveyorBuild
|
|
||||||
} else {
|
|
||||||
$global:LASTEXITCODE = 0
|
|
||||||
}
|
|
||||||
- cd ..
|
|
||||||
- mkdir out\Default
|
|
||||||
- cd ..
|
|
||||||
- ps: |
|
|
||||||
# Download build artifacts
|
|
||||||
$apiUrl = 'https://ci.appveyor.com/api'
|
|
||||||
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
|
|
||||||
$artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','electron.lib', 'nan.zip')
|
|
||||||
foreach ($job in $build_info.build.jobs) {
|
|
||||||
if ($job.name -eq "Build Arm on X64 Windows") {
|
|
||||||
$jobId = $job.jobId
|
|
||||||
foreach($artifact_name in $artifacts_to_download) {
|
|
||||||
if ($artifact_name -eq 'electron.lib') {
|
|
||||||
$outfile = "src\out\Default\$artifact_name"
|
|
||||||
} else {
|
|
||||||
$outfile = $artifact_name
|
|
||||||
}
|
|
||||||
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
|
|
||||||
}
|
|
||||||
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
|
|
||||||
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
|
|
||||||
7z x -y -osrc pdb.zip
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- ps: |
|
|
||||||
$out_default_zips = @('dist.zip')
|
|
||||||
foreach($zip_name in $out_default_zips) {
|
|
||||||
7z x -y -osrc\out\Default $zip_name
|
|
||||||
}
|
|
||||||
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
|
|
||||||
- ps: 7z x -y -osrc node_headers.zip
|
|
||||||
- ps: 7z x -y -osrc nan.zip
|
|
||||||
|
|
||||||
test_script:
|
|
||||||
# Workaround for https://github.com/appveyor/ci/issues/2420
|
|
||||||
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
|
|
||||||
- ps: |
|
|
||||||
cd src
|
|
||||||
New-Item .\out\Default\gen\node_headers\Release -Type directory
|
|
||||||
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
|
|
||||||
- set npm_config_nodedir=%cd%\out\Default\gen\node_headers
|
|
||||||
- set npm_config_arch=arm64
|
|
||||||
- cd electron
|
|
||||||
# Explicitly set npm_config_arch because the .env doesn't persist
|
|
||||||
- ps: >-
|
|
||||||
if ($env:TARGET_ARCH -eq 'ia32') {
|
|
||||||
$env:npm_config_arch = "ia32"
|
|
||||||
}
|
|
||||||
- echo Running main test suite & node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
|
|
||||||
- cd ..
|
|
||||||
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
|
|
||||||
|
|
||||||
on_finish:
|
|
||||||
# Uncomment these lines to enable RDP
|
|
||||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
||||||
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )
|
|
||||||
314
appveyor.yml
314
appveyor.yml
@@ -1,314 +0,0 @@
|
|||||||
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor-woa.yml
|
|
||||||
# IF APPLICABLE!!!!
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# The config expects the following environment variables to be set:
|
|
||||||
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
|
|
||||||
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
|
|
||||||
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
|
|
||||||
# https://gn.googlesource.com/gn/+/main/docs/reference.md#var_target_cpu
|
|
||||||
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
|
|
||||||
# if you pass a custom value for 'target_cpu'.
|
|
||||||
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
|
|
||||||
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
|
|
||||||
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
|
|
||||||
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64'}.
|
|
||||||
# Is used in some publishing scripts, but does NOT affect the Electron binary.
|
|
||||||
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
|
|
||||||
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
|
|
||||||
# Otherwise the release will be uploaded to the GitHub Releases.
|
|
||||||
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
|
|
||||||
#
|
|
||||||
# The publishing scripts expect access tokens to be defined as env vars,
|
|
||||||
# but those are not covered here.
|
|
||||||
#
|
|
||||||
# AppVeyor docs on variables:
|
|
||||||
# https://www.appveyor.com/docs/environment-variables/
|
|
||||||
# https://www.appveyor.com/docs/build-configuration/#secure-variables
|
|
||||||
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
|
|
||||||
|
|
||||||
version: 1.0.{build}
|
|
||||||
build_cloud: electronhq-16-core
|
|
||||||
image: e-129.0.6656.0
|
|
||||||
environment:
|
|
||||||
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
|
||||||
ELECTRON_OUT_DIR: Default
|
|
||||||
ELECTRON_ENABLE_STACK_DUMPING: 1
|
|
||||||
ELECTRON_ALSO_LOG_TO_STDERR: 1
|
|
||||||
MOCHA_REPORTER: mocha-multi-reporters
|
|
||||||
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap"
|
|
||||||
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
|
|
||||||
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
|
|
||||||
GYP_MSVS_HASH_7393122652: 3ba76c5c20
|
|
||||||
PYTHONIOENCODING: UTF-8
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
|
|
||||||
- job_name: Build
|
|
||||||
- job_name: Test
|
|
||||||
job_depends_on: Build
|
|
||||||
|
|
||||||
clone_script:
|
|
||||||
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
|
|
||||||
- ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
|
|
||||||
- ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
|
|
||||||
|
|
||||||
clone_folder: C:\projects\src\electron
|
|
||||||
|
|
||||||
skip_branch_with_pr: true
|
|
||||||
|
|
||||||
# the first failed job cancels other jobs and fails entire build
|
|
||||||
matrix:
|
|
||||||
fast_finish: true
|
|
||||||
|
|
||||||
for:
|
|
||||||
|
|
||||||
- matrix:
|
|
||||||
only:
|
|
||||||
- job_name: Build
|
|
||||||
|
|
||||||
build_script:
|
|
||||||
- ps: |
|
|
||||||
node script/yarn.js install --frozen-lockfile
|
|
||||||
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
|
|
||||||
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
|
|
||||||
if ($LASTEXITCODE -eq 0) {
|
|
||||||
Write-warning "Skipping build for doc-only change"
|
|
||||||
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
|
|
||||||
Exit-AppveyorBuild
|
|
||||||
} else {
|
|
||||||
$global:LASTEXITCODE = 0
|
|
||||||
}
|
|
||||||
- cd ..
|
|
||||||
- ps: Write-Host "Building $env:GN_CONFIG build"
|
|
||||||
- git config --global core.longpaths true
|
|
||||||
- ps: >-
|
|
||||||
if (Test-Path -Path "$pwd\depot_tools") {
|
|
||||||
Remove-Item -Recurse -Force $pwd\depot_tools
|
|
||||||
}
|
|
||||||
- ps: >-
|
|
||||||
if (Test-Path -Path "$pwd\build-tools") {
|
|
||||||
Remove-Item -Recurse -Force $pwd\build-tools
|
|
||||||
}
|
|
||||||
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
|
||||||
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
|
|
||||||
- depot_tools\bootstrap\win_tools.bat
|
|
||||||
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
|
|
||||||
- ps: >-
|
|
||||||
if (Test-Path -Path "$pwd\src\electron") {
|
|
||||||
Remove-Item -Recurse -Force $pwd\src\electron
|
|
||||||
}
|
|
||||||
- git clone https://github.com/electron/build-tools.git
|
|
||||||
- cd build-tools
|
|
||||||
- npx yarn --ignore-engines
|
|
||||||
- mkdir third_party
|
|
||||||
- ps: >-
|
|
||||||
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
|
|
||||||
- ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath({})"
|
|
||||||
- ps: >-
|
|
||||||
& $env:RECLIENT_HELPER login
|
|
||||||
- ps: >-
|
|
||||||
$env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
|
|
||||||
- ps: >-
|
|
||||||
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
|
|
||||||
- ps: >-
|
|
||||||
$env:RBE_experimental_credentials_helper_args = "print"
|
|
||||||
- cd ..\..
|
|
||||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
|
||||||
- ps: >-
|
|
||||||
if ($env:GN_CONFIG -ne 'release') {
|
|
||||||
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
|
|
||||||
}
|
|
||||||
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
|
|
||||||
# Patches are applied in the image bake. Check depshash to see if patches have changed.
|
|
||||||
- ps: $env:RUN_GCLIENT_SYNC="false"
|
|
||||||
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
|
|
||||||
- ps: cd src\electron
|
|
||||||
- ps: node script\generate-deps-hash.js
|
|
||||||
- ps: $depshash = Get-Content .\.depshash -Raw
|
|
||||||
- ps: cd ..\..
|
|
||||||
- ps: >-
|
|
||||||
if ($depshash_baked -ne $depshash) {
|
|
||||||
$env:RUN_GCLIENT_SYNC="true"
|
|
||||||
}
|
|
||||||
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
|
|
||||||
- cd src
|
|
||||||
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
|
|
||||||
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
|
|
||||||
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% "
|
|
||||||
- gn check out/Default //electron:electron_lib
|
|
||||||
- gn check out/Default //electron:electron_app
|
|
||||||
- gn check out/Default //electron/shell/common:mojo
|
|
||||||
- gn check out/Default //electron/shell/common:plugin
|
|
||||||
- if DEFINED ELECTRON_RBE_JWT (autoninja -j 300 -C out/Default electron:electron_app) else (autoninja -C out/Default electron:electron_app)
|
|
||||||
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
|
|
||||||
- gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
|
|
||||||
- autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
|
|
||||||
- autoninja -C out/Default electron:electron_dist_zip
|
|
||||||
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
|
|
||||||
# Remove unused args from mksnapshot_args
|
|
||||||
- ps: >-
|
|
||||||
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
|
|
||||||
- autoninja -C out/Default electron:electron_mksnapshot_zip
|
|
||||||
- cd out\Default
|
|
||||||
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
|
|
||||||
- cd ..\..
|
|
||||||
- autoninja -C out/Default electron:hunspell_dictionaries_zip
|
|
||||||
- autoninja -C out/Default electron:electron_chromedriver_zip
|
|
||||||
- autoninja -C out/Default electron:node_headers
|
|
||||||
- ps: >-
|
|
||||||
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
|
|
||||||
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
|
|
||||||
- 7z a node_headers.zip out\Default\gen\node_headers
|
|
||||||
- ps: >-
|
|
||||||
if ($env:GN_CONFIG -eq 'release') {
|
|
||||||
# Needed for msdia140.dll on 64-bit windows
|
|
||||||
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
|
|
||||||
autoninja -C out/Default electron:electron_symbols
|
|
||||||
}
|
|
||||||
- ps: >-
|
|
||||||
if ($env:GN_CONFIG -eq 'release') {
|
|
||||||
python3 electron\script\zip-symbols.py
|
|
||||||
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
|
|
||||||
} else {
|
|
||||||
# It's useful to have pdb files when debugging testing builds that are
|
|
||||||
# built on CI.
|
|
||||||
7z a pdb.zip out\Default\*.pdb
|
|
||||||
}
|
|
||||||
- ps: |
|
|
||||||
$manifest_file = "electron/script/zip_manifests/dist_zip.win.$env:TARGET_ARCH.manifest"
|
|
||||||
python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip $manifest_file
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
|
||||||
throw "Zip contains files not listed in the manifest $manifest_file"
|
|
||||||
}
|
|
||||||
- ps: |
|
|
||||||
cd C:\projects\src
|
|
||||||
$missing_artifacts = $false
|
|
||||||
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
|
|
||||||
Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
|
|
||||||
} else {
|
|
||||||
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip'
|
|
||||||
foreach($artifact_name in $artifacts_to_validate) {
|
|
||||||
if ($artifact_name -eq 'ffmpeg.zip') {
|
|
||||||
$artifact_file = "out\ffmpeg\ffmpeg.zip"
|
|
||||||
} elseif (
|
|
||||||
$artifact_name -eq 'node_headers.zip') {
|
|
||||||
$artifact_file = $artifact_name
|
|
||||||
} else {
|
|
||||||
$artifact_file = "out\Default\$artifact_name"
|
|
||||||
}
|
|
||||||
if (-not(Test-Path $artifact_file)) {
|
|
||||||
Write-warning "$artifact_name is missing and cannot be added to artifacts"
|
|
||||||
$missing_artifacts = $true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($missing_artifacts) {
|
|
||||||
throw "Build failed due to missing artifacts"
|
|
||||||
}
|
|
||||||
|
|
||||||
deploy_script:
|
|
||||||
- cd electron
|
|
||||||
- ps: >-
|
|
||||||
if (Test-Path Env:\ELECTRON_RELEASE) {
|
|
||||||
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
|
|
||||||
Write-Output "Uploading Electron release distribution to azure"
|
|
||||||
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
|
|
||||||
} else {
|
|
||||||
Write-Output "Uploading Electron release distribution to github releases"
|
|
||||||
& python3 script\release\uploaders\upload.py --verbose
|
|
||||||
}
|
|
||||||
}
|
|
||||||
on_finish:
|
|
||||||
# Uncomment this lines to enable RDP
|
|
||||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
||||||
- cd C:\projects\src
|
|
||||||
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
|
|
||||||
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
|
|
||||||
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
|
|
||||||
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
|
|
||||||
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
|
|
||||||
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
|
|
||||||
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
|
|
||||||
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
|
|
||||||
- ps: >-
|
|
||||||
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
|
|
||||||
appveyor-retry appveyor PushArtifact pdb.zip
|
|
||||||
}
|
|
||||||
- matrix:
|
|
||||||
only:
|
|
||||||
- job_name: Test
|
|
||||||
|
|
||||||
init:
|
|
||||||
- ps: |
|
|
||||||
if ($env:RUN_TESTS -ne 'true') {
|
|
||||||
Write-warning "Skipping tests for $env:APPVEYOR_PROJECT_NAME"; Exit-AppveyorBuild
|
|
||||||
}
|
|
||||||
build_script:
|
|
||||||
- ps: |
|
|
||||||
node script/yarn.js install --frozen-lockfile
|
|
||||||
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
|
|
||||||
if ($LASTEXITCODE -eq 0) {
|
|
||||||
Write-warning "Skipping build for doc only change"
|
|
||||||
Exit-AppveyorBuild
|
|
||||||
} else {
|
|
||||||
$global:LASTEXITCODE = 0
|
|
||||||
}
|
|
||||||
- cd ..
|
|
||||||
- mkdir out\Default
|
|
||||||
- cd ..
|
|
||||||
- ps: |
|
|
||||||
# Download build artifacts
|
|
||||||
$apiUrl = 'https://ci.appveyor.com/api'
|
|
||||||
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
|
|
||||||
$artifacts_to_download = @('dist.zip','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib')
|
|
||||||
foreach ($job in $build_info.build.jobs) {
|
|
||||||
if ($job.name -eq "Build") {
|
|
||||||
$jobId = $job.jobId
|
|
||||||
foreach($artifact_name in $artifacts_to_download) {
|
|
||||||
if ($artifact_name -eq 'electron.lib') {
|
|
||||||
$outfile = "src\out\Default\$artifact_name"
|
|
||||||
} else {
|
|
||||||
$outfile = $artifact_name
|
|
||||||
}
|
|
||||||
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
|
|
||||||
}
|
|
||||||
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
|
|
||||||
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
|
|
||||||
7z x -y -osrc pdb.zip
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- ps: |
|
|
||||||
$out_default_zips = @('dist.zip','chromedriver.zip','mksnapshot.zip')
|
|
||||||
foreach($zip_name in $out_default_zips) {
|
|
||||||
7z x -y -osrc\out\Default $zip_name
|
|
||||||
}
|
|
||||||
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
|
|
||||||
- ps: 7z x -y -osrc node_headers.zip
|
|
||||||
|
|
||||||
test_script:
|
|
||||||
# Workaround for https://github.com/appveyor/ci/issues/2420
|
|
||||||
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
|
|
||||||
- ps: |
|
|
||||||
cd src
|
|
||||||
New-Item .\out\Default\gen\node_headers\Release -Type directory
|
|
||||||
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
|
|
||||||
- cd electron
|
|
||||||
# Explicitly set npm_config_arch because the .env doesn't persist
|
|
||||||
- ps: >-
|
|
||||||
if ($env:TARGET_ARCH -eq 'ia32') {
|
|
||||||
$env:npm_config_arch = "ia32"
|
|
||||||
}
|
|
||||||
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log
|
|
||||||
- cd ..
|
|
||||||
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
|
|
||||||
- echo "About to verify mksnapshot"
|
|
||||||
- echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd%
|
|
||||||
- echo "Done verifying mksnapshot"
|
|
||||||
- echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd%
|
|
||||||
- echo "Done verifying chromedriver"
|
|
||||||
|
|
||||||
on_finish:
|
|
||||||
# Uncomment these lines to enable RDP
|
|
||||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
||||||
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )
|
|
||||||
@@ -2,7 +2,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
DEFINE_EXTRACT_REGEX = re.compile('^ *# *define (\w*)', re.MULTILINE)
|
DEFINE_EXTRACT_REGEX = re.compile(r'^ *# *define (\w*)', re.MULTILINE)
|
||||||
|
|
||||||
def main(out_dir, headers):
|
def main(out_dir, headers):
|
||||||
defines = []
|
defines = []
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
const TerserPlugin = require('terser-webpack-plugin');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const WrapperPlugin = require('wrapper-webpack-plugin');
|
||||||
|
|
||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
const webpack = require('webpack');
|
|
||||||
const TerserPlugin = require('terser-webpack-plugin');
|
|
||||||
const WrapperPlugin = require('wrapper-webpack-plugin');
|
|
||||||
|
|
||||||
const electronRoot = path.resolve(__dirname, '../..');
|
const electronRoot = path.resolve(__dirname, '../..');
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ def skip_path(dep, dist_zip, target_cpu):
|
|||||||
and dep == "snapshot_blob.bin"
|
and dep == "snapshot_blob.bin"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if should_skip:
|
if should_skip and os.environ.get('ELECTRON_DEBUG_ZIP_SKIP') == '1':
|
||||||
print("Skipping {}".format(dep))
|
print("Skipping {}".format(dep))
|
||||||
return should_skip
|
return should_skip
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ static_library("chrome") {
|
|||||||
"//chrome/browser/ui/view_ids.h",
|
"//chrome/browser/ui/view_ids.h",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
|
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
|
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
|
||||||
|
"//chrome/browser/ui/views/overlay/back_to_tab_button.cc",
|
||||||
|
"//chrome/browser/ui/views/overlay/back_to_tab_button.h",
|
||||||
"//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc",
|
"//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc",
|
||||||
"//chrome/browser/ui/views/overlay/close_image_button.cc",
|
"//chrome/browser/ui/views/overlay/close_image_button.cc",
|
||||||
"//chrome/browser/ui/views/overlay/close_image_button.h",
|
"//chrome/browser/ui/views/overlay/close_image_button.h",
|
||||||
@@ -156,14 +158,12 @@ static_library("chrome") {
|
|||||||
"//chrome/browser/icon_loader_win.cc",
|
"//chrome/browser/icon_loader_win.cc",
|
||||||
"//chrome/browser/media/webrtc/window_icon_util_win.cc",
|
"//chrome/browser/media/webrtc/window_icon_util_win.cc",
|
||||||
"//chrome/browser/process_singleton_win.cc",
|
"//chrome/browser/process_singleton_win.cc",
|
||||||
"//chrome/browser/ui/frame/window_frame_util.h",
|
|
||||||
"//chrome/browser/win/chrome_process_finder.cc",
|
"//chrome/browser/win/chrome_process_finder.cc",
|
||||||
"//chrome/browser/win/chrome_process_finder.h",
|
"//chrome/browser/win/chrome_process_finder.h",
|
||||||
"//chrome/browser/win/chrome_select_file_dialog_factory.cc",
|
"//chrome/browser/win/chrome_select_file_dialog_factory.cc",
|
||||||
"//chrome/browser/win/chrome_select_file_dialog_factory.h",
|
"//chrome/browser/win/chrome_select_file_dialog_factory.h",
|
||||||
"//chrome/browser/win/titlebar_config.cc",
|
"//chrome/browser/win/titlebar_config.cc",
|
||||||
"//chrome/browser/win/titlebar_config.h",
|
"//chrome/browser/win/titlebar_config.h",
|
||||||
"//chrome/browser/win/titlebar_config.h",
|
|
||||||
"//chrome/browser/win/util_win_service.cc",
|
"//chrome/browser/win/util_win_service.cc",
|
||||||
"//chrome/browser/win/util_win_service.h",
|
"//chrome/browser/win/util_win_service.h",
|
||||||
"//chrome/child/v8_crashpad_support_win.cc",
|
"//chrome/child/v8_crashpad_support_win.cc",
|
||||||
@@ -178,6 +178,7 @@ static_library("chrome") {
|
|||||||
public_deps = [
|
public_deps = [
|
||||||
"//chrome/browser:dev_ui_browser_resources",
|
"//chrome/browser:dev_ui_browser_resources",
|
||||||
"//chrome/browser/resources/accessibility:resources",
|
"//chrome/browser/resources/accessibility:resources",
|
||||||
|
"//chrome/browser/ui/color:color_headers",
|
||||||
"//chrome/browser/ui/color:mixers",
|
"//chrome/browser/ui/color:mixers",
|
||||||
"//chrome/common",
|
"//chrome/common",
|
||||||
"//chrome/common:version_header",
|
"//chrome/common:version_header",
|
||||||
@@ -266,11 +267,13 @@ static_library("chrome") {
|
|||||||
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.h",
|
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.h",
|
||||||
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.mm",
|
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.mm",
|
||||||
"//chrome/browser/media/webrtc/window_icon_util_mac.mm",
|
"//chrome/browser/media/webrtc/window_icon_util_mac.mm",
|
||||||
|
"//chrome/browser/permissions/system/media_authorization_wrapper_mac.h",
|
||||||
"//chrome/browser/platform_util_mac.mm",
|
"//chrome/browser/platform_util_mac.mm",
|
||||||
"//chrome/browser/process_singleton_mac.mm",
|
"//chrome/browser/process_singleton_mac.mm",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
|
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
|
||||||
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
|
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
|
||||||
]
|
]
|
||||||
|
deps += [ ":system_media_capture_permissions_mac_conflict" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable_widevine) {
|
if (enable_widevine) {
|
||||||
@@ -490,3 +493,16 @@ source_set("chrome_spellchecker") {
|
|||||||
"//components/spellcheck/renderer",
|
"//components/spellcheck/renderer",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# These sources create an object file conflict with one in |:chrome|, so they
|
||||||
|
# must live in a separate target.
|
||||||
|
# Conflicting sources:
|
||||||
|
# //chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm
|
||||||
|
# //chrome/browser/permissions/system/system_media_capture_permissions_mac.mm
|
||||||
|
source_set("system_media_capture_permissions_mac_conflict") {
|
||||||
|
sources = [
|
||||||
|
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.h",
|
||||||
|
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.mm",
|
||||||
|
]
|
||||||
|
deps = [ "//chrome/common" ]
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { shell } from 'electron/common';
|
import { shell } from 'electron/common';
|
||||||
import { app, dialog, BrowserWindow, ipcMain } from 'electron/main';
|
import { app, dialog, BrowserWindow, ipcMain } from 'electron/main';
|
||||||
|
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import * as url from 'node:url';
|
import * as url from 'node:url';
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import * as fs from 'node:fs';
|
|||||||
import { Module } from 'node:module';
|
import { Module } from 'node:module';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import * as url from 'node:url';
|
import * as url from 'node:url';
|
||||||
|
|
||||||
const { app, dialog } = electron;
|
const { app, dialog } = electron;
|
||||||
|
|
||||||
type DefaultAppOptions = {
|
type DefaultAppOptions = {
|
||||||
@@ -255,6 +256,7 @@ async function startRepl () {
|
|||||||
// start the default app.
|
// start the default app.
|
||||||
if (option.file && !option.webdriver) {
|
if (option.file && !option.webdriver) {
|
||||||
const file = option.file;
|
const file = option.file;
|
||||||
|
// eslint-disable-next-line n/no-deprecated-api
|
||||||
const protocol = url.parse(file).protocol;
|
const protocol = url.parse(file).protocol;
|
||||||
const extension = path.extname(file);
|
const extension = path.extname(file);
|
||||||
if (protocol === 'http:' || protocol === 'https:' || protocol === 'file:' || protocol === 'chrome:') {
|
if (protocol === 'http:' || protocol === 'https:' || protocol === 'file:' || protocol === 'chrome:') {
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ an issue:
|
|||||||
* [Offline/Online Detection](tutorial/online-offline-events.md)
|
* [Offline/Online Detection](tutorial/online-offline-events.md)
|
||||||
* [Represented File for macOS BrowserWindows](tutorial/represented-file.md)
|
* [Represented File for macOS BrowserWindows](tutorial/represented-file.md)
|
||||||
* [Native File Drag & Drop](tutorial/native-file-drag-drop.md)
|
* [Native File Drag & Drop](tutorial/native-file-drag-drop.md)
|
||||||
|
* [Navigation History](tutorial/navigation-history.md)
|
||||||
* [Offscreen Rendering](tutorial/offscreen-rendering.md)
|
* [Offscreen Rendering](tutorial/offscreen-rendering.md)
|
||||||
* [Dark Mode](tutorial/dark-mode.md)
|
* [Dark Mode](tutorial/dark-mode.md)
|
||||||
* [Web embeds in Electron](tutorial/web-embeds.md)
|
* [Web embeds in Electron](tutorial/web-embeds.md)
|
||||||
|
|||||||
2
docs/api/app.md
Executable file → Normal file
2
docs/api/app.md
Executable file → Normal file
@@ -416,7 +416,7 @@ Returns:
|
|||||||
* `launch-failed` - Process never successfully launched
|
* `launch-failed` - Process never successfully launched
|
||||||
* `integrity-failure` - Windows code integrity checks failed
|
* `integrity-failure` - Windows code integrity checks failed
|
||||||
* `exitCode` number - The exit code for the process
|
* `exitCode` number - The exit code for the process
|
||||||
(e.g. status from waitpid if on posix, from GetExitCodeProcess on Windows).
|
(e.g. status from waitpid if on POSIX, from GetExitCodeProcess on Windows).
|
||||||
* `serviceName` string (optional) - The non-localized name of the process.
|
* `serviceName` string (optional) - The non-localized name of the process.
|
||||||
* `name` string (optional) - The name of the process.
|
* `name` string (optional) - The name of the process.
|
||||||
Examples for utility: `Audio Service`, `Content Decryption Module Service`, `Network Service`, `Video Capture`, etc.
|
Examples for utility: `Audio Service`, `Content Decryption Module Service`, `Network Service`, `Video Capture`, etc.
|
||||||
|
|||||||
@@ -32,22 +32,28 @@ This is a requirement of `Squirrel.Mac`.
|
|||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
On Windows, you have to install your app into a user's machine before you can
|
On Windows, you have to install your app into a user's machine before you can
|
||||||
use the `autoUpdater`, so it is recommended that you use the
|
use the `autoUpdater`, so it is recommended that you use
|
||||||
[electron-winstaller][installer-lib], [Electron Forge][electron-forge-lib] or the [grunt-electron-installer][installer] package to generate a Windows installer.
|
[electron-winstaller][installer-lib] or [Electron Forge's Squirrel.Windows maker][electron-forge-lib] to generate a Windows installer.
|
||||||
|
|
||||||
When using [electron-winstaller][installer-lib] or [Electron Forge][electron-forge-lib] make sure you do not try to update your app [the first time it runs](https://github.com/electron/windows-installer#handling-squirrel-events) (Also see [this issue for more info](https://github.com/electron/electron/issues/7155)). It's also recommended to use [electron-squirrel-startup](https://github.com/mongodb-js/electron-squirrel-startup) to get desktop shortcuts for your app.
|
Apps built with Squirrel.Windows will trigger [custom launch events](https://github.com/Squirrel/Squirrel.Windows/blob/51f5e2cb01add79280a53d51e8d0cfa20f8c9f9f/docs/using/custom-squirrel-events-non-cs.md#application-startup-commands)
|
||||||
|
that must be handled by your Electron application to ensure proper setup and teardown.
|
||||||
|
|
||||||
The installer generated with Squirrel will create a shortcut icon with an
|
Squirrel.Windows apps will launch with the `--squirrel-firstrun` argument immediately
|
||||||
|
after installation. During this time, Squirrel.Windows will obtain a file lock on
|
||||||
|
your app, and `autoUpdater` requests will fail until the lock is released. In practice,
|
||||||
|
this means that you won't be able to check for updates on first launch for the first
|
||||||
|
few seconds. You can work around this by not checking for updates when `process.argv`
|
||||||
|
contains the `--squirrel-firstrun` flag or by setting a 10-second timeout on your
|
||||||
|
update checks (see [electron/electron#7155](https://github.com/electron/electron/issues/7155)
|
||||||
|
for more information).
|
||||||
|
|
||||||
|
The installer generated with Squirrel.Windows will create a shortcut icon with an
|
||||||
[Application User Model ID][app-user-model-id] in the format of
|
[Application User Model ID][app-user-model-id] in the format of
|
||||||
`com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE`, examples are
|
`com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE`, examples are
|
||||||
`com.squirrel.slack.Slack` and `com.squirrel.code.Code`. You have to use the
|
`com.squirrel.slack.Slack` and `com.squirrel.code.Code`. You have to use the
|
||||||
same ID for your app with `app.setAppUserModelId` API, otherwise Windows will
|
same ID for your app with `app.setAppUserModelId` API, otherwise Windows will
|
||||||
not be able to pin your app properly in task bar.
|
not be able to pin your app properly in task bar.
|
||||||
|
|
||||||
Like Squirrel.Mac, Windows can host updates on S3 or any other static file host.
|
|
||||||
You can read the documents of [Squirrel.Windows][squirrel-windows] to get more details
|
|
||||||
about how Squirrel.Windows works.
|
|
||||||
|
|
||||||
## Events
|
## Events
|
||||||
|
|
||||||
The `autoUpdater` object emits the following events:
|
The `autoUpdater` object emits the following events:
|
||||||
@@ -137,9 +143,7 @@ application starts.
|
|||||||
|
|
||||||
[squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac
|
[squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac
|
||||||
[server-support]: https://github.com/Squirrel/Squirrel.Mac#server-support
|
[server-support]: https://github.com/Squirrel/Squirrel.Mac#server-support
|
||||||
[squirrel-windows]: https://github.com/Squirrel/Squirrel.Windows
|
|
||||||
[installer]: https://github.com/electron-archive/grunt-electron-installer
|
|
||||||
[installer-lib]: https://github.com/electron/windows-installer
|
[installer-lib]: https://github.com/electron/windows-installer
|
||||||
[electron-forge-lib]: https://github.com/electron/forge
|
[electron-forge-lib]: https://www.electronforge.io/config/makers/squirrel.windows
|
||||||
[app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids
|
[app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids
|
||||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||||
|
|||||||
@@ -64,6 +64,31 @@ const child = new BaseWindow({ parent, modal: true })
|
|||||||
* On Linux the type of modal windows will be changed to `dialog`.
|
* On Linux the type of modal windows will be changed to `dialog`.
|
||||||
* On Linux many desktop environments do not support hiding a modal window.
|
* On Linux many desktop environments do not support hiding a modal window.
|
||||||
|
|
||||||
|
## Resource management
|
||||||
|
|
||||||
|
When you add a [`WebContentsView`](web-contents-view.md) to a `BaseWindow` and the `BaseWindow`
|
||||||
|
is closed, the [`webContents`](web-contents.md) of the `WebContentsView` are not destroyed
|
||||||
|
automatically.
|
||||||
|
|
||||||
|
It is your responsibility to close the `webContents` when you no longer need them, e.g. when
|
||||||
|
the `BaseWindow` is closed:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { BaseWindow, WebContentsView } = require('electron')
|
||||||
|
|
||||||
|
const win = new BaseWindow({ width: 800, height: 600 })
|
||||||
|
|
||||||
|
const view = new WebContentsView()
|
||||||
|
win.contentView.addChildView(view)
|
||||||
|
|
||||||
|
win.on('closed', () => {
|
||||||
|
view.webContents.close()
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
Unlike with a [`BrowserWindow`](browser-window.md), if you don't explicitly close the
|
||||||
|
`webContents`, you'll encounter memory leaks.
|
||||||
|
|
||||||
## Class: BaseWindow
|
## Class: BaseWindow
|
||||||
|
|
||||||
> Create and control windows.
|
> Create and control windows.
|
||||||
@@ -126,10 +151,18 @@ or session log off.
|
|||||||
|
|
||||||
#### Event: 'blur'
|
#### Event: 'blur'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
|
||||||
Emitted when the window loses focus.
|
Emitted when the window loses focus.
|
||||||
|
|
||||||
#### Event: 'focus'
|
#### Event: 'focus'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
|
||||||
Emitted when the window gains focus.
|
Emitted when the window gains focus.
|
||||||
|
|
||||||
#### Event: 'show'
|
#### Event: 'show'
|
||||||
@@ -479,7 +512,7 @@ Sets the content view of the window.
|
|||||||
|
|
||||||
#### `win.getContentView()`
|
#### `win.getContentView()`
|
||||||
|
|
||||||
Returns [View](view.md) - The content view of the window.
|
Returns [`View`](view.md) - The content view of the window.
|
||||||
|
|
||||||
#### `win.destroy()`
|
#### `win.destroy()`
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ following properties:
|
|||||||
[`request.followRedirect`](#requestfollowredirect) is invoked synchronously
|
[`request.followRedirect`](#requestfollowredirect) is invoked synchronously
|
||||||
during the [`redirect`](#event-redirect) event. Defaults to `follow`.
|
during the [`redirect`](#event-redirect) event. Defaults to `follow`.
|
||||||
* `origin` string (optional) - The origin URL of the request.
|
* `origin` string (optional) - The origin URL of the request.
|
||||||
* `referrerPolicy` string (optional) - can be `""`, `no-referrer`,
|
* `referrerPolicy` string (optional) - can be "", `no-referrer`,
|
||||||
`no-referrer-when-downgrade`, `origin`, `origin-when-cross-origin`,
|
`no-referrer-when-downgrade`, `origin`, `origin-when-cross-origin`,
|
||||||
`unsafe-url`, `same-origin`, `strict-origin`, or
|
`unsafe-url`, `same-origin`, `strict-origin`, or
|
||||||
`strict-origin-when-cross-origin`. Defaults to
|
`strict-origin-when-cross-origin`. Defaults to
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ Without `*` prefix the URL has to match exactly.
|
|||||||
|
|
||||||
### --disable-ntlm-v2
|
### --disable-ntlm-v2
|
||||||
|
|
||||||
Disables NTLM v2 for posix platforms, no effect elsewhere.
|
Disables NTLM v2 for POSIX platforms, no effect elsewhere.
|
||||||
|
|
||||||
### --disable-http-cache
|
### --disable-http-cache
|
||||||
|
|
||||||
@@ -306,6 +306,12 @@ Set the default value of the `verbatim` parameter in the Node.js [`dns.lookup()`
|
|||||||
|
|
||||||
The default is `verbatim` and `dns.setDefaultResultOrder()` have higher priority than `--dns-result-order`.
|
The default is `verbatim` and `dns.setDefaultResultOrder()` have higher priority than `--dns-result-order`.
|
||||||
|
|
||||||
|
### `--diagnostic-dir=directory`
|
||||||
|
|
||||||
|
Set the directory to which all Node.js diagnostic output files are written. Defaults to current working directory.
|
||||||
|
|
||||||
|
Affects the default output directory of [v8.setHeapSnapshotNearHeapLimit](https://nodejs.org/docs/latest/api/v8.html#v8setheapsnapshotnearheaplimitlimit).
|
||||||
|
|
||||||
[app]: app.md
|
[app]: app.md
|
||||||
[append-switch]: command-line.md#commandlineappendswitchswitch-value
|
[append-switch]: command-line.md#commandlineappendswitchswitch-value
|
||||||
[debugging-main-process]: ../tutorial/debugging-main-process.md
|
[debugging-main-process]: ../tutorial/debugging-main-process.md
|
||||||
|
|||||||
@@ -147,6 +147,25 @@ has been included below for completeness:
|
|||||||
|
|
||||||
If the type you care about is not in the above table, it is probably not supported.
|
If the type you care about is not in the above table, it is probably not supported.
|
||||||
|
|
||||||
|
### Exposing ipcRenderer
|
||||||
|
|
||||||
|
Attempting to send the entire `ipcRenderer` module as an object over the `contextBridge` will result in
|
||||||
|
an empty object on the receiving side of the bridge. Sending over `ipcRenderer` in full can let any
|
||||||
|
code send any message, which is a security footgun. To interact through `ipcRenderer`, provide a safe wrapper
|
||||||
|
like below:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Preload (Isolated World)
|
||||||
|
contextBridge.exposeInMainWorld('electron', {
|
||||||
|
onMyEventName: (callback) => ipcRenderer.on('MyEventName', (e, ...args) => callback(args))
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
```js @ts-nocheck
|
||||||
|
// Renderer (Main World)
|
||||||
|
window.electron.onMyEventName(data => { /* ... */ })
|
||||||
|
```
|
||||||
|
|
||||||
### Exposing Node Global Symbols
|
### Exposing Node Global Symbols
|
||||||
|
|
||||||
The `contextBridge` can be used by the preload script to give your renderer access to Node APIs.
|
The `contextBridge` can be used by the preload script to give your renderer access to Node APIs.
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ The following methods are available on instances of `Cookies`:
|
|||||||
`url`. Empty implies retrieving cookies of all URLs.
|
`url`. Empty implies retrieving cookies of all URLs.
|
||||||
* `name` string (optional) - Filters cookies by name.
|
* `name` string (optional) - Filters cookies by name.
|
||||||
* `domain` string (optional) - Retrieves cookies whose domains match or are
|
* `domain` string (optional) - Retrieves cookies whose domains match or are
|
||||||
subdomains of `domain`.
|
subdomains of `domains`.
|
||||||
* `path` string (optional) - Retrieves cookies whose path matches `path`.
|
* `path` string (optional) - Retrieves cookies whose path matches `path`.
|
||||||
* `secure` boolean (optional) - Filters cookies by their Secure property.
|
* `secure` boolean (optional) - Filters cookies by their Secure property.
|
||||||
* `session` boolean (optional) - Filters out session or persistent cookies.
|
* `session` boolean (optional) - Filters out session or persistent cookies.
|
||||||
|
|||||||
@@ -20,7 +20,11 @@ app.whenReady().then(() => {
|
|||||||
// Grant access to the first screen found.
|
// Grant access to the first screen found.
|
||||||
callback({ video: sources[0], audio: 'loopback' })
|
callback({ video: sources[0], audio: 'loopback' })
|
||||||
})
|
})
|
||||||
})
|
// If true, use the system picker if available.
|
||||||
|
// Note: this is currently experimental. If the system picker
|
||||||
|
// is available, it will be used and the media request handler
|
||||||
|
// will not be invoked.
|
||||||
|
}, { useSystemPicker: true })
|
||||||
|
|
||||||
mainWindow.loadFile('index.html')
|
mainWindow.loadFile('index.html')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ Emitted when a request has been canceled during an ongoing HTTP transaction.
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
`error` Error - Typically holds an error string identifying failure root cause.
|
* `error` Error - Typically holds an error string identifying failure root cause.
|
||||||
|
|
||||||
Emitted when an error was encountered while streaming response data events. For
|
Emitted when an error was encountered while streaming response data events. For
|
||||||
instance, if the server closes the underlying while the response is still
|
instance, if the server closes the underlying while the response is still
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ process, see [webContents.send][web-contents-send] for more information.
|
|||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
The `ipcMain` module has the following method to listen for events:
|
The `ipcMain` module has the following methods to listen for events:
|
||||||
|
|
||||||
### `ipcMain.on(channel, listener)`
|
### `ipcMain.on(channel, listener)`
|
||||||
|
|
||||||
@@ -44,6 +44,16 @@ The `ipcMain` module has the following method to listen for events:
|
|||||||
Listens to `channel`, when a new message arrives `listener` would be called with
|
Listens to `channel`, when a new message arrives `listener` would be called with
|
||||||
`listener(event, args...)`.
|
`listener(event, args...)`.
|
||||||
|
|
||||||
|
### `ipcMain.off(channel, listener)`
|
||||||
|
|
||||||
|
* `channel` string
|
||||||
|
* `listener` Function
|
||||||
|
* `event` [IpcMainEvent][ipc-main-event]
|
||||||
|
* `...args` any[]
|
||||||
|
|
||||||
|
Removes the specified `listener` from the listener array for the specified
|
||||||
|
`channel`.
|
||||||
|
|
||||||
### `ipcMain.once(channel, listener)`
|
### `ipcMain.once(channel, listener)`
|
||||||
|
|
||||||
* `channel` string
|
* `channel` string
|
||||||
@@ -54,20 +64,28 @@ Listens to `channel`, when a new message arrives `listener` would be called with
|
|||||||
Adds a one time `listener` function for the event. This `listener` is invoked
|
Adds a one time `listener` function for the event. This `listener` is invoked
|
||||||
only the next time a message is sent to `channel`, after which it is removed.
|
only the next time a message is sent to `channel`, after which it is removed.
|
||||||
|
|
||||||
|
### `ipcMain.addListener(channel, listener)`
|
||||||
|
|
||||||
|
* `channel` string
|
||||||
|
* `listener` Function
|
||||||
|
* `event` [IpcMainEvent][ipc-main-event]
|
||||||
|
* `...args` any[]
|
||||||
|
|
||||||
|
Alias for [`ipcMain.on`](#ipcmainonchannel-listener).
|
||||||
|
|
||||||
### `ipcMain.removeListener(channel, listener)`
|
### `ipcMain.removeListener(channel, listener)`
|
||||||
|
|
||||||
* `channel` string
|
* `channel` string
|
||||||
* `listener` Function
|
* `listener` Function
|
||||||
* `...args` any[]
|
* `...args` any[]
|
||||||
|
|
||||||
Removes the specified `listener` from the listener array for the specified
|
Alias for [`ipcMain.off`](#ipcmainoffchannel-listener).
|
||||||
`channel`.
|
|
||||||
|
|
||||||
### `ipcMain.removeAllListeners([channel])`
|
### `ipcMain.removeAllListeners([channel])`
|
||||||
|
|
||||||
* `channel` string (optional)
|
* `channel` string (optional)
|
||||||
|
|
||||||
Removes listeners of the specified `channel`.
|
Removes all listeners from the specified `channel`. Removes all listeners from all channels if no channel is specified.
|
||||||
|
|
||||||
### `ipcMain.handle(channel, listener)`
|
### `ipcMain.handle(channel, listener)`
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ Listens to `channel`, when a new message arrives `listener` would be called with
|
|||||||
* `event` [IpcRendererEvent][ipc-renderer-event]
|
* `event` [IpcRendererEvent][ipc-renderer-event]
|
||||||
* `...args` any[]
|
* `...args` any[]
|
||||||
|
|
||||||
Alias for [`ipcRenderer.removeListener`](#ipcrendererremovelistenerchannel-listener).
|
Removes the specified `listener` from the listener array for the specified
|
||||||
|
`channel`.
|
||||||
|
|
||||||
### `ipcRenderer.once(channel, listener)`
|
### `ipcRenderer.once(channel, listener)`
|
||||||
|
|
||||||
@@ -76,14 +77,13 @@ Alias for [`ipcRenderer.on`](#ipcrendereronchannel-listener).
|
|||||||
* `event` [IpcRendererEvent][ipc-renderer-event]
|
* `event` [IpcRendererEvent][ipc-renderer-event]
|
||||||
* `...args` any[]
|
* `...args` any[]
|
||||||
|
|
||||||
Removes the specified `listener` from the listener array for the specified
|
Alias for [`ipcRenderer.off`](#ipcrendereroffchannel-listener).
|
||||||
`channel`.
|
|
||||||
|
|
||||||
### `ipcRenderer.removeAllListeners(channel)`
|
### `ipcRenderer.removeAllListeners([channel])`
|
||||||
|
|
||||||
* `channel` string
|
* `channel` string (optional)
|
||||||
|
|
||||||
Removes all listeners, or those of the specified `channel`.
|
Removes all listeners from the specified `channel`. Removes all listeners from all channels if no channel is specified.
|
||||||
|
|
||||||
### `ipcRenderer.send(channel, ...args)`
|
### `ipcRenderer.send(channel, ...args)`
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ See [`Menu`](menu.md) for examples.
|
|||||||
|
|
||||||
* `options` Object
|
* `options` Object
|
||||||
* `click` Function (optional) - Will be called with
|
* `click` Function (optional) - Will be called with
|
||||||
`click(menuItem, browserWindow, event)` when the menu item is clicked.
|
`click(menuItem, window, event)` when the menu item is clicked.
|
||||||
* `menuItem` MenuItem
|
* `menuItem` MenuItem
|
||||||
* `browserWindow` [BrowserWindow](browser-window.md) | undefined - This will not be defined if no window is open.
|
* `window` [BaseWindow](base-window.md) | undefined - This will not be defined if no window is open.
|
||||||
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
||||||
* `role` string (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`, `toggleTextReplacement`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `showAllTabs`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
|
* `role` string (optional) - Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`, `toggleTextReplacement`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `showAllTabs`, `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when specified the
|
||||||
`click` property will be ignored. See [roles](#roles).
|
`click` property will be ignored. See [roles](#roles).
|
||||||
@@ -146,7 +146,7 @@ A `Function` that is fired when the MenuItem receives a click event.
|
|||||||
It can be called with `menuItem.click(event, focusedWindow, focusedWebContents)`.
|
It can be called with `menuItem.click(event, focusedWindow, focusedWebContents)`.
|
||||||
|
|
||||||
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
* `event` [KeyboardEvent](structures/keyboard-event.md)
|
||||||
* `focusedWindow` [BrowserWindow](browser-window.md)
|
* `focusedWindow` [BaseWindow](browser-window.md)
|
||||||
* `focusedWebContents` [WebContents](web-contents.md)
|
* `focusedWebContents` [WebContents](web-contents.md)
|
||||||
|
|
||||||
#### `menuItem.submenu`
|
#### `menuItem.submenu`
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ The `menu` object has the following instance methods:
|
|||||||
#### `menu.popup([options])`
|
#### `menu.popup([options])`
|
||||||
|
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `window` [BrowserWindow](browser-window.md) (optional) - Default is the focused window.
|
* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
|
||||||
* `x` number (optional) - Default is the current mouse cursor position.
|
* `x` number (optional) - Default is the current mouse cursor position.
|
||||||
Must be declared if `y` is declared.
|
Must be declared if `y` is declared.
|
||||||
* `y` number (optional) - Default is the current mouse cursor position.
|
* `y` number (optional) - Default is the current mouse cursor position.
|
||||||
@@ -86,13 +86,13 @@ The `menu` object has the following instance methods:
|
|||||||
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`.
|
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`.
|
||||||
* `callback` Function (optional) - Called when menu is closed.
|
* `callback` Function (optional) - Called when menu is closed.
|
||||||
|
|
||||||
Pops up this menu as a context menu in the [`BrowserWindow`](browser-window.md).
|
Pops up this menu as a context menu in the [`BaseWindow`](base-window.md).
|
||||||
|
|
||||||
#### `menu.closePopup([browserWindow])`
|
#### `menu.closePopup([window])`
|
||||||
|
|
||||||
* `browserWindow` [BrowserWindow](browser-window.md) (optional) - Default is the focused window.
|
* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
|
||||||
|
|
||||||
Closes the context menu in the `browserWindow`.
|
Closes the context menu in the `window`.
|
||||||
|
|
||||||
#### `menu.append(menuItem)`
|
#### `menu.append(menuItem)`
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ Returns `boolean` - Whether or not desktop notifications are supported on the cu
|
|||||||
* `subtitle` string (optional) _macOS_ - A subtitle for the notification, which will be displayed below the title.
|
* `subtitle` string (optional) _macOS_ - A subtitle for the notification, which will be displayed below the title.
|
||||||
* `body` string (optional) - The body text of the notification, which will be displayed below the title or subtitle.
|
* `body` string (optional) - The body text of the notification, which will be displayed below the title or subtitle.
|
||||||
* `silent` boolean (optional) - Whether or not to suppress the OS notification noise when showing the notification.
|
* `silent` boolean (optional) - Whether or not to suppress the OS notification noise when showing the notification.
|
||||||
* `icon` (string | [NativeImage](native-image.md)) (optional) - An icon to use in the notification.
|
* `icon` (string | [NativeImage](native-image.md)) (optional) - An icon to use in the notification. If a string is passed, it must be a valid path to a local icon file.
|
||||||
* `hasReply` boolean (optional) _macOS_ - Whether or not to add an inline reply option to the notification.
|
* `hasReply` boolean (optional) _macOS_ - Whether or not to add an inline reply option to the notification.
|
||||||
* `timeoutType` string (optional) _Linux_ _Windows_ - The timeout duration of the notification. Can be 'default' or 'never'.
|
* `timeoutType` string (optional) _Linux_ _Windows_ - The timeout duration of the notification. Can be 'default' or 'never'.
|
||||||
* `replyPlaceholder` string (optional) _macOS_ - The placeholder to write in the inline reply input field.
|
* `replyPlaceholder` string (optional) _macOS_ - The placeholder to write in the inline reply input field.
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ Emitted when system changes to battery power.
|
|||||||
|
|
||||||
### Event: 'thermal-state-change' _macOS_
|
### Event: 'thermal-state-change' _macOS_
|
||||||
|
|
||||||
* `state` string - The system's new thermal state. Can be `unknown`, `nominal`, `fair`, `serious`, `critical`.
|
Returns:
|
||||||
|
|
||||||
|
* `details` Event\<\>
|
||||||
|
* `state` string - The system's new thermal state. Can be `unknown`, `nominal`, `fair`, `serious`, `critical`.
|
||||||
|
|
||||||
Emitted when the thermal state of the system changes. Notification of a change
|
Emitted when the thermal state of the system changes. Notification of a change
|
||||||
in the thermal status of the system, such as entering a critical temperature
|
in the thermal status of the system, such as entering a critical temperature
|
||||||
@@ -42,7 +45,8 @@ See https://developer.apple.com/library/archive/documentation/Performance/Concep
|
|||||||
|
|
||||||
### Event: 'speed-limit-change' _macOS_ _Windows_
|
### Event: 'speed-limit-change' _macOS_ _Windows_
|
||||||
|
|
||||||
* `limit` number - The operating system's advertised speed limit for CPUs, in percent.
|
* `details` Event\<\>
|
||||||
|
* `limit` number - The operating system's advertised speed limit for CPUs, in percent.
|
||||||
|
|
||||||
Notification of a change in the operating system's advertised speed limit for
|
Notification of a change in the operating system's advertised speed limit for
|
||||||
CPUs, in percent. Values below 100 indicate that the system is impairing
|
CPUs, in percent. Values below 100 indicate that the system is impairing
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ The `session` module has the following methods:
|
|||||||
|
|
||||||
* `partition` string
|
* `partition` string
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `cache` boolean - Whether to enable cache.
|
* `cache` boolean - Whether to enable cache. Default is `true` unless the
|
||||||
|
[`--disable-http-cache` switch](command-line-switches.md#--disable-http-cache) is used.
|
||||||
|
|
||||||
Returns `Session` - A session instance from `partition` string. When there is an existing
|
Returns `Session` - A session instance from `partition` string. When there is an existing
|
||||||
`Session` with the same `partition`, it will be returned; otherwise a new
|
`Session` with the same `partition`, it will be returned; otherwise a new
|
||||||
@@ -46,7 +47,8 @@ of an existing `Session` object.
|
|||||||
|
|
||||||
* `path` string
|
* `path` string
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `cache` boolean - Whether to enable cache.
|
* `cache` boolean - Whether to enable cache. Default is `true` unless the
|
||||||
|
[`--disable-http-cache` switch](command-line-switches.md#--disable-http-cache) is used.
|
||||||
|
|
||||||
Returns `Session` - A session instance from the absolute path as specified by the `path`
|
Returns `Session` - A session instance from the absolute path as specified by the `path`
|
||||||
string. When there is an existing `Session` with the same absolute path, it
|
string. When there is an existing `Session` with the same absolute path, it
|
||||||
@@ -268,7 +270,8 @@ Returns:
|
|||||||
* `event` Event
|
* `event` Event
|
||||||
* `details` Object
|
* `details` Object
|
||||||
* `deviceList` [HIDDevice[]](structures/hid-device.md)
|
* `deviceList` [HIDDevice[]](structures/hid-device.md)
|
||||||
* `frame` [WebFrameMain](web-frame-main.md)
|
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `deviceId` string | null (optional)
|
* `deviceId` string | null (optional)
|
||||||
|
|
||||||
@@ -332,7 +335,8 @@ Returns:
|
|||||||
* `event` Event
|
* `event` Event
|
||||||
* `details` Object
|
* `details` Object
|
||||||
* `device` [HIDDevice](structures/hid-device.md)
|
* `device` [HIDDevice](structures/hid-device.md)
|
||||||
* `frame` [WebFrameMain](web-frame-main.md)
|
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
|
|
||||||
Emitted after `navigator.hid.requestDevice` has been called and
|
Emitted after `navigator.hid.requestDevice` has been called and
|
||||||
`select-hid-device` has fired if a new device becomes available before
|
`select-hid-device` has fired if a new device becomes available before
|
||||||
@@ -347,7 +351,8 @@ Returns:
|
|||||||
* `event` Event
|
* `event` Event
|
||||||
* `details` Object
|
* `details` Object
|
||||||
* `device` [HIDDevice](structures/hid-device.md)
|
* `device` [HIDDevice](structures/hid-device.md)
|
||||||
* `frame` [WebFrameMain](web-frame-main.md)
|
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
|
|
||||||
Emitted after `navigator.hid.requestDevice` has been called and
|
Emitted after `navigator.hid.requestDevice` has been called and
|
||||||
`select-hid-device` has fired if a device has been removed before the callback
|
`select-hid-device` has fired if a device has been removed before the callback
|
||||||
@@ -473,7 +478,8 @@ Returns:
|
|||||||
* `event` Event
|
* `event` Event
|
||||||
* `details` Object
|
* `details` Object
|
||||||
* `port` [SerialPort](structures/serial-port.md)
|
* `port` [SerialPort](structures/serial-port.md)
|
||||||
* `frame` [WebFrameMain](web-frame-main.md)
|
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `origin` string - The origin that the device has been revoked from.
|
* `origin` string - The origin that the device has been revoked from.
|
||||||
|
|
||||||
Emitted after `SerialPort.forget()` has been called. This event can be used
|
Emitted after `SerialPort.forget()` has been called. This event can be used
|
||||||
@@ -495,7 +501,7 @@ app.whenReady().then(() => {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js @ts-nocheck
|
||||||
// Renderer Process
|
// Renderer Process
|
||||||
|
|
||||||
const portConnect = async () => {
|
const portConnect = async () => {
|
||||||
@@ -517,7 +523,8 @@ Returns:
|
|||||||
* `event` Event
|
* `event` Event
|
||||||
* `details` Object
|
* `details` Object
|
||||||
* `deviceList` [USBDevice[]](structures/usb-device.md)
|
* `deviceList` [USBDevice[]](structures/usb-device.md)
|
||||||
* `frame` [WebFrameMain](web-frame-main.md)
|
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this event.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `deviceId` string (optional)
|
* `deviceId` string (optional)
|
||||||
|
|
||||||
@@ -926,6 +933,7 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents
|
|||||||
* `storage-access` - Allows content loaded in a third-party context to request access to third-party cookies using the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API).
|
* `storage-access` - Allows content loaded in a third-party context to request access to third-party cookies using the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API).
|
||||||
* `top-level-storage-access` - Allow top-level sites to request third-party cookie access on behalf of embedded content originating from another site in the same related website set using the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API).
|
* `top-level-storage-access` - Allow top-level sites to request third-party cookie access on behalf of embedded content originating from another site in the same related website set using the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API).
|
||||||
* `usb` - Expose non-standard Universal Serial Bus (USB) compatible devices services to the web with the [WebUSB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API).
|
* `usb` - Expose non-standard Universal Serial Bus (USB) compatible devices services to the web with the [WebUSB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API).
|
||||||
|
* `deprecated-sync-clipboard-read` _Deprecated_ - Request access to run `document.execCommand("paste")`
|
||||||
* `requestingOrigin` string - The origin URL of the permission check
|
* `requestingOrigin` string - The origin URL of the permission check
|
||||||
* `details` Object - Some properties are only available on certain permission types.
|
* `details` Object - Some properties are only available on certain permission types.
|
||||||
* `embeddingOrigin` string (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
|
* `embeddingOrigin` string (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks.
|
||||||
@@ -953,11 +961,12 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `ses.setDisplayMediaRequestHandler(handler)`
|
#### `ses.setDisplayMediaRequestHandler(handler[, opts])`
|
||||||
|
|
||||||
* `handler` Function | null
|
* `handler` Function | null
|
||||||
* `request` Object
|
* `request` Object
|
||||||
* `frame` [WebFrameMain](web-frame-main.md) - Frame that is requesting access to media.
|
* `frame` [WebFrameMain](web-frame-main.md) | null - Frame that is requesting access to media.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `securityOrigin` String - Origin of the page making the request.
|
* `securityOrigin` String - Origin of the page making the request.
|
||||||
* `videoRequested` Boolean - true if the web content requested a video stream.
|
* `videoRequested` Boolean - true if the web content requested a video stream.
|
||||||
* `audioRequested` Boolean - true if the web content requested an audio stream.
|
* `audioRequested` Boolean - true if the web content requested an audio stream.
|
||||||
@@ -980,12 +989,18 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
|
|||||||
and this is set to `true`, then local playback of audio will not be muted (e.g. using `MediaRecorder`
|
and this is set to `true`, then local playback of audio will not be muted (e.g. using `MediaRecorder`
|
||||||
to record `WebFrameMain` with this flag set to `true` will allow audio to pass through to the speakers
|
to record `WebFrameMain` with this flag set to `true` will allow audio to pass through to the speakers
|
||||||
while recording). Default is `false`.
|
while recording). Default is `false`.
|
||||||
|
* `opts` Object (optional) _macOS_ _Experimental_
|
||||||
|
* `useSystemPicker` Boolean - true if the available native system picker should be used. Default is `false`. _macOS_ _Experimental_
|
||||||
|
|
||||||
This handler will be called when web content requests access to display media
|
This handler will be called when web content requests access to display media
|
||||||
via the `navigator.mediaDevices.getDisplayMedia` API. Use the
|
via the `navigator.mediaDevices.getDisplayMedia` API. Use the
|
||||||
[desktopCapturer](desktop-capturer.md) API to choose which stream(s) to grant
|
[desktopCapturer](desktop-capturer.md) API to choose which stream(s) to grant
|
||||||
access to.
|
access to.
|
||||||
|
|
||||||
|
`useSystemPicker` allows an application to use the system picker instead of providing a specific video source from `getSources`.
|
||||||
|
This option is experimental, and currently available for MacOS 15+ only. If the system picker is available and `useSystemPicker`
|
||||||
|
is set to `true`, the handler will not be invoked.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const { session, desktopCapturer } = require('electron')
|
const { session, desktopCapturer } = require('electron')
|
||||||
|
|
||||||
@@ -994,7 +1009,11 @@ session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
|
|||||||
// Grant access to the first screen found.
|
// Grant access to the first screen found.
|
||||||
callback({ video: sources[0] })
|
callback({ video: sources[0] })
|
||||||
})
|
})
|
||||||
})
|
// Use the system picker if available.
|
||||||
|
// Note: this is currently experimental. If the system picker
|
||||||
|
// is available, it will be used and the media request handler
|
||||||
|
// will not be invoked.
|
||||||
|
}, { useSystemPicker: true })
|
||||||
```
|
```
|
||||||
|
|
||||||
Passing a [WebFrameMain](web-frame-main.md) object as a video or audio stream
|
Passing a [WebFrameMain](web-frame-main.md) object as a video or audio stream
|
||||||
@@ -1148,7 +1167,8 @@ app.whenReady().then(() => {
|
|||||||
pin displayed on the device.
|
pin displayed on the device.
|
||||||
* `providePin`
|
* `providePin`
|
||||||
This prompt is requesting that a pin be provided for the device.
|
This prompt is requesting that a pin be provided for the device.
|
||||||
* `frame` [WebFrameMain](web-frame-main.md)
|
* `frame` [WebFrameMain](web-frame-main.md) | null - The frame initiating this handler.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `pin` string (optional) - The pin value to verify if `pairingKind` is `confirmPin`.
|
* `pin` string (optional) - The pin value to verify if `pairingKind` is `confirmPin`.
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `response` Object
|
* `response` Object
|
||||||
@@ -1341,6 +1361,36 @@ specified when registering the protocol.
|
|||||||
|
|
||||||
Returns `Promise<void>` - resolves when the code cache clear operation is complete.
|
Returns `Promise<void>` - resolves when the code cache clear operation is complete.
|
||||||
|
|
||||||
|
#### `ses.getSharedDictionaryUsageInfo()`
|
||||||
|
|
||||||
|
Returns `Promise<SharedDictionaryUsageInfo[]>` - an array of shared dictionary information entries in Chromium's networking service's storage.
|
||||||
|
|
||||||
|
Shared dictionaries are used to power advanced compression of data sent over the wire, specifically with Brotli and ZStandard. You don't need to call any of the shared dictionary APIs in Electron to make use of this advanced web feature, but if you do, they allow deeper control and inspection of the shared dictionaries used during decompression.
|
||||||
|
|
||||||
|
To get detailed information about a specific shared dictionary entry, call `getSharedDictionaryInfo(options)`.
|
||||||
|
|
||||||
|
#### `ses.getSharedDictionaryInfo(options)`
|
||||||
|
|
||||||
|
* `options` Object
|
||||||
|
* `frameOrigin` string - The origin of the frame where the request originates. It’s specific to the individual frame making the request and is defined by its scheme, host, and port. In practice, will look like a URL.
|
||||||
|
* `topFrameSite` string - The site of the top-level browsing context (the main frame or tab that contains the request). It’s less granular than `frameOrigin` and focuses on the broader "site" scope. In practice, will look like a URL.
|
||||||
|
|
||||||
|
Returns `Promise<SharedDictionaryInfo[]>` - an array of shared dictionary information entries in Chromium's networking service's storage.
|
||||||
|
|
||||||
|
To get information about all present shared dictionaries, call `getSharedDictionaryUsageInfo()`.
|
||||||
|
|
||||||
|
#### `ses.clearSharedDictionaryCache()`
|
||||||
|
|
||||||
|
Returns `Promise<void>` - resolves when the dictionary cache has been cleared, both in memory and on disk.
|
||||||
|
|
||||||
|
#### `ses.clearSharedDictionaryCacheForIsolationKey(options)`
|
||||||
|
|
||||||
|
* `options` Object
|
||||||
|
* `frameOrigin` string - The origin of the frame where the request originates. It’s specific to the individual frame making the request and is defined by its scheme, host, and port. In practice, will look like a URL.
|
||||||
|
* `topFrameSite` string - The site of the top-level browsing context (the main frame or tab that contains the request). It’s less granular than `frameOrigin` and focuses on the broader "site" scope. In practice, will look like a URL.
|
||||||
|
|
||||||
|
Returns `Promise<void>` - resolves when the dictionary cache has been cleared for the specified isolation key, both in memory and on disk.
|
||||||
|
|
||||||
#### `ses.setSpellCheckerEnabled(enable)`
|
#### `ses.setSpellCheckerEnabled(enable)`
|
||||||
|
|
||||||
* `enable` boolean
|
* `enable` boolean
|
||||||
@@ -1490,9 +1540,11 @@ session is persisted on disk. For in memory sessions this returns `null`.
|
|||||||
#### `ses.clearData([options])`
|
#### `ses.clearData([options])`
|
||||||
|
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `dataTypes` String[] (optional) - The types of data to clear. By default, this will clear all types of data.
|
* `dataTypes` String[] (optional) - The types of data to clear. By default, this will clear all types of data. This
|
||||||
|
can potentially include data types not explicitly listed here. (See Chromium's
|
||||||
|
[`BrowsingDataRemover`][browsing-data-remover] for the full list.)
|
||||||
* `backgroundFetch` - Background Fetch
|
* `backgroundFetch` - Background Fetch
|
||||||
* `cache` - Cache
|
* `cache` - Cache (includes `cachestorage` and `shadercache`)
|
||||||
* `cookies` - Cookies
|
* `cookies` - Cookies
|
||||||
* `downloads` - Downloads
|
* `downloads` - Downloads
|
||||||
* `fileSystems` - File Systems
|
* `fileSystems` - File Systems
|
||||||
@@ -1511,12 +1563,14 @@ Returns `Promise<void>` - resolves when all data has been cleared.
|
|||||||
|
|
||||||
Clears various different types of data.
|
Clears various different types of data.
|
||||||
|
|
||||||
This method clears more types of data and is more thourough than the
|
This method clears more types of data and is more thorough than the
|
||||||
`clearStorageData` method.
|
`clearStorageData` method.
|
||||||
|
|
||||||
**Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
|
**Note:** Cookies are stored at a broader scope than origins. When removing cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be removed at the [registrable domain](https://url.spec.whatwg.org/#host-registrable-domain) level. For example, clearing cookies for the origin `https://really.specific.origin.example.com/` will end up clearing all cookies for `example.com`. Clearing cookies for the origin `https://my.website.example.co.uk/` will end up clearing all cookies for `example.co.uk`.
|
||||||
|
|
||||||
For more information, refer to Chromium's [`BrowsingDataRemover` interface](https://source.chromium.org/chromium/chromium/src/+/main:content/public/browser/browsing_data_remover.h).
|
**Note:** Clearing cache data will also clear the shared dictionary cache. This means that any dictionaries used for compression may be reloaded after clearing the cache. If you wish to clear the shared dictionary cache but leave other cached data intact, you may want to use the `clearSharedDictionaryCache` method.
|
||||||
|
|
||||||
|
For more information, refer to Chromium's [`BrowsingDataRemover` interface][browsing-data-remover].
|
||||||
|
|
||||||
### Instance Properties
|
### Instance Properties
|
||||||
|
|
||||||
@@ -1582,3 +1636,5 @@ app.whenReady().then(async () => {
|
|||||||
console.log('Net-logs written to', path)
|
console.log('Net-logs written to', path)
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[browsing-data-remover]: https://source.chromium.org/chromium/chromium/src/+/main:content/public/browser/browsing_data_remover.h
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ Open the given file in the desktop's default manner.
|
|||||||
|
|
||||||
### `shell.openExternal(url[, options])`
|
### `shell.openExternal(url[, options])`
|
||||||
|
|
||||||
* `url` string - Max 2081 characters on windows.
|
* `url` string - Max 2081 characters on Windows.
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `activate` boolean (optional) _macOS_ - `true` to bring the opened application to the foreground. The default is `true`.
|
* `activate` boolean (optional) _macOS_ - `true` to bring the opened application to the foreground. The default is `true`.
|
||||||
* `workingDirectory` string (optional) _Windows_ - The working directory.
|
* `workingDirectory` string (optional) _Windows_ - The working directory.
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
* `show` boolean (optional) - Whether window should be shown when created. Default is
|
* `show` boolean (optional) - Whether window should be shown when created. Default is
|
||||||
`true`.
|
`true`.
|
||||||
* `frame` boolean (optional) - Specify `false` to create a
|
* `frame` boolean (optional) - Specify `false` to create a
|
||||||
[frameless window](../../tutorial/window-customization.md#create-frameless-windows). Default is `true`.
|
[frameless window](../../tutorial/custom-window-styles.md#frameless-windows). Default is `true`.
|
||||||
* `parent` BaseWindow (optional) - Specify parent window. Default is `null`.
|
* `parent` BaseWindow (optional) - Specify parent window. Default is `null`.
|
||||||
* `modal` boolean (optional) - Whether this is a modal window. This only works when the
|
* `modal` boolean (optional) - Whether this is a modal window. This only works when the
|
||||||
window is a child window. Default is `false`.
|
window is a child window. Default is `false`.
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
is only implemented on Windows and macOS.
|
is only implemented on Windows and macOS.
|
||||||
* `darkTheme` boolean (optional) - Forces using dark theme for the window, only works on
|
* `darkTheme` boolean (optional) - Forces using dark theme for the window, only works on
|
||||||
some GTK+3 desktop environments. Default is `false`.
|
some GTK+3 desktop environments. Default is `false`.
|
||||||
* `transparent` boolean (optional) - Makes the window [transparent](../../tutorial/window-customization.md#create-transparent-windows).
|
* `transparent` boolean (optional) - Makes the window [transparent](../../tutorial/custom-window-styles.md#transparent-windows).
|
||||||
Default is `false`. On Windows, does not work unless the window is frameless.
|
Default is `false`. On Windows, does not work unless the window is frameless.
|
||||||
* `type` string (optional) - The type of window, default is normal window. See more about
|
* `type` string (optional) - The type of window, default is normal window. See more about
|
||||||
this below.
|
this below.
|
||||||
@@ -91,6 +91,10 @@
|
|||||||
title bar and a full size content window, the traffic light buttons will
|
title bar and a full size content window, the traffic light buttons will
|
||||||
display when being hovered over in the top left of the window.
|
display when being hovered over in the top left of the window.
|
||||||
**Note:** This option is currently experimental.
|
**Note:** This option is currently experimental.
|
||||||
|
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
|
||||||
|
* `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
|
||||||
|
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
|
||||||
|
* `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
|
||||||
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
|
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
|
||||||
Set a custom position for the traffic light buttons in frameless windows.
|
Set a custom position for the traffic light buttons in frameless windows.
|
||||||
* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window
|
* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window
|
||||||
@@ -149,3 +153,6 @@ Possible values are:
|
|||||||
reserved for NSPanel, at runtime. Also, the window will appear on all
|
reserved for NSPanel, at runtime. Also, the window will appear on all
|
||||||
spaces (desktops).
|
spaces (desktops).
|
||||||
* On Windows, possible type is `toolbar`.
|
* On Windows, possible type is `toolbar`.
|
||||||
|
|
||||||
|
[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables
|
||||||
|
[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis
|
||||||
|
|||||||
@@ -2,10 +2,3 @@
|
|||||||
|
|
||||||
* `webPreferences` [WebPreferences](web-preferences.md?inline) (optional) - Settings of web page's features.
|
* `webPreferences` [WebPreferences](web-preferences.md?inline) (optional) - Settings of web page's features.
|
||||||
* `paintWhenInitiallyHidden` boolean (optional) - Whether the renderer should be active when `show` is `false` and it has just been created. In order for `document.visibilityState` to work correctly on first load with `show: false` you should set this to `false`. Setting this to `false` will cause the `ready-to-show` event to not fire. Default is `true`.
|
* `paintWhenInitiallyHidden` boolean (optional) - Whether the renderer should be active when `show` is `false` and it has just been created. In order for `document.visibilityState` to work correctly on first load with `show: false` you should set this to `false`. Setting this to `false` will cause the `ready-to-show` event to not fire. Default is `true`.
|
||||||
* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`.
|
|
||||||
* `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color.
|
|
||||||
* `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.
|
|
||||||
* `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
|
|
||||||
|
|
||||||
[overlay-css-env-vars]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables
|
|
||||||
[overlay-javascript-apis]: https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* `frameId` Integer - The ID of the renderer frame that sent this message
|
* `frameId` Integer - The ID of the renderer frame that sent this message
|
||||||
* `returnValue` any - Set this to the value to be returned in a synchronous message
|
* `returnValue` any - Set this to the value to be returned in a synchronous message
|
||||||
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
|
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
|
||||||
* `senderFrame` [WebFrameMain](../web-frame-main.md) _Readonly_ - The frame that sent this message
|
* `senderFrame` [WebFrameMain](../web-frame-main.md) | null _Readonly_ - The frame that sent this message. May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `ports` [MessagePortMain](../message-port-main.md)[] - A list of MessagePorts that were transferred with this message
|
* `ports` [MessagePortMain](../message-port-main.md)[] - A list of MessagePorts that were transferred with this message
|
||||||
* `reply` Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling. You should use this method to "reply" to the sent message in order to guarantee the reply will go to the correct process and frame.
|
* `reply` Function - A function that will send an IPC message to the renderer frame that sent the original message that you are currently handling. You should use this method to "reply" to the sent message in order to guarantee the reply will go to the correct process and frame.
|
||||||
* `channel` string
|
* `channel` string
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
* `processId` Integer - The internal ID of the renderer process that sent this message
|
* `processId` Integer - The internal ID of the renderer process that sent this message
|
||||||
* `frameId` Integer - The ID of the renderer frame that sent this message
|
* `frameId` Integer - The ID of the renderer frame that sent this message
|
||||||
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
|
* `sender` [WebContents](../web-contents.md) - Returns the `webContents` that sent the message
|
||||||
* `senderFrame` [WebFrameMain](../web-frame-main.md) _Readonly_ - The frame that sent this message
|
* `senderFrame` [WebFrameMain](../web-frame-main.md) | null _Readonly_ - The frame that sent this message. May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
|
|||||||
24
docs/api/structures/offscreen-shared-texture.md
Normal file
24
docs/api/structures/offscreen-shared-texture.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# OffscreenSharedTexture Object
|
||||||
|
|
||||||
|
* `textureInfo` Object - The shared texture info.
|
||||||
|
* `widgetType` string - The widget type of the texture. Can be `popup` or `frame`.
|
||||||
|
* `pixelFormat` string - The pixel format of the texture. Can be `rgba` or `bgra`.
|
||||||
|
* `codedSize` [Size](size.md) - The full dimensions of the video frame.
|
||||||
|
* `visibleRect` [Rectangle](rectangle.md) - A subsection of [0, 0, codedSize.width(), codedSize.height()]. In OSR case, it is expected to have the full section area.
|
||||||
|
* `contentRect` [Rectangle](rectangle.md) - The region of the video frame that capturer would like to populate. In OSR case, it is the same with `dirtyRect` that needs to be painted.
|
||||||
|
* `timestamp` number - The time in microseconds since the capture start.
|
||||||
|
* `metadata` Object - Extra metadata. See comments in src\media\base\video_frame_metadata.h for accurate details.
|
||||||
|
* `captureUpdateRect` [Rectangle](rectangle.md) (optional) - Updated area of frame, can be considered as the `dirty` area.
|
||||||
|
* `regionCaptureRect` [Rectangle](rectangle.md) (optional) - May reflect the frame's contents origin if region capture is used internally.
|
||||||
|
* `sourceSize` [Rectangle](rectangle.md) (optional) - Full size of the source frame.
|
||||||
|
* `frameCount` number (optional) - The increasing count of captured frame. May contain gaps if frames are dropped between two consecutively received frames.
|
||||||
|
* `sharedTextureHandle` Buffer _Windows_ _macOS_ - The handle to the shared texture.
|
||||||
|
* `planes` Object[] _Linux_ - Each plane's info of the shared texture.
|
||||||
|
* `stride` number - The strides and offsets in bytes to be used when accessing the buffers via a memory mapping. One per plane per entry.
|
||||||
|
* `offset` number - The strides and offsets in bytes to be used when accessing the buffers via a memory mapping. One per plane per entry.
|
||||||
|
* `size` number - Size in bytes of the plane. This is necessary to map the buffers.
|
||||||
|
* `fd` number - File descriptor for the underlying memory object (usually dmabuf).
|
||||||
|
* `modifier` string _Linux_ - The modifier is retrieved from GBM library and passed to EGL driver.
|
||||||
|
* `release` Function - Release the resources. The `texture` cannot be directly passed to another process, users need to maintain texture lifecycles in
|
||||||
|
main process, but it is safe to pass the `textureInfo` to another process. Only a limited number of textures can exist at the same time, so it's important
|
||||||
|
that you call `texture.release()` as soon as you're done with the texture.
|
||||||
12
docs/api/structures/shared-dictionary-info.md
Normal file
12
docs/api/structures/shared-dictionary-info.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# SharedDictionaryInfo Object
|
||||||
|
|
||||||
|
* `match` string - The matching path pattern for the dictionary which was declared in 'use-as-dictionary' response header's `match` option.
|
||||||
|
* `matchDestinations` string[] - An array of matching destinations for the dictionary which was declared in 'use-as-dictionary' response header's `match-dest` option.
|
||||||
|
* `id` string - The Id for the dictionary which was declared in 'use-as-dictionary' response header's `id` option.
|
||||||
|
* `dictionaryUrl` string - URL of the dictionary.
|
||||||
|
* `lastFetchTime` Date - The time of when the dictionary was received from the network layer.
|
||||||
|
* `responseTime` Date - The time of when the dictionary was received from the server. For cached responses, this time could be "far" in the past.
|
||||||
|
* `expirationDuration` number - The expiration time for the dictionary which was declared in 'use-as-dictionary' response header's `expires` option in seconds.
|
||||||
|
* `lastUsedTime` Date - The time when the dictionary was last used.
|
||||||
|
* `size` number - The amount of bytes stored for this shared dictionary information object in Chromium's internal storage (usually Sqlite).
|
||||||
|
* `hash` string - The sha256 hash of the dictionary binary.
|
||||||
5
docs/api/structures/shared-dictionary-usage-info.md
Normal file
5
docs/api/structures/shared-dictionary-usage-info.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# SharedDictionaryUsageInfo Object
|
||||||
|
|
||||||
|
* `frameOrigin` string - The origin of the frame where the request originates. It’s specific to the individual frame making the request and is defined by its scheme, host, and port. In practice, will look like a URL.
|
||||||
|
* `topFrameSite` string - The site of the top-level browsing context (the main frame or tab that contains the request). It’s less granular than `frameOrigin` and focuses on the broader "site" scope. In practice, will look like a URL.
|
||||||
|
* `totalSizeBytes` number - The amount of bytes stored for this shared dictionary information object in Chromium's internal storage (usually Sqlite).
|
||||||
@@ -79,10 +79,14 @@
|
|||||||
[browserWindow](../browser-window.md) has disabled `backgroundThrottling` then
|
[browserWindow](../browser-window.md) has disabled `backgroundThrottling` then
|
||||||
frames will be drawn and swapped for the whole window and other
|
frames will be drawn and swapped for the whole window and other
|
||||||
[webContents](../web-contents.md) displayed by it. Defaults to `true`.
|
[webContents](../web-contents.md) displayed by it. Defaults to `true`.
|
||||||
* `offscreen` boolean (optional) - Whether to enable offscreen rendering for the browser
|
* `offscreen` Object | boolean (optional) - Whether to enable offscreen rendering for the browser
|
||||||
window. Defaults to `false`. See the
|
window. Defaults to `false`. See the
|
||||||
[offscreen rendering tutorial](../../tutorial/offscreen-rendering.md) for
|
[offscreen rendering tutorial](../../tutorial/offscreen-rendering.md) for
|
||||||
more details.
|
more details.
|
||||||
|
* `useSharedTexture` boolean (optional) _Experimental_ - Whether to use GPU shared texture for accelerated
|
||||||
|
paint event. Defaults to `false`. See the
|
||||||
|
[offscreen rendering tutorial](../../tutorial/offscreen-rendering.md) for
|
||||||
|
more details.
|
||||||
* `contextIsolation` boolean (optional) - Whether to run Electron APIs and
|
* `contextIsolation` boolean (optional) - Whether to run Electron APIs and
|
||||||
the specified `preload` script in a separate JavaScript context. Defaults
|
the specified `preload` script in a separate JavaScript context. Defaults
|
||||||
to `true`. The context that the `preload` script runs in will only have
|
to `true`. The context that the `preload` script runs in will only have
|
||||||
@@ -144,6 +148,7 @@
|
|||||||
this will cause the `preferred-size-changed` event to be emitted on the
|
this will cause the `preferred-size-changed` event to be emitted on the
|
||||||
`WebContents` when the preferred size changes. Default is `false`.
|
`WebContents` when the preferred size changes. Default is `false`.
|
||||||
* `transparent` boolean (optional) - Whether to enable background transparency for the guest page. Default is `true`. **Note:** The guest page's text and background colors are derived from the [color scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme) of its root element. When transparency is enabled, the text color will still change accordingly but the background will remain transparent.
|
* `transparent` boolean (optional) - Whether to enable background transparency for the guest page. Default is `true`. **Note:** The guest page's text and background colors are derived from the [color scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme) of its root element. When transparency is enabled, the text color will still change accordingly but the background will remain transparent.
|
||||||
|
* `enableDeprecatedPaste` boolean (optional) _Deprecated_ - Whether to enable the `paste` [execCommand](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand). Default is `false`.
|
||||||
|
|
||||||
[chrome-content-scripts]: https://developer.chrome.com/extensions/content_scripts#execution-environment
|
[chrome-content-scripts]: https://developer.chrome.com/extensions/content_scripts#execution-environment
|
||||||
[runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5
|
[runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ updates the control in the touch bar. Possible values:
|
|||||||
|
|
||||||
#### `touchBarScrubber.overlayStyle`
|
#### `touchBarScrubber.overlayStyle`
|
||||||
|
|
||||||
A `string` representing the style that selected items in the scrubber should have. This style is overlayed on top
|
A `string` representing the style that selected items in the scrubber should have. This style is overlaid on top
|
||||||
of the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the
|
of the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the
|
||||||
touch bar. Possible values:
|
touch bar. Possible values:
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ Process: [Main](../glossary.md#main-process)<br />
|
|||||||
to load unsigned libraries. Unless you specifically need this capability, it is best to leave this disabled.
|
to load unsigned libraries. Unless you specifically need this capability, it is best to leave this disabled.
|
||||||
Default is `false`.
|
Default is `false`.
|
||||||
* `respondToAuthRequestsFromMainProcess` boolean (optional) - With this flag, all HTTP 401 and 407 network
|
* `respondToAuthRequestsFromMainProcess` boolean (optional) - With this flag, all HTTP 401 and 407 network
|
||||||
requests created via the [net module](net.md) will allow responding to them via the [`app#login`](app.md#event-login) event in the main process instead of the default [`login`](client-request.md#event-login) event on the [`ClientRequest`](client-request.md) object.
|
requests created via the [net module](net.md) will allow responding to them via the
|
||||||
|
[`app#login`](app.md#event-login) event in the main process instead of the default
|
||||||
|
[`login`](client-request.md#event-login) event on the [`ClientRequest`](client-request.md) object. Default is
|
||||||
|
`false`.
|
||||||
|
|
||||||
Returns [`UtilityProcess`](utility-process.md#class-utilityprocess)
|
Returns [`UtilityProcess`](utility-process.md#class-utilityprocess)
|
||||||
|
|
||||||
@@ -86,9 +89,25 @@ true if the kill is successful, and false otherwise.
|
|||||||
#### `child.pid`
|
#### `child.pid`
|
||||||
|
|
||||||
A `Integer | undefined` representing the process identifier (PID) of the child process.
|
A `Integer | undefined` representing the process identifier (PID) of the child process.
|
||||||
If the child process fails to spawn due to errors, then the value is `undefined`. When
|
Until the child process has spawned successfully, the value is `undefined`. When
|
||||||
the child process exits, then the value is `undefined` after the `exit` event is emitted.
|
the child process exits, then the value is `undefined` after the `exit` event is emitted.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const child = utilityProcess.fork(path.join(__dirname, 'test.js'))
|
||||||
|
|
||||||
|
console.log(child.pid) // undefined
|
||||||
|
|
||||||
|
child.on('spawn', () => {
|
||||||
|
console.log(child.pid) // Integer
|
||||||
|
})
|
||||||
|
|
||||||
|
child.on('exit', () => {
|
||||||
|
console.log(child.pid) // undefined
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** You can use the `pid` to determine if the process is currently running.
|
||||||
|
|
||||||
#### `child.stdout`
|
#### `child.stdout`
|
||||||
|
|
||||||
A `NodeJS.ReadableStream | null` that represents the child process's stdout.
|
A `NodeJS.ReadableStream | null` that represents the child process's stdout.
|
||||||
@@ -116,12 +135,26 @@ When the child process exits, then the value is `null` after the `exit` event is
|
|||||||
|
|
||||||
Emitted once the child process has spawned successfully.
|
Emitted once the child process has spawned successfully.
|
||||||
|
|
||||||
|
#### Event: 'error' _Experimental_
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `type` string - Type of error. One of the following values:
|
||||||
|
* `FatalError`
|
||||||
|
* `location` string - Source location from where the error originated.
|
||||||
|
* `report` string - [`Node.js diagnostic report`][].
|
||||||
|
|
||||||
|
Emitted when the child process needs to terminate due to non continuable error from V8.
|
||||||
|
|
||||||
|
No matter if you listen to the `error` event, the `exit` event will be emitted after the
|
||||||
|
child process terminates.
|
||||||
|
|
||||||
#### Event: 'exit'
|
#### Event: 'exit'
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
* `code` number - Contains the exit code for
|
* `code` number - Contains the exit code for
|
||||||
the process obtained from waitpid on posix, or GetExitCodeProcess on windows.
|
the process obtained from waitpid on POSIX, or GetExitCodeProcess on Windows.
|
||||||
|
|
||||||
Emitted after the child process ends.
|
Emitted after the child process ends.
|
||||||
|
|
||||||
@@ -138,3 +171,4 @@ Emitted when the child process sends a message using [`process.parentPort.postMe
|
|||||||
[stdio]: https://nodejs.org/dist/latest/docs/api/child_process.html#optionsstdio
|
[stdio]: https://nodejs.org/dist/latest/docs/api/child_process.html#optionsstdio
|
||||||
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
|
||||||
[`MessagePortMain`]: message-port-main.md
|
[`MessagePortMain`]: message-port-main.md
|
||||||
|
[`Node.js diagnostic report`]: https://nodejs.org/docs/latest/api/report.html#diagnostic-report
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ it becomes the topmost view.
|
|||||||
|
|
||||||
* `view` View - Child view to remove.
|
* `view` View - Child view to remove.
|
||||||
|
|
||||||
|
If the view passed as a parameter is not a child of this view, this method is a no-op.
|
||||||
|
|
||||||
#### `view.setBounds(bounds)`
|
#### `view.setBounds(bounds)`
|
||||||
|
|
||||||
* `bounds` [Rectangle](structures/rectangle.md) - New bounds of the View.
|
* `bounds` [Rectangle](structures/rectangle.md) - New bounds of the View.
|
||||||
|
|||||||
@@ -242,8 +242,9 @@ Returns:
|
|||||||
* `isSameDocument` boolean - This event does not fire for same document navigations using window.history api and reference fragment navigations.
|
* `isSameDocument` boolean - This event does not fire for same document navigations using window.history api and reference fragment navigations.
|
||||||
This property is always set to `false` for this event.
|
This property is always set to `false` for this event.
|
||||||
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
||||||
* `frame` WebFrameMain - The frame to be navigated.
|
* `frame` WebFrameMain | null - The frame to be navigated.
|
||||||
* `initiator` WebFrameMain (optional) - The frame which initiated the
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
|
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
|
||||||
navigation, which can be a parent frame (e.g. via `window.open` with a
|
navigation, which can be a parent frame (e.g. via `window.open` with a
|
||||||
frame's name), or null if the navigation was not initiated by a frame. This
|
frame's name), or null if the navigation was not initiated by a frame. This
|
||||||
can also be null if the initiating frame was deleted before the event was
|
can also be null if the initiating frame was deleted before the event was
|
||||||
@@ -275,8 +276,9 @@ Returns:
|
|||||||
* `isSameDocument` boolean - This event does not fire for same document navigations using window.history api and reference fragment navigations.
|
* `isSameDocument` boolean - This event does not fire for same document navigations using window.history api and reference fragment navigations.
|
||||||
This property is always set to `false` for this event.
|
This property is always set to `false` for this event.
|
||||||
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
||||||
* `frame` WebFrameMain - The frame to be navigated.
|
* `frame` WebFrameMain | null - The frame to be navigated.
|
||||||
* `initiator` WebFrameMain (optional) - The frame which initiated the
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
|
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
|
||||||
navigation, which can be a parent frame (e.g. via `window.open` with a
|
navigation, which can be a parent frame (e.g. via `window.open` with a
|
||||||
frame's name), or null if the navigation was not initiated by a frame. This
|
frame's name), or null if the navigation was not initiated by a frame. This
|
||||||
can also be null if the initiating frame was deleted before the event was
|
can also be null if the initiating frame was deleted before the event was
|
||||||
@@ -306,8 +308,9 @@ Returns:
|
|||||||
document. Examples of same document navigations are reference fragment
|
document. Examples of same document navigations are reference fragment
|
||||||
navigations, pushState/replaceState, and same page history navigation.
|
navigations, pushState/replaceState, and same page history navigation.
|
||||||
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
||||||
* `frame` WebFrameMain - The frame to be navigated.
|
* `frame` WebFrameMain | null - The frame to be navigated.
|
||||||
* `initiator` WebFrameMain (optional) - The frame which initiated the
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
|
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
|
||||||
navigation, which can be a parent frame (e.g. via `window.open` with a
|
navigation, which can be a parent frame (e.g. via `window.open` with a
|
||||||
frame's name), or null if the navigation was not initiated by a frame. This
|
frame's name), or null if the navigation was not initiated by a frame. This
|
||||||
can also be null if the initiating frame was deleted before the event was
|
can also be null if the initiating frame was deleted before the event was
|
||||||
@@ -330,8 +333,9 @@ Returns:
|
|||||||
document. Examples of same document navigations are reference fragment
|
document. Examples of same document navigations are reference fragment
|
||||||
navigations, pushState/replaceState, and same page history navigation.
|
navigations, pushState/replaceState, and same page history navigation.
|
||||||
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
||||||
* `frame` WebFrameMain - The frame to be navigated.
|
* `frame` WebFrameMain | null - The frame to be navigated.
|
||||||
* `initiator` WebFrameMain (optional) - The frame which initiated the
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
|
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
|
||||||
navigation, which can be a parent frame (e.g. via `window.open` with a
|
navigation, which can be a parent frame (e.g. via `window.open` with a
|
||||||
frame's name), or null if the navigation was not initiated by a frame. This
|
frame's name), or null if the navigation was not initiated by a frame. This
|
||||||
can also be null if the initiating frame was deleted before the event was
|
can also be null if the initiating frame was deleted before the event was
|
||||||
@@ -361,8 +365,9 @@ Returns:
|
|||||||
document. Examples of same document navigations are reference fragment
|
document. Examples of same document navigations are reference fragment
|
||||||
navigations, pushState/replaceState, and same page history navigation.
|
navigations, pushState/replaceState, and same page history navigation.
|
||||||
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
* `isMainFrame` boolean - True if the navigation is taking place in a main frame.
|
||||||
* `frame` WebFrameMain - The frame to be navigated.
|
* `frame` WebFrameMain | null - The frame to be navigated.
|
||||||
* `initiator` WebFrameMain (optional) - The frame which initiated the
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
|
* `initiator` WebFrameMain | null (optional) - The frame which initiated the
|
||||||
navigation, which can be a parent frame (e.g. via `window.open` with a
|
navigation, which can be a parent frame (e.g. via `window.open` with a
|
||||||
frame's name), or null if the navigation was not initiated by a frame. This
|
frame's name), or null if the navigation was not initiated by a frame. This
|
||||||
can also be null if the initiating frame was deleted before the event was
|
can also be null if the initiating frame was deleted before the event was
|
||||||
@@ -743,7 +748,8 @@ Returns:
|
|||||||
* `params` Object
|
* `params` Object
|
||||||
* `x` Integer - x coordinate.
|
* `x` Integer - x coordinate.
|
||||||
* `y` Integer - y coordinate.
|
* `y` Integer - y coordinate.
|
||||||
* `frame` WebFrameMain - Frame from which the context menu was invoked.
|
* `frame` WebFrameMain | null - Frame from which the context menu was invoked.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `linkURL` string - URL of the link that encloses the node the context menu
|
* `linkURL` string - URL of the link that encloses the node the context menu
|
||||||
was invoked on.
|
was invoked on.
|
||||||
* `linkText` string - Text associated with the link. May be an empty
|
* `linkText` string - Text associated with the link. May be an empty
|
||||||
@@ -869,12 +875,12 @@ app.whenReady().then(() => {
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
* `event` Event
|
* `details` Event\<\>
|
||||||
|
* `texture` [OffscreenSharedTexture](structures/offscreen-shared-texture.md) (optional) _Experimental_ - The GPU shared texture of the frame, when `webPreferences.offscreen.useSharedTexture` is `true`.
|
||||||
* `dirtyRect` [Rectangle](structures/rectangle.md)
|
* `dirtyRect` [Rectangle](structures/rectangle.md)
|
||||||
* `image` [NativeImage](native-image.md) - The image data of the whole frame.
|
* `image` [NativeImage](native-image.md) - The image data of the whole frame.
|
||||||
|
|
||||||
Emitted when a new frame is generated. Only the dirty area is passed in the
|
Emitted when a new frame is generated. Only the dirty area is passed in the buffer.
|
||||||
buffer.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const { BrowserWindow } = require('electron')
|
const { BrowserWindow } = require('electron')
|
||||||
@@ -886,6 +892,33 @@ win.webContents.on('paint', (event, dirty, image) => {
|
|||||||
win.loadURL('https://github.com')
|
win.loadURL('https://github.com')
|
||||||
```
|
```
|
||||||
|
|
||||||
|
When using shared texture (set `webPreferences.offscreen.useSharedTexture` to `true`) feature, you can pass the texture handle to external rendering pipeline without the overhead of
|
||||||
|
copying data between CPU and GPU memory, with Chromium's hardware acceleration support. This feature is helpful for high-performance rendering scenarios.
|
||||||
|
|
||||||
|
Only a limited number of textures can exist at the same time, so it's important that you call `texture.release()` as soon as you're done with the texture.
|
||||||
|
By managing the texture lifecycle by yourself, you can safely pass the `texture.textureInfo` to other processes through IPC.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { BrowserWindow } = require('electron')
|
||||||
|
|
||||||
|
const win = new BrowserWindow({ webPreferences: { offscreen: { useSharedTexture: true } } })
|
||||||
|
win.webContents.on('paint', async (e, dirty, image) => {
|
||||||
|
if (e.texture) {
|
||||||
|
// By managing lifecycle yourself, you can handle the event in async handler or pass the `e.texture.textureInfo`
|
||||||
|
// to other processes (not `e.texture`, the `e.texture.release` function is not passable through IPC).
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 50))
|
||||||
|
|
||||||
|
// You can send the native texture handle to native code for importing into your rendering pipeline.
|
||||||
|
// For example: https://github.com/electron/electron/tree/main/spec/fixtures/native-addon/osr-gpu
|
||||||
|
// importTextureHandle(dirty, e.texture.textureInfo)
|
||||||
|
|
||||||
|
// You must call `e.texture.release()` as soon as possible, before the underlying frame pool is drained.
|
||||||
|
e.texture.release()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
win.loadURL('https://github.com')
|
||||||
|
```
|
||||||
|
|
||||||
#### Event: 'devtools-reload-page'
|
#### Event: 'devtools-reload-page'
|
||||||
|
|
||||||
Emitted when the devtools window instructs the webContents to reload
|
Emitted when the devtools window instructs the webContents to reload
|
||||||
@@ -983,7 +1016,8 @@ Returns:
|
|||||||
|
|
||||||
* `event` Event
|
* `event` Event
|
||||||
* `details` Object
|
* `details` Object
|
||||||
* `frame` WebFrameMain
|
* `frame` WebFrameMain | null - The created frame.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
|
|
||||||
Emitted when the [mainFrame](web-contents.md#contentsmainframe-readonly), an `<iframe>`, or a nested `<iframe>` is loaded within the page.
|
Emitted when the [mainFrame](web-contents.md#contentsmainframe-readonly), an `<iframe>`, or a nested `<iframe>` is loaded within the page.
|
||||||
|
|
||||||
|
|||||||
@@ -97,6 +97,10 @@ this limitation.
|
|||||||
|
|
||||||
Returns `boolean` - Whether the reload was initiated successfully. Only results in `false` when the frame has no history.
|
Returns `boolean` - Whether the reload was initiated successfully. Only results in `false` when the frame has no history.
|
||||||
|
|
||||||
|
#### `frame.isDestroyed()`
|
||||||
|
|
||||||
|
Returns `boolean` - Whether the frame is destroyed.
|
||||||
|
|
||||||
#### `frame.send(channel, ...args)`
|
#### `frame.send(channel, ...args)`
|
||||||
|
|
||||||
* `channel` string
|
* `channel` string
|
||||||
@@ -138,6 +142,29 @@ ipcRenderer.on('port', (e, msg) => {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### `frame.collectJavaScriptCallStack()` _Experimental_
|
||||||
|
|
||||||
|
Returns `Promise<string> | Promise<void>` - A promise that resolves with the currently running JavaScript call
|
||||||
|
stack. If no JavaScript runs in the frame, the promise will never resolve. In cases where the call stack is
|
||||||
|
otherwise unable to be collected, it will return `undefined`.
|
||||||
|
|
||||||
|
This can be useful to determine why the frame is unresponsive in cases where there's long-running JavaScript.
|
||||||
|
For more information, see the [proposed Crash Reporting API.](https://wicg.github.io/crash-reporting/)
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { app } = require('electron')
|
||||||
|
|
||||||
|
app.commandLine.appendSwitch('enable-features', 'DocumentPolicyIncludeJSCallStacksInCrashReports')
|
||||||
|
|
||||||
|
app.on('web-contents-created', (_, webContents) => {
|
||||||
|
webContents.on('unresponsive', async () => {
|
||||||
|
// Interrupt execution and collect call stack from unresponsive renderer
|
||||||
|
const callStack = await webContents.mainFrame.collectJavaScriptCallStack()
|
||||||
|
console.log('Renderer unresponsive\n', callStack)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
### Instance Properties
|
### Instance Properties
|
||||||
|
|
||||||
#### `frame.ipc` _Readonly_
|
#### `frame.ipc` _Readonly_
|
||||||
@@ -231,6 +258,13 @@ A `string` representing the [visibility state](https://developer.mozilla.org/en-
|
|||||||
|
|
||||||
See also how the [Page Visibility API](browser-window.md#page-visibility) is affected by other Electron APIs.
|
See also how the [Page Visibility API](browser-window.md#page-visibility) is affected by other Electron APIs.
|
||||||
|
|
||||||
|
#### `frame.detached` _Readonly_
|
||||||
|
|
||||||
|
A `Boolean` representing whether the frame is detached from the frame tree. If a frame is accessed
|
||||||
|
while the corresponding page is running any [unload][] listeners, it may become detached as the
|
||||||
|
newly navigated page replaced it in the frame tree.
|
||||||
|
|
||||||
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
[SCA]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
||||||
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
[`postMessage`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
||||||
[`MessagePortMain`]: message-port-main.md
|
[`MessagePortMain`]: message-port-main.md
|
||||||
|
[unload]: https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ dispatch errors of isolated worlds to foreign worlds.
|
|||||||
|
|
||||||
### `webFrame.setIsolatedWorldInfo(worldId, info)`
|
### `webFrame.setIsolatedWorldInfo(worldId, info)`
|
||||||
|
|
||||||
* `worldId` Integer - The ID of the world to run the javascript in, `0` is the default world, `999` is the world used by Electrons `contextIsolation` feature. Chrome extensions reserve the range of IDs in `[1 << 20, 1 << 29)`. You can provide any integer here.
|
* `worldId` Integer - The ID of the world to run the javascript in, `0` is the default world, `999` is the world used by Electron's `contextIsolation` feature. Chrome extensions reserve the range of IDs in `[1 << 20, 1 << 29)`. You can provide any integer here.
|
||||||
* `info` Object
|
* `info` Object
|
||||||
* `securityOrigin` string (optional) - Security origin for the isolated world.
|
* `securityOrigin` string (optional) - Security origin for the isolated world.
|
||||||
* `csp` string (optional) - Content Security Policy for the isolated world.
|
* `csp` string (optional) - Content Security Policy for the isolated world.
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ The following methods are available on instances of `WebRequest`:
|
|||||||
* `method` string
|
* `method` string
|
||||||
* `webContentsId` Integer (optional)
|
* `webContentsId` Integer (optional)
|
||||||
* `webContents` WebContents (optional)
|
* `webContents` WebContents (optional)
|
||||||
* `frame` WebFrameMain (optional)
|
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
||||||
* `referrer` string
|
* `referrer` string
|
||||||
* `timestamp` Double
|
* `timestamp` Double
|
||||||
@@ -94,7 +95,8 @@ Some examples of valid `urls`:
|
|||||||
* `method` string
|
* `method` string
|
||||||
* `webContentsId` Integer (optional)
|
* `webContentsId` Integer (optional)
|
||||||
* `webContents` WebContents (optional)
|
* `webContents` WebContents (optional)
|
||||||
* `frame` WebFrameMain (optional)
|
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
||||||
* `referrer` string
|
* `referrer` string
|
||||||
* `timestamp` Double
|
* `timestamp` Double
|
||||||
@@ -122,7 +124,8 @@ The `callback` has to be called with a `response` object.
|
|||||||
* `method` string
|
* `method` string
|
||||||
* `webContentsId` Integer (optional)
|
* `webContentsId` Integer (optional)
|
||||||
* `webContents` WebContents (optional)
|
* `webContents` WebContents (optional)
|
||||||
* `frame` WebFrameMain (optional)
|
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
||||||
* `referrer` string
|
* `referrer` string
|
||||||
* `timestamp` Double
|
* `timestamp` Double
|
||||||
@@ -142,7 +145,8 @@ response are visible by the time this listener is fired.
|
|||||||
* `method` string
|
* `method` string
|
||||||
* `webContentsId` Integer (optional)
|
* `webContentsId` Integer (optional)
|
||||||
* `webContents` WebContents (optional)
|
* `webContents` WebContents (optional)
|
||||||
* `frame` WebFrameMain (optional)
|
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
||||||
* `referrer` string
|
* `referrer` string
|
||||||
* `timestamp` Double
|
* `timestamp` Double
|
||||||
@@ -173,7 +177,8 @@ The `callback` has to be called with a `response` object.
|
|||||||
* `method` string
|
* `method` string
|
||||||
* `webContentsId` Integer (optional)
|
* `webContentsId` Integer (optional)
|
||||||
* `webContents` WebContents (optional)
|
* `webContents` WebContents (optional)
|
||||||
* `frame` WebFrameMain (optional)
|
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
||||||
* `referrer` string
|
* `referrer` string
|
||||||
* `timestamp` Double
|
* `timestamp` Double
|
||||||
@@ -197,7 +202,8 @@ and response headers are available.
|
|||||||
* `method` string
|
* `method` string
|
||||||
* `webContentsId` Integer (optional)
|
* `webContentsId` Integer (optional)
|
||||||
* `webContents` WebContents (optional)
|
* `webContents` WebContents (optional)
|
||||||
* `frame` WebFrameMain (optional)
|
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
||||||
* `referrer` string
|
* `referrer` string
|
||||||
* `timestamp` Double
|
* `timestamp` Double
|
||||||
@@ -222,7 +228,8 @@ redirect is about to occur.
|
|||||||
* `method` string
|
* `method` string
|
||||||
* `webContentsId` Integer (optional)
|
* `webContentsId` Integer (optional)
|
||||||
* `webContents` WebContents (optional)
|
* `webContents` WebContents (optional)
|
||||||
* `frame` WebFrameMain (optional)
|
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
||||||
* `referrer` string
|
* `referrer` string
|
||||||
* `timestamp` Double
|
* `timestamp` Double
|
||||||
@@ -245,7 +252,8 @@ completed.
|
|||||||
* `method` string
|
* `method` string
|
||||||
* `webContentsId` Integer (optional)
|
* `webContentsId` Integer (optional)
|
||||||
* `webContents` WebContents (optional)
|
* `webContents` WebContents (optional)
|
||||||
* `frame` WebFrameMain (optional)
|
* `frame` WebFrameMain | null (optional) - Requesting frame.
|
||||||
|
May be `null` if accessed after the frame has either navigated or been destroyed.
|
||||||
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
* `resourceType` string - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
|
||||||
* `referrer` string
|
* `referrer` string
|
||||||
* `timestamp` Double
|
* `timestamp` Double
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ The `webUtils` module has the following methods:
|
|||||||
|
|
||||||
Returns `string` - The file system path that this `File` object points to. In the case where the object passed in is not a `File` object an exception is thrown. In the case where the File object passed in was constructed in JS and is not backed by a file on disk an empty string is returned.
|
Returns `string` - The file system path that this `File` object points to. In the case where the object passed in is not a `File` object an exception is thrown. In the case where the File object passed in was constructed in JS and is not backed by a file on disk an empty string is returned.
|
||||||
|
|
||||||
This method superceded the previous augmentation to the `File` object with the `path` property. An example is included below.
|
This method superseded the previous augmentation to the `File` object with the `path` property. An example is included below.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Before
|
// Before
|
||||||
|
|||||||
@@ -14,6 +14,70 @@ This document uses the following convention to categorize breaking changes:
|
|||||||
|
|
||||||
## Planned Breaking API Changes (33.0)
|
## Planned Breaking API Changes (33.0)
|
||||||
|
|
||||||
|
### Deprecated: `document.execCommand("paste")`
|
||||||
|
|
||||||
|
The synchronous clipboard read API [document.execCommand("paste")](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard) has been
|
||||||
|
deprecated in favor of [async clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API). This is to align with the browser defaults.
|
||||||
|
|
||||||
|
The `enableDeprecatedPaste` option on `WebPreferences` that triggers the permission
|
||||||
|
checks for this API and the associated permission type `deprecated-sync-clipboard-read`
|
||||||
|
are also deprecated.
|
||||||
|
|
||||||
|
### Behavior Changed: frame properties may retrieve detached WebFrameMain instances or none at all
|
||||||
|
|
||||||
|
APIs which provide access to a `WebFrameMain` instance may return an instance
|
||||||
|
with `frame.detached` set to `true`, or possibly return `null`.
|
||||||
|
|
||||||
|
When a frame performs a cross-origin navigation, it enters into a detached state
|
||||||
|
in which it's no longer attached to the page. In this state, it may be running
|
||||||
|
[unload](https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event)
|
||||||
|
handlers prior to being deleted. In the event of an IPC sent during this state,
|
||||||
|
`frame.detached` will be set to `true` with the frame being destroyed shortly
|
||||||
|
thereafter.
|
||||||
|
|
||||||
|
When receiving an event, it's important to access WebFrameMain properties
|
||||||
|
immediately upon being received. Otherwise, it's not guaranteed to point to the
|
||||||
|
same webpage as when received. To avoid misaligned expectations, Electron will
|
||||||
|
return `null` in the case of late access where the webpage has changed.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
ipcMain.on('unload-event', (event) => {
|
||||||
|
event.senderFrame; // ✅ accessed immediately
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.on('unload-event', async (event) => {
|
||||||
|
await crossOriginNavigationPromise;
|
||||||
|
event.senderFrame; // ❌ returns `null` due to late access
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Behavior Changed: custom protocol URL handling on Windows
|
||||||
|
|
||||||
|
Due to changes made in Chromium to support [Non-Special Scheme URLs](http://bit.ly/url-non-special), custom protocol URLs that use Windows file paths will no longer work correctly with the deprecated `protocol.registerFileProtocol` and the `baseURLForDataURL` property on `BrowserWindow.loadURL`, `WebContents.loadURL`, and `<webview>.loadURL`. `protocol.handle` will also not work with these types of URLs but this is not a change since it has always worked that way.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// No longer works
|
||||||
|
protocol.registerFileProtocol('other', () => {
|
||||||
|
callback({ filePath: '/path/to/my/file' })
|
||||||
|
})
|
||||||
|
|
||||||
|
const mainWindow = new BrowserWindow()
|
||||||
|
mainWindow.loadURL('data:text/html,<script src="loaded-from-dataurl.js"></script>', { baseURLForDataURL: 'other://C:\\myapp' })
|
||||||
|
mainWindow.loadURL('other://C:\\myapp\\index.html')
|
||||||
|
|
||||||
|
// Replace with
|
||||||
|
const path = require('node:path')
|
||||||
|
const nodeUrl = require('node:url')
|
||||||
|
protocol.handle(other, (req) => {
|
||||||
|
const srcPath = 'C:\\myapp\\'
|
||||||
|
const reqURL = new URL(req.url)
|
||||||
|
return net.fetch(nodeUrl.pathToFileURL(path.join(srcPath, reqURL.pathname)).toString())
|
||||||
|
})
|
||||||
|
|
||||||
|
mainWindow.loadURL('data:text/html,<script src="loaded-from-dataurl.js"></script>', { baseURLForDataURL: 'other://' })
|
||||||
|
mainWindow.loadURL('other://index.html')
|
||||||
|
```
|
||||||
|
|
||||||
### Behavior Changed: `webContents` property on `login` on `app`
|
### Behavior Changed: `webContents` property on `login` on `app`
|
||||||
|
|
||||||
The `webContents` property in the `login` event from `app` will be `null`
|
The `webContents` property in the `login` event from `app` will be `null`
|
||||||
@@ -52,14 +116,14 @@ The nonstandard `path` property of the Web `File` object was added in an early v
|
|||||||
```js
|
```js
|
||||||
// Before (renderer)
|
// Before (renderer)
|
||||||
|
|
||||||
const file = document.querySelector('input[type=file]')
|
const file = document.querySelector('input[type=file]').files[0]
|
||||||
alert(`Uploaded file path was: ${file.path}`)
|
alert(`Uploaded file path was: ${file.path}`)
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// After (renderer)
|
// After (renderer)
|
||||||
|
|
||||||
const file = document.querySelector('input[type=file]')
|
const file = document.querySelector('input[type=file]').files[0]
|
||||||
electron.showFilePath(file)
|
electron.showFilePath(file)
|
||||||
|
|
||||||
// (preload)
|
// (preload)
|
||||||
@@ -102,6 +166,14 @@ win.webContents.navigationHistory.canGoToOffset()
|
|||||||
win.webContents.navigationHistory.goToOffset(index)
|
win.webContents.navigationHistory.goToOffset(index)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Behavior changed: Directory `databases` in `userData` will be deleted
|
||||||
|
|
||||||
|
If you have a directory called `databases` in the directory returned by
|
||||||
|
`app.getPath('userData')`, it will be deleted when Electron 32 is first run.
|
||||||
|
The `databases` directory was used by WebSQL, which was removed in Electron 31.
|
||||||
|
Chromium now performs a cleanup that deletes this directory. See
|
||||||
|
[issue #45396](https://github.com/electron/electron/issues/45396).
|
||||||
|
|
||||||
## Planned Breaking API Changes (31.0)
|
## Planned Breaking API Changes (31.0)
|
||||||
|
|
||||||
### Removed: `WebSQL` support
|
### Removed: `WebSQL` support
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ $ git rebase --autosquash -i [COMMIT_SHA]^
|
|||||||
$ ../electron/script/git-export-patches -o ../electron/patches/v8
|
$ ../electron/script/git-export-patches -o ../electron/patches/v8
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that the `^` symbol [can cause trouble on Windows](https://stackoverflow.com/questions/14203952/git-reset-asks-more/14204318#14204318). The workaround is to either quote it `"[COMMIT_SHA]^"` or avoid it `[COMMIT_SHA]~1`.
|
||||||
|
|
||||||
#### Removing a patch
|
#### Removing a patch
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Experimental APIs
|
# Experimental APIs
|
||||||
|
|
||||||
Some of Electrons APIs are tagged with `_Experimental_` in the documentation.
|
Some of Electron's APIs are tagged with `_Experimental_` in the documentation.
|
||||||
This tag indicates that the API may not be considered stable and the API may
|
This tag indicates that the API may not be considered stable and the API may
|
||||||
be removed or modified more frequently than other APIs with less warning.
|
be removed or modified more frequently than other APIs with less warning.
|
||||||
|
|
||||||
|
|||||||
32
docs/fiddles/features/navigation-history/index.html
Normal file
32
docs/fiddles/features/navigation-history/index.html
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>Enhanced Browser with Navigation History</title>
|
||||||
|
<link href="styles.css" rel="stylesheet" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="controls">
|
||||||
|
<button id="backBtn" title="Go back">Back</button>
|
||||||
|
<button id="forwardBtn" title="Go forward">Forward</button>
|
||||||
|
<button id="backHistoryBtn" title="Show back history">Back History</button>
|
||||||
|
<button id="forwardHistoryBtn" title="Show forward history">Forward History</button>
|
||||||
|
<input id="urlInput" type="text" placeholder="Enter URL">
|
||||||
|
<button id="goBtn" title="Navigate to URL">Go</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="historyPanel" class="history-panel"></div>
|
||||||
|
|
||||||
|
<div id="description">
|
||||||
|
<h2>Navigation History Demo</h2>
|
||||||
|
<p>This demo showcases Electron's NavigationHistory API functionality.</p>
|
||||||
|
<p><strong>Back/Forward:</strong> Navigate through your browsing history.</p>
|
||||||
|
<p><strong>Back History/Forward History:</strong> View and select from your browsing history.</p>
|
||||||
|
<p><strong>URL Bar:</strong> Enter a URL and click 'Go' or press Enter to navigate.</p>
|
||||||
|
</div>
|
||||||
|
<script src="renderer.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
58
docs/fiddles/features/navigation-history/main.js
Normal file
58
docs/fiddles/features/navigation-history/main.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
const { app, BrowserWindow, BrowserView, ipcMain } = require('electron')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
function createWindow () {
|
||||||
|
const mainWindow = new BrowserWindow({
|
||||||
|
width: 1000,
|
||||||
|
height: 800,
|
||||||
|
webPreferences: {
|
||||||
|
preload: path.join(__dirname, 'preload.js'),
|
||||||
|
nodeIntegration: false,
|
||||||
|
contextIsolation: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
mainWindow.loadFile('index.html')
|
||||||
|
|
||||||
|
const view = new BrowserView()
|
||||||
|
mainWindow.setBrowserView(view)
|
||||||
|
view.setBounds({ x: 0, y: 100, width: 1000, height: 800 })
|
||||||
|
view.setAutoResize({ width: true, height: true })
|
||||||
|
|
||||||
|
const navigationHistory = view.webContents.navigationHistory
|
||||||
|
ipcMain.handle('nav:back', () =>
|
||||||
|
navigationHistory.goBack()
|
||||||
|
)
|
||||||
|
|
||||||
|
ipcMain.handle('nav:forward', () => {
|
||||||
|
navigationHistory.goForward()
|
||||||
|
})
|
||||||
|
|
||||||
|
ipcMain.handle('nav:canGoBack', () => navigationHistory.canGoBack())
|
||||||
|
ipcMain.handle('nav:canGoForward', () => navigationHistory.canGoForward())
|
||||||
|
ipcMain.handle('nav:loadURL', (_, url) =>
|
||||||
|
view.webContents.loadURL(url)
|
||||||
|
)
|
||||||
|
ipcMain.handle('nav:getCurrentURL', () => view.webContents.getURL())
|
||||||
|
ipcMain.handle('nav:getHistory', () => {
|
||||||
|
return navigationHistory.getAllEntries()
|
||||||
|
})
|
||||||
|
|
||||||
|
view.webContents.on('did-navigate', () => {
|
||||||
|
mainWindow.webContents.send('nav:updated')
|
||||||
|
})
|
||||||
|
|
||||||
|
view.webContents.on('did-navigate-in-page', () => {
|
||||||
|
mainWindow.webContents.send('nav:updated')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
app.whenReady().then(createWindow)
|
||||||
|
|
||||||
|
app.on('window-all-closed', () => {
|
||||||
|
if (process.platform !== 'darwin') app.quit()
|
||||||
|
})
|
||||||
|
|
||||||
|
app.on('activate', () => {
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||||
|
})
|
||||||
12
docs/fiddles/features/navigation-history/preload.js
Normal file
12
docs/fiddles/features/navigation-history/preload.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
const { contextBridge, ipcRenderer } = require('electron')
|
||||||
|
|
||||||
|
contextBridge.exposeInMainWorld('electronAPI', {
|
||||||
|
goBack: () => ipcRenderer.invoke('nav:back'),
|
||||||
|
goForward: () => ipcRenderer.invoke('nav:forward'),
|
||||||
|
canGoBack: () => ipcRenderer.invoke('nav:canGoBack'),
|
||||||
|
canGoForward: () => ipcRenderer.invoke('nav:canGoForward'),
|
||||||
|
loadURL: (url) => ipcRenderer.invoke('nav:loadURL', url),
|
||||||
|
getCurrentURL: () => ipcRenderer.invoke('nav:getCurrentURL'),
|
||||||
|
getHistory: () => ipcRenderer.invoke('nav:getHistory'),
|
||||||
|
onNavigationUpdate: (callback) => ipcRenderer.on('nav:updated', callback)
|
||||||
|
})
|
||||||
84
docs/fiddles/features/navigation-history/renderer.js
Normal file
84
docs/fiddles/features/navigation-history/renderer.js
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
const backBtn = document.getElementById('backBtn')
|
||||||
|
const forwardBtn = document.getElementById('forwardBtn')
|
||||||
|
const backHistoryBtn = document.getElementById('backHistoryBtn')
|
||||||
|
const forwardHistoryBtn = document.getElementById('forwardHistoryBtn')
|
||||||
|
const urlInput = document.getElementById('urlInput')
|
||||||
|
const goBtn = document.getElementById('goBtn')
|
||||||
|
const historyPanel = document.getElementById('historyPanel')
|
||||||
|
|
||||||
|
async function updateButtons () {
|
||||||
|
const canGoBack = await window.electronAPI.canGoBack()
|
||||||
|
const canGoForward = await window.electronAPI.canGoForward()
|
||||||
|
backBtn.disabled = !canGoBack
|
||||||
|
backHistoryBtn.disabled = !canGoBack
|
||||||
|
|
||||||
|
forwardBtn.disabled = !canGoForward
|
||||||
|
forwardHistoryBtn.disabled = !canGoForward
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updateURL () {
|
||||||
|
urlInput.value = await window.electronAPI.getCurrentURL()
|
||||||
|
}
|
||||||
|
|
||||||
|
function transformURL (url) {
|
||||||
|
if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
||||||
|
const updatedUrl = 'https://' + url
|
||||||
|
return updatedUrl
|
||||||
|
}
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
|
||||||
|
async function navigate (url) {
|
||||||
|
const urlInput = transformURL(url)
|
||||||
|
|
||||||
|
await window.electronAPI.loadURL(urlInput)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function showHistory (forward = false) {
|
||||||
|
const history = await window.electronAPI.getHistory()
|
||||||
|
const currentIndex = history.findIndex(entry => entry.url === transformURL(urlInput.value))
|
||||||
|
|
||||||
|
if (!currentIndex) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const relevantHistory = forward
|
||||||
|
? history.slice(currentIndex + 1)
|
||||||
|
: history.slice(0, currentIndex).reverse()
|
||||||
|
|
||||||
|
historyPanel.innerHTML = ''
|
||||||
|
relevantHistory.forEach(entry => {
|
||||||
|
const div = document.createElement('div')
|
||||||
|
div.textContent = `Title: ${entry.title}, URL: ${entry.url}`
|
||||||
|
div.onclick = () => navigate(entry.url)
|
||||||
|
historyPanel.appendChild(div)
|
||||||
|
})
|
||||||
|
|
||||||
|
historyPanel.style.display = 'block'
|
||||||
|
}
|
||||||
|
|
||||||
|
backBtn.addEventListener('click', () => window.electronAPI.goBack())
|
||||||
|
forwardBtn.addEventListener('click', () => window.electronAPI.goForward())
|
||||||
|
backHistoryBtn.addEventListener('click', () => showHistory(false))
|
||||||
|
forwardHistoryBtn.addEventListener('click', () => showHistory(true))
|
||||||
|
goBtn.addEventListener('click', () => navigate(urlInput.value))
|
||||||
|
|
||||||
|
urlInput.addEventListener('keypress', (e) => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
navigate(urlInput.value)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
document.addEventListener('click', (e) => {
|
||||||
|
if (e.target !== historyPanel && !historyPanel.contains(e.target) &&
|
||||||
|
e.target !== backHistoryBtn && e.target !== forwardHistoryBtn) {
|
||||||
|
historyPanel.style.display = 'none'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
window.electronAPI.onNavigationUpdate(() => {
|
||||||
|
updateButtons()
|
||||||
|
updateURL()
|
||||||
|
})
|
||||||
|
|
||||||
|
updateButtons()
|
||||||
58
docs/fiddles/features/navigation-history/style.css
Normal file
58
docs/fiddles/features/navigation-history/style.css
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
}
|
||||||
|
#controls {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
font-size: 14px;
|
||||||
|
background-color: #4CAF50;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.3s;
|
||||||
|
}
|
||||||
|
button:hover {
|
||||||
|
background-color: #45a049;
|
||||||
|
}
|
||||||
|
button:disabled {
|
||||||
|
background-color: #cccccc;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
#urlInput {
|
||||||
|
flex-grow: 1;
|
||||||
|
margin: 0 10px;
|
||||||
|
padding: 8px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#historyPanel {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
top: 60px;
|
||||||
|
left: 10px;
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 10px;
|
||||||
|
max-height: 300px;
|
||||||
|
overflow-y: auto;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
#historyPanel div {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#description {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
padding: 10px;
|
||||||
|
margin-top: 150px;
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
<button id="clickme">Test Bluetooth</button>
|
<button id="clickme">Test Bluetooth</button>
|
||||||
<button id="cancel">Cancel Bluetooth Request</button>
|
<button id="cancel">Cancel Bluetooth Request</button>
|
||||||
|
|
||||||
<p>Currently selected bluetooth device: <strong id="device-name""></strong></p>
|
<p>Currently selected bluetooth device: <strong id="device-name"></strong></p>
|
||||||
|
|
||||||
<script src="./renderer.js"></script>
|
<script src="./renderer.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||||
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
|
||||||
|
<link href="./styles.css" rel="stylesheet">
|
||||||
|
<title>Custom Titlebar App</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- mount your title bar at the top of you application's body tag -->
|
||||||
|
<div class="titlebar">Cool titlebar</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
const { app, BrowserWindow } = require('electron')
|
||||||
|
|
||||||
|
function createWindow () {
|
||||||
|
const win = new BrowserWindow({
|
||||||
|
// remove the default titlebar
|
||||||
|
titleBarStyle: 'hidden',
|
||||||
|
// expose window controlls in Windows/Linux
|
||||||
|
...(process.platform !== 'darwin' ? { titleBarOverlay: true } : {})
|
||||||
|
})
|
||||||
|
|
||||||
|
win.loadFile('index.html')
|
||||||
|
}
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
createWindow()
|
||||||
|
})
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.titlebar {
|
||||||
|
height: 30px;
|
||||||
|
background: blue;
|
||||||
|
color: white;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
app-region: drag;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||||
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
|
||||||
|
<link href="./styles.css" rel="stylesheet">
|
||||||
|
<title>Custom Titlebar App</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- mount your title bar at the top of you application's body tag -->
|
||||||
|
<div class="titlebar">Cool titlebar</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
const { app, BrowserWindow } = require('electron')
|
||||||
|
|
||||||
|
function createWindow () {
|
||||||
|
const win = new BrowserWindow({
|
||||||
|
// remove the default titlebar
|
||||||
|
titleBarStyle: 'hidden',
|
||||||
|
// expose window controlls in Windows/Linux
|
||||||
|
...(process.platform !== 'darwin' ? { titleBarOverlay: true } : {})
|
||||||
|
})
|
||||||
|
|
||||||
|
win.loadFile('index.html')
|
||||||
|
}
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
createWindow()
|
||||||
|
})
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.titlebar {
|
||||||
|
height: 30px;
|
||||||
|
background: blue;
|
||||||
|
color: white;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
const { app, BrowserWindow } = require('electron')
|
||||||
|
|
||||||
|
function createWindow () {
|
||||||
|
const win = new BrowserWindow({
|
||||||
|
// remove the default titlebar
|
||||||
|
titleBarStyle: 'hidden',
|
||||||
|
// expose window controlls in Windows/Linux
|
||||||
|
...(process.platform !== 'darwin' ? { titleBarOverlay: true } : {})
|
||||||
|
})
|
||||||
|
win.loadURL('https://example.com')
|
||||||
|
}
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
createWindow()
|
||||||
|
})
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
const { app, BrowserWindow } = require('electron')
|
||||||
|
|
||||||
|
function createWindow () {
|
||||||
|
const win = new BrowserWindow({
|
||||||
|
// remove the default titlebar
|
||||||
|
titleBarStyle: 'hidden'
|
||||||
|
})
|
||||||
|
win.loadURL('https://example.com')
|
||||||
|
}
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
createWindow()
|
||||||
|
})
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
const { app, BrowserWindow } = require('electron')
|
||||||
|
|
||||||
|
function createWindow () {
|
||||||
|
const win = new BrowserWindow({})
|
||||||
|
win.loadURL('https://example.com')
|
||||||
|
}
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
createWindow()
|
||||||
|
})
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
const { app, BrowserWindow } = require('electron')
|
||||||
|
|
||||||
|
function createWindow () {
|
||||||
|
const win = new BrowserWindow({
|
||||||
|
width: 300,
|
||||||
|
height: 200,
|
||||||
|
frame: false
|
||||||
|
})
|
||||||
|
win.loadURL('https://example.com')
|
||||||
|
}
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
createWindow()
|
||||||
|
})
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||||
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
|
||||||
|
<link href="./styles.css" rel="stylesheet">
|
||||||
|
<title>Transparent Hello World</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="white-circle">
|
||||||
|
<div>Hello World!</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
const { app, BrowserWindow } = require('electron')
|
||||||
|
|
||||||
|
function createWindow () {
|
||||||
|
const win = new BrowserWindow({
|
||||||
|
width: 100,
|
||||||
|
height: 100,
|
||||||
|
resizable: false,
|
||||||
|
frame: false,
|
||||||
|
transparent: true
|
||||||
|
})
|
||||||
|
win.loadFile('index.html')
|
||||||
|
}
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
createWindow()
|
||||||
|
})
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0); /* Transparent background */
|
||||||
|
}
|
||||||
|
.white-circle {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
app-region: drag;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
BIN
docs/images/frameless-window.png
Normal file
BIN
docs/images/frameless-window.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 412 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user