mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
196 Commits
dawn-patch
...
build-win-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5647226c3f | ||
|
|
e0ffe69212 | ||
|
|
f6f2c70bbf | ||
|
|
d5ead17629 | ||
|
|
a727936a1f | ||
|
|
eb76a7652b | ||
|
|
029147bdeb | ||
|
|
5717f1010b | ||
|
|
d5de8883a2 | ||
|
|
8a11d5afb1 | ||
|
|
89963618d9 | ||
|
|
8c5c6a6088 | ||
|
|
24526ccd39 | ||
|
|
1134d95c6d | ||
|
|
d76608b945 | ||
|
|
d689f76ff9 | ||
|
|
e3142865b2 | ||
|
|
1f8e4079cd | ||
|
|
bad88c6ed4 | ||
|
|
534cb33465 | ||
|
|
51e7753ae9 | ||
|
|
d141934885 | ||
|
|
22e8cf9416 | ||
|
|
5856b2e01c | ||
|
|
49d91dd02b | ||
|
|
2f20d287d1 | ||
|
|
73377af79e | ||
|
|
47766801e4 | ||
|
|
bf0510dc22 | ||
|
|
486a9a61d2 | ||
|
|
7851a34c2d | ||
|
|
faa21a748f | ||
|
|
5bd2938f6a | ||
|
|
f149efe32e | ||
|
|
5dd509d2f4 | ||
|
|
bdd7730a24 | ||
|
|
060e76f1b6 | ||
|
|
2fbf1f5c72 | ||
|
|
c769361af2 | ||
|
|
6ea7d6d5a4 | ||
|
|
27b3a32307 | ||
|
|
ddeb970f18 | ||
|
|
5d80264944 | ||
|
|
dae76c2885 | ||
|
|
a368c5da0c | ||
|
|
1b2679b315 | ||
|
|
15acf70760 | ||
|
|
324eb0eb1c | ||
|
|
0e4ee9f03a | ||
|
|
ae94cefdba | ||
|
|
409c29b12b | ||
|
|
b0e012f14e | ||
|
|
9a5ffd920c | ||
|
|
cf2e283332 | ||
|
|
d6a6312fc8 | ||
|
|
95f097a392 | ||
|
|
b380755514 | ||
|
|
3985daa81c | ||
|
|
5901d8a6d8 | ||
|
|
eee60f202c | ||
|
|
b5a7d81c7d | ||
|
|
a89b2cd9bc | ||
|
|
44fa30695f | ||
|
|
2ab56adbbd | ||
|
|
a1f0ef80d4 | ||
|
|
c1a031be83 | ||
|
|
c8bb700509 | ||
|
|
46922de638 | ||
|
|
75ea93a279 | ||
|
|
ace0beaa3f | ||
|
|
9eb43f3286 | ||
|
|
809ab09b6f | ||
|
|
3df3a6a736 | ||
|
|
7433c14af5 | ||
|
|
a90ccc753b | ||
|
|
e181fd040f | ||
|
|
a486185e10 | ||
|
|
8cefc8425c | ||
|
|
fe477ce3aa | ||
|
|
bab6bd3dae | ||
|
|
33f6942565 | ||
|
|
a1b2e82778 | ||
|
|
1e06b74cd2 | ||
|
|
fe0caa0e0d | ||
|
|
cd48083be8 | ||
|
|
8d5b104c17 | ||
|
|
6e134a8ad9 | ||
|
|
95e87e46ab | ||
|
|
90e338df50 | ||
|
|
1b3fc9c174 | ||
|
|
c51018281f | ||
|
|
8ce97df569 | ||
|
|
7aafe66717 | ||
|
|
ba5f7d272f | ||
|
|
6b50b5e816 | ||
|
|
06044b50f4 | ||
|
|
4adfc212b3 | ||
|
|
640c7bb908 | ||
|
|
0767b42cb8 | ||
|
|
555f507c17 | ||
|
|
1ff8e8014a | ||
|
|
20c7042a20 | ||
|
|
4786e80f33 | ||
|
|
64326e296b | ||
|
|
2f67242030 | ||
|
|
e6844a3640 | ||
|
|
fdb7fc7794 | ||
|
|
e601d05cbd | ||
|
|
66367e9db4 | ||
|
|
05233b4962 | ||
|
|
e4f02faa0a | ||
|
|
d890ebd9fa | ||
|
|
79e17ce4be | ||
|
|
2200a70e8d | ||
|
|
203540c8aa | ||
|
|
8f9637fde4 | ||
|
|
5b5b24775e | ||
|
|
eb4b7bb82f | ||
|
|
13e84e6868 | ||
|
|
54a617caab | ||
|
|
530be28bc5 | ||
|
|
537fd7b10b | ||
|
|
3809093511 | ||
|
|
71be38f87f | ||
|
|
925966fde4 | ||
|
|
2d5597b1b0 | ||
|
|
e3a0ac06e2 | ||
|
|
b66bf5db0c | ||
|
|
16f1ec9001 | ||
|
|
c896ab80fe | ||
|
|
40b6738735 | ||
|
|
05b9a5bfc7 | ||
|
|
b9d3f15265 | ||
|
|
8ecd064d2c | ||
|
|
511809ef63 | ||
|
|
32ae696ee0 | ||
|
|
b121065984 | ||
|
|
2622e6606d | ||
|
|
10b07deb97 | ||
|
|
92a910d15c | ||
|
|
3c5513015a | ||
|
|
27727dbe0a | ||
|
|
7961206fcb | ||
|
|
7da0b4b351 | ||
|
|
3d31030fc5 | ||
|
|
11d174344a | ||
|
|
687f3d4a92 | ||
|
|
93a611e224 | ||
|
|
09db682529 | ||
|
|
b811ca0cde | ||
|
|
f260e06a62 | ||
|
|
b659563724 | ||
|
|
dd7c7fddd1 | ||
|
|
bc86e68a72 | ||
|
|
4951b96235 | ||
|
|
a5cebb6df2 | ||
|
|
1ad8d35be9 | ||
|
|
a22511a196 | ||
|
|
068ac3c405 | ||
|
|
87d1ff59cb | ||
|
|
1073d7e2bb | ||
|
|
6399527761 | ||
|
|
519187db1d | ||
|
|
ab0ff5dffc | ||
|
|
bec1734d63 | ||
|
|
78b32cafcb | ||
|
|
595920a308 | ||
|
|
ca0b46b413 | ||
|
|
194ce1a1d6 | ||
|
|
b6a9f08be1 | ||
|
|
bab11f8c7b | ||
|
|
38be633aa8 | ||
|
|
9d01e6b3e3 | ||
|
|
3c100c2229 | ||
|
|
f6ffb55c72 | ||
|
|
27bea2576e | ||
|
|
c460992407 | ||
|
|
1f78d2258c | ||
|
|
513a6ee80a | ||
|
|
040b0e795b | ||
|
|
184586f0b1 | ||
|
|
26759b8412 | ||
|
|
de5041797f | ||
|
|
5bd45a6a28 | ||
|
|
d7727c9ec2 | ||
|
|
ba135e2f7f | ||
|
|
a88de8bf1c | ||
|
|
4d6db515bd | ||
|
|
20fc76cb43 | ||
|
|
2a94d414f7 | ||
|
|
4abb1f2aa3 | ||
|
|
310490221e | ||
|
|
3345edd2bf | ||
|
|
c5fe50be3b | ||
|
|
37de243f55 | ||
|
|
8c05e4b450 |
1
.claude/.gitignore
vendored
Normal file
1
.claude/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
settings.local.json
|
||||
24
.claude/settings.json
Normal file
24
.claude/settings.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(e sync)",
|
||||
"Bash(e patches --list-targets:*)",
|
||||
"Bash(git add:*)",
|
||||
"Bash(git am:*)",
|
||||
"Bash(git commit:*)",
|
||||
"Bash(git log:*)",
|
||||
"Bash(git show:*)",
|
||||
"Bash(e patches:*)",
|
||||
"Bash(e sync:*)",
|
||||
"Skill(electron-chromium-upgrade)",
|
||||
"Read(*)",
|
||||
"Bash(echo:*)",
|
||||
"Bash(e build:*)",
|
||||
"Bash(tee:*)",
|
||||
"Bash(git diff:*)",
|
||||
"Bash(git rev-parse:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
}
|
||||
}
|
||||
199
.claude/skills/electron-chromium-upgrade/SKILL.md
Normal file
199
.claude/skills/electron-chromium-upgrade/SKILL.md
Normal file
@@ -0,0 +1,199 @@
|
||||
---
|
||||
name: electron-chromium-upgrade
|
||||
description: Guide for performing Chromium version upgrades in the Electron project. Use when working on the roller/chromium/main branch to fix patch conflicts during `e sync --3`. Covers the patch application workflow, conflict resolution, analyzing upstream Chromium changes, and proper commit formatting for patch fixes.
|
||||
---
|
||||
|
||||
# Electron Chromium Upgrade: Phase One
|
||||
|
||||
## Summary
|
||||
|
||||
Run `e sync --3` repeatedly, fixing patch conflicts as they arise, until it succeeds. Then run `e patches all` and commit changes atomically.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
Phase One is complete when:
|
||||
- `e sync --3` exits with code 0 (no patch failures)
|
||||
- `e patches all` has been run to export all changes
|
||||
- All changes are committed per the commit guidelines below
|
||||
|
||||
Do not stop until these criteria are met.
|
||||
|
||||
**CRITICAL** Do not delete or skip patches unless 100% certain the patch is no longer needed. Complicated conflicts or hard to resolve issues should be presented to the user after you have exhausted all other options. Do not delete the patch just because you can't solve it.
|
||||
|
||||
## Context
|
||||
|
||||
The `roller/chromium/main` branch is created by automation to update Electron's Chromium dependency SHA. No work has been done to handle breaking changes between the old and new versions.
|
||||
|
||||
**Key directories:**
|
||||
- Current directory: Electron repo (always run `e` commands here)
|
||||
- `..` (parent): Chromium repo (where most patches apply)
|
||||
- `patches/`: Patch files organized by target
|
||||
- `docs/development/patches.md`: Patch system documentation
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Delete the `.git/rr-cache` in both the `electron` and `..` folder to ensure no accidental rerere replays occur from before this upgrade phase attempt started
|
||||
2. Run `e sync --3` (the `--3` flag enables 3-way merge, always required)
|
||||
3. If succeeds → skip to step 6
|
||||
4. If patch fails:
|
||||
- Identify target repo and patch from error output
|
||||
- Analyze failure (see references/patch-analysis.md)
|
||||
- Fix conflict in target repo's working directory
|
||||
- Run `git am --continue` in affected repo
|
||||
- Repeat until all patches for that repo apply
|
||||
- IMPORTANT: Once `git am --continue` succeeds you MUST run `e patches {target}` to export fixes
|
||||
- Return to step 1
|
||||
5. When `e sync --3` succeeds, run `e patches all`
|
||||
6. **Read `references/phase-one-commit-guidelines.md` NOW**, then commit changes following those instructions exactly.
|
||||
|
||||
Before committing any Phase One changes, you MUST read `references/phase-one-commit-guidelines.md` and follow its instructions exactly.
|
||||
|
||||
## Commands Reference
|
||||
|
||||
| Command | Purpose |
|
||||
|---------|---------|
|
||||
| `e sync --3` | Clone deps and apply patches with 3-way merge |
|
||||
| `git am --continue` | Continue after resolving conflict (run in target repo) |
|
||||
| `e patches {target}` | Export commits from target repo to patch files |
|
||||
| `e patches all` | Export all patches from all targets |
|
||||
| `e patches --list-targets` | List targets and config paths |
|
||||
|
||||
## Patch System Mental Model
|
||||
|
||||
```
|
||||
patches/{target}/*.patch → [e sync --3] → target repo commits
|
||||
← [e patches] ←
|
||||
```
|
||||
|
||||
## When to Edit Patches
|
||||
|
||||
| Situation | Action |
|
||||
|-----------|--------|
|
||||
| During active `git am` conflict | Fix in target repo, then `git am --continue` |
|
||||
| Modifying patch outside conflict | Edit `.patch` file directly |
|
||||
| Creating new patch (rare, avoid) | Commit in target repo, then `e patches {target}` |
|
||||
|
||||
Fix existing patches 99% of the time rather than creating new ones.
|
||||
|
||||
## Patch Fixing Rules
|
||||
|
||||
1. **Preserve authorship**: Keep original author in TODO comments (from patch `From:` field)
|
||||
2. **Never change TODO assignees**: `TODO(name)` must retain original name
|
||||
3. **Update descriptions**: If upstream changed (e.g., `DCHECK` → `CHECK_IS_TEST`), update patch commit message to reflect current state
|
||||
|
||||
## Final Deliverable
|
||||
|
||||
After Phase One, write a summary of every change: what was fixed, why, reasoning, and Chromium CL links.
|
||||
|
||||
# Electron Chromium Upgrade: Phase Two
|
||||
|
||||
## Summary
|
||||
|
||||
Run `e build -k 999` repeatedly, fixing build issues as they arise, until it succeeds. Then run `e start --version` to validate Electron launches and commit changes atomically.
|
||||
|
||||
Run Phase Two immediately after Phase One is complete.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
Phase Two is complete when:
|
||||
- `e build -k 999` exits with code 0 (no build failures)
|
||||
- `e start --version` has been run to check Electron launches
|
||||
- All changes are committed per the commit guidelines below
|
||||
|
||||
Do not stop until these criteria are met. Do not delete code or features, never comment out code in order to take short cut. Make all existing code, logic and intention work.
|
||||
|
||||
## Context
|
||||
|
||||
The `roller/chromium/main` branch is created by automation to update Electron's Chromium dependency SHA. No work has been done to handle breaking changes between the old and new versions. Chromium APIs frequently are renamed or refactored. In every case the code in Electron must be updated to account for the change in Chromium, strongly avoid making changes to the code in chromium to fix Electrons build.
|
||||
|
||||
**Key directories:**
|
||||
- Current directory: Electron repo (always run `e` commands here)
|
||||
- `..` (parent): Chromium repo (do not touch this code to fix build issues, just read it to obtain context)
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Run `e build -k 999` (the `-k 999` flag is a flag to ninja to say "do not stop until you find that many errors" it is an attempt to get as much error
|
||||
context as possible for each time we run build)
|
||||
2. If succeeds → skip to step 6
|
||||
3. If build fails:
|
||||
- Identify underlying file in "electron" from the compilation error message
|
||||
- Analyze failure
|
||||
- Fix build issue by adapting Electron's code for the change in Chromium
|
||||
- Run `e build -t {target_that_failed}.o` to build just the failed target we were specifically fixing
|
||||
- You can identify the target_that_failed from the failure line in the build log. E.g. `FAILED: 2e506007-8d5d-4f38-bdd1-b5cd77999a77 "./obj/electron/chromium_src/chrome/process_singleton_posix.o" CXX obj/electron/chromium_src/chrome/process_singleton_posix.o` the target name is `obj/electron/chromium_src/chrome/process_singleton_posix.o`
|
||||
- **Read `references/phase-two-commit-guidelines.md` NOW**, then commit changes following those instructions exactly.
|
||||
- Return to step 1
|
||||
4. **CRITICAL**: After ANY commit (especially patch commits), immediately run `git status` in the electron repo
|
||||
- Look for other modified `.patch` files that only have index/hunk header changes
|
||||
- These are dependent patches affected by your fix
|
||||
- Commit them immediately with: `git commit -am "chore: update patch hunk headers"`
|
||||
- This prevents losing track of necessary updates
|
||||
5. Return to step 1
|
||||
6. When `e build` succeeds, run `e start --version`
|
||||
7. Check if you have any pending changes in the Chromium repo by running `git status`
|
||||
- If you have changes follow the instructions below in "A. Patch Fixes" to correctly commit those modifications into the appropriate patch file
|
||||
|
||||
Before committing any Phase Two changes, you MUST read `references/phase-two-commit-guidelines.md` and follow its instructions exactly.
|
||||
|
||||
## Build Error Detection
|
||||
|
||||
When monitoring `e build -k 999` output, filter for errors using this regex pattern:
|
||||
error:|FAILED:|fatal:|subcommand failed|build finished
|
||||
|
||||
The build output is extremely verbose. Filtering is essential to catch errors quickly.
|
||||
|
||||
## Commands Reference
|
||||
|
||||
| Command | Purpose |
|
||||
|---------|---------|
|
||||
| `e build -k 999` | Builds Electron and won't stop until either all targets attempted or 999 errors found |
|
||||
| `e build -t {target}.o` | Build just one specific target to verify a fix |
|
||||
| `e start --version` | Validate Electron launches after successful build |
|
||||
|
||||
## Two Types of Build Fixes
|
||||
|
||||
### A. Patch Fixes (for files in chromium_src or patched Chromium files)
|
||||
|
||||
When the error is in a file that Electron patches (check with `grep -l "filename" patches/chromium/*.patch`):
|
||||
|
||||
1. Edit the file in the Chromium source tree (e.g., `/src/chrome/browser/...`)
|
||||
2. Create a fixup commit targeting the original patch commit:
|
||||
```bash
|
||||
cd .. # to chromium repo
|
||||
git add <modified-file>
|
||||
git commit --fixup=<original-patch-commit-hash>
|
||||
GIT_SEQUENCE_EDITOR=: git rebase --autosquash --autostash -i <commit>^
|
||||
3. Export the updated patch: e patches chromium
|
||||
4. Commit the updated patch file in the electron repo following the `references/phase-one-commit-guidelines.md`, then commit changes following those instructions exactly. **READ THESE GUIDELINES BEFORE COMMITTING THESE CHANGES**
|
||||
|
||||
To find the original patch commit to fixup: `git log --oneline | grep -i "keyword from patch name"`
|
||||
|
||||
The base commit for rebase is the Chromium commit before patches were applied. Find it by checking the `refs/patches/upstream-head` ref.
|
||||
|
||||
B. Electron Code Fixes (for files in shell/, electron/, etc.)
|
||||
|
||||
When the error is in Electron's own source code:
|
||||
|
||||
1. Edit files directly in the electron repo
|
||||
2. Commit directly (no patch export needed)
|
||||
|
||||
Dependent Patch Updates
|
||||
|
||||
IMPORTANT: When you modify a patch, other patches that apply to the same file may have their hunk headers invalidated. After committing a patch fix:
|
||||
|
||||
1. Run git status in the electron repo
|
||||
2. Look for other modified .patch files with just index/hunk header changes
|
||||
3. Commit these with: git commit -m "chore: update patch hunk headers"
|
||||
|
||||
# Critical: Read Before Committing
|
||||
|
||||
- Before ANY Phase One commits: Read `references/phase-one-commit-guidelines.md`
|
||||
- Before ANY Phase Two commits: Read `references/phase-two-commit-guidelines.md`
|
||||
|
||||
# Skill Directory Structure
|
||||
This skill has additional reference files in `references/`:
|
||||
- patch-analysis.md - How to analyze patch failures
|
||||
- phase-one-commit-guidelines.md - Commit format for Phase One
|
||||
- phase-two-commit-guidelines.md - Commit format for Phase Two
|
||||
|
||||
Read these when referenced in the workflow steps.
|
||||
@@ -0,0 +1,69 @@
|
||||
# Analyzing Patch Failures
|
||||
|
||||
## Investigation Steps
|
||||
|
||||
1. **Read the patch file** at `patches/{target}/{patch_name}.patch`
|
||||
|
||||
2. **Examine current state** of the file in Chromium at mentioned line numbers
|
||||
|
||||
3. **Check recent upstream changes:**
|
||||
```bash
|
||||
cd .. # or relevant target repo
|
||||
git log --oneline -10 -- {file}
|
||||
```
|
||||
|
||||
4. **Find Chromium CL** in commit messages:
|
||||
```
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/{CL_NUMBER}
|
||||
```
|
||||
|
||||
## Common Failure Patterns
|
||||
|
||||
| Pattern | Cause | Solution |
|
||||
|---------|-------|----------|
|
||||
| Context lines don't match | Surrounding code changed | Update context in patch |
|
||||
| File not found | File renamed/moved | Update patch target path |
|
||||
| Function not found | Refactored upstream | Find new function name |
|
||||
| `DCHECK` → `CHECK_IS_TEST` | Macro change | Update to new macro |
|
||||
| Deleted code | Feature removed | Verify patch still needed |
|
||||
|
||||
## Using Git Blame
|
||||
|
||||
To find the CL that changed specific lines:
|
||||
|
||||
```bash
|
||||
cd ..
|
||||
git blame -L {start},{end} -- {file}
|
||||
git log -1 {commit_sha} # Look for Reviewed-on: line
|
||||
```
|
||||
|
||||
## Verifying Patch Necessity
|
||||
|
||||
Before deleting a patch, verify:
|
||||
1. The patched functionality was intentionally removed upstream
|
||||
2. Electron doesn't need the patch for other reasons
|
||||
3. No other code depends on the patched behavior
|
||||
|
||||
When in doubt, keep the patch and adapt it.
|
||||
|
||||
## Phase Two: Build-Time Patch Issues
|
||||
|
||||
Sometimes patches that applied successfully in Phase One cause build errors in Phase Two. This can happen when:
|
||||
|
||||
1. **Incomplete types**: A patch disables a header include, but new upstream code uses the type
|
||||
2. **Missing members**: A patch modifies a class, but upstream added new code referencing the original
|
||||
|
||||
### Finding Which Patch Affects a File
|
||||
|
||||
```bash
|
||||
grep -l "filename.cc" patches/chromium/*.patch
|
||||
```
|
||||
|
||||
Matching Existing Patch Patterns
|
||||
|
||||
When fixing build errors in patched files, examine the existing patch to understand its style:
|
||||
- Does it use #if 0 / #endif guards?
|
||||
- Does it use #if BUILDFLAG(...) conditionals?
|
||||
- What's the pattern for disabled functionality?
|
||||
|
||||
Apply fixes consistent with the existing patch style.
|
||||
@@ -0,0 +1,52 @@
|
||||
# Phase One Commit Guidelines
|
||||
|
||||
Only follow these instructions if there are uncommitted changes to `patches/` after Phase One succeeds.
|
||||
|
||||
Ignore other instructions about making commit messages, our guidelines are CRITICALLY IMPORTANT and must be followed.
|
||||
|
||||
## Atomic Commits
|
||||
|
||||
For each fix made to a patch, create a separate commit:
|
||||
|
||||
```
|
||||
fix(patch-conflict): {concise title}
|
||||
|
||||
{Brief explanation, 1-2 paragraphs max}
|
||||
|
||||
Ref: {Chromium CL link}
|
||||
```
|
||||
|
||||
IMPORTANT: Ensure that any changes made to patch content as a result of a change in Chromium is committed individually. Each change should have it's own commit message and it's own REF.
|
||||
|
||||
IMPORTANT: Try really hard to find the CL reference per the instructions below. Each change you made should in theory have been in response to a change made in Chromium that you identified or can identify. Try for a while to identify and include the ref in the commit message. Do not give up easily.
|
||||
|
||||
## Finding CL References
|
||||
|
||||
Use `git log` or `git blame` on Chromium source files. Look for:
|
||||
|
||||
```
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/XXXXXXX
|
||||
```
|
||||
|
||||
If no CL found after searching: `Ref: Unable to locate CL`
|
||||
|
||||
## Final Cleanup
|
||||
|
||||
After all fix commits, stage remaining changes:
|
||||
|
||||
```bash
|
||||
git add patches
|
||||
git commit -m "chore: update patch hunk headers"
|
||||
```
|
||||
|
||||
## Example Commit
|
||||
|
||||
```
|
||||
fix(patch-conflict): update web_contents_impl.cc context for navigation refactor
|
||||
|
||||
The upstream navigation code was refactored to use NavigationRequest directly
|
||||
instead of going through NavigationController. Updated surrounding context
|
||||
to match new code structure.
|
||||
|
||||
Ref: https://chromium-review.googlesource.com/c/chromium/src/+/1234567
|
||||
```
|
||||
@@ -0,0 +1,82 @@
|
||||
# Phase Two Commit Guidelines
|
||||
|
||||
Only follow these instructions if there are uncommitted changes in the Electron repo after any fixes are made during Phase Two that result a target that was failing, successfully building.
|
||||
|
||||
Ignore other instructions about making commit messages, our guidelines are CRITICALLY IMPORTANT and must be followed.
|
||||
|
||||
## Two Commit Types
|
||||
|
||||
### For Electron Source Changes (shell/, electron/, etc.)
|
||||
|
||||
```
|
||||
{CL-Number}: {concise description of API change}
|
||||
|
||||
{Brief explanation of what upstream changed and how Electron was adapted}
|
||||
|
||||
Ref: {Chromium CL link}
|
||||
```
|
||||
|
||||
IMPORTANT: Ensure that any change made to electron as a result of a change in Chromium is committed individually. Each change should have it's own commit message and it's own REF. Logically grouped into commits that make sense rather than one giant commit.
|
||||
|
||||
IMPORTANT: Try really hard to find the CL reference per the instructions below. Each change you made should in theory have been in response to a change made in Chromium that you identified or can identify. Try for a while to identify and include the ref in the commit message. Do not give up easily.
|
||||
|
||||
You may include multiple "Ref" links if required.
|
||||
|
||||
For a CL link in the format `https://chromium-review.googlesource.com/c/chromium/src/+/2958369` the "CL-Number" is `2958369`
|
||||
|
||||
### For Patch Updates (patches/chromium/*.patch)
|
||||
|
||||
Use the same fixup workflow as Phase One:
|
||||
1. Fix in Chromium source tree
|
||||
2. Fixup commit + rebase
|
||||
3. Export with `e patches chromium`
|
||||
4. Commit the patch file:
|
||||
|
||||
```
|
||||
fix(patch-update): {concise description}
|
||||
|
||||
{Brief explanation}
|
||||
|
||||
Ref: {Chromium CL link}
|
||||
```
|
||||
|
||||
## Dependent Patch Header Updates
|
||||
|
||||
After any patch modification, check for other affected patches:
|
||||
|
||||
```bash
|
||||
git status
|
||||
# If other .patch files show as modified with only hunk header changes:
|
||||
git add patches/
|
||||
git commit -m "chore: update patch hunk headers"
|
||||
```
|
||||
|
||||
## Finding CL References
|
||||
|
||||
Use git log or git blame on Chromium source files. Look for:
|
||||
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/XXXXXXX
|
||||
|
||||
If no CL found after searching: Ref: Unable to locate CL
|
||||
|
||||
## Example Commits
|
||||
|
||||
### Electron Source Fix
|
||||
|
||||
fix: update GetPlugins to GetPluginsAsync for API change
|
||||
|
||||
The upstream Chromium API changed:
|
||||
- Old: GetPlugins(callback) - took a callback
|
||||
- New: GetPluginsAsync(callback) - async version takes a callback
|
||||
|
||||
Ref: https://chromium-review.googlesource.com/c/chromium/src/+/1234567
|
||||
|
||||
### Patch Fix
|
||||
|
||||
fix(patch-conflict): update picture-in-picture for gesture handling refactor
|
||||
|
||||
Upstream added new gesture handling code that accesses live caption dialog.
|
||||
The live caption functionality is disabled in Electron's patch, so wrapped
|
||||
the new code in #if 0 guards to match existing pattern.
|
||||
|
||||
Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7654321
|
||||
@@ -2,7 +2,7 @@ version: '3'
|
||||
|
||||
services:
|
||||
buildtools:
|
||||
image: ghcr.io/electron/devcontainer:933c7d6ff6802706875270bec2e3c891cf8add3f
|
||||
image: ghcr.io/electron/devcontainer:a82b87d7a4f5ff0cab61405f8151ac4cf4942aeb
|
||||
|
||||
volumes:
|
||||
- ..:/workspaces/gclient/src/electron:cached
|
||||
|
||||
@@ -48,7 +48,8 @@ if [ ! -f $buildtools/configs/evm.testing.json ]; then
|
||||
\"gen\": {
|
||||
\"args\": [
|
||||
\"import(\\\"//electron/build/args/testing.gn\\\")\",
|
||||
\"use_remoteexec = true\"
|
||||
\"use_remoteexec = true\",
|
||||
\"use_siso=true\"
|
||||
],
|
||||
\"out\": \"Testing\"
|
||||
},
|
||||
@@ -58,7 +59,7 @@ if [ ! -f $buildtools/configs/evm.testing.json ]; then
|
||||
},
|
||||
\"\$schema\": \"file:///home/builduser/.electron_build_tools/evm-config.schema.json\",
|
||||
\"configValidationLevel\": \"strict\",
|
||||
\"remoteBuild\": \"reclient\",
|
||||
\"remoteBuild\": \"siso\",
|
||||
\"preserveSDK\": 5
|
||||
}
|
||||
" >$buildtools/configs/evm.testing.json
|
||||
|
||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -10,7 +10,7 @@ Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.
|
||||
#### Checklist
|
||||
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->
|
||||
|
||||
- [ ] PR description included and stakeholders cc'd
|
||||
- [ ] PR description included
|
||||
- [ ] `npm test` passes
|
||||
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
|
||||
- [ ] relevant API documentation, tutorials, and examples are updated and follow the [documentation style guide](https://github.com/electron/electron/blob/main/docs/development/style-guide.md)
|
||||
|
||||
35
.github/actions/build-electron/action.yml
vendored
35
.github/actions/build-electron/action.yml
vendored
@@ -37,9 +37,9 @@ runs:
|
||||
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
|
||||
- name: Set GN_EXTRA_ARGS for Windows
|
||||
shell: bash
|
||||
if: ${{inputs.target-arch != 'x64' && inputs.target-platform == 'win' }}
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
run: |
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"${{ inputs.target-arch }}\""
|
||||
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"${{ inputs.target-arch }}\" use_v8_context_snapshot=true target_os=\"win\""
|
||||
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
|
||||
- name: Add Clang problem matcher
|
||||
shell: bash
|
||||
@@ -102,15 +102,7 @@ runs:
|
||||
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
|
||||
sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
|
||||
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
cd out/Default
|
||||
powershell Compress-Archive -update mksnapshot_args mksnapshot.zip
|
||||
powershell mkdir mktmp\\gen\\v8
|
||||
powershell Copy-Item gen\\v8\\embedded.S mktmp\\gen\\v8
|
||||
powershell Compress-Archive -update -Path mktmp\\gen mksnapshot.zip
|
||||
else
|
||||
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
|
||||
fi
|
||||
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
|
||||
- name: Generate Cross-Arch Snapshot (arm/arm64) ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
if: ${{ (inputs.target-arch == 'arm' || inputs.target-arch == 'arm64') && inputs.target-platform == 'linux' }}
|
||||
@@ -144,12 +136,6 @@ runs:
|
||||
fi
|
||||
electron/script/zip_manifests/check-zip-manifest.py out/Default/chromedriver.zip electron/script/zip_manifests/chromedriver_zip.$target_os.${{ inputs.target-arch }}.manifest
|
||||
fi
|
||||
- name: Create installed_software.json ${{ inputs.step-suffix }}
|
||||
shell: powershell
|
||||
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
|
||||
run: |
|
||||
cd src
|
||||
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
|
||||
- name: Profile Windows Toolchain ${{ inputs.step-suffix }}
|
||||
shell: bash
|
||||
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
|
||||
@@ -188,7 +174,7 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd src/electron
|
||||
node script/yarn create-typescript-definitions
|
||||
node script/yarn.js create-typescript-definitions
|
||||
- name: Publish Electron Dist ${{ inputs.step-suffix }}
|
||||
if: ${{ inputs.is-release == 'true' }}
|
||||
shell: bash
|
||||
@@ -203,7 +189,7 @@ runs:
|
||||
script/release/uploaders/upload.py --verbose
|
||||
fi
|
||||
- name: Generate siso report
|
||||
if: ${{ inputs.target-platform != 'win' && !cancelled() }}
|
||||
if: ${{ !cancelled() }}
|
||||
shell: bash
|
||||
run: |
|
||||
cd src
|
||||
@@ -212,17 +198,6 @@ runs:
|
||||
echo "SISO_REPORT_PATH=$SISO_REPORT_PATH" >> $GITHUB_ENV
|
||||
cat siso_report.txt
|
||||
echo "SISO REPORT AT $SISO_REPORT_PATH"
|
||||
- name: Generate siso report (Windows)
|
||||
if: ${{ inputs.target-platform == 'win' && !cancelled() }}
|
||||
shell: powershell
|
||||
run: |
|
||||
cd src
|
||||
e d siso report -C out\Default > siso_report.txt
|
||||
$SISO_REPORT_PATH = Get-Content "siso_report.txt" | Select-String "report file:\s*(.+)" | ForEach-Object {
|
||||
$_.Matches.Groups[1].Value.Trim()
|
||||
}
|
||||
echo "SISO_REPORT_PATH=$SISO_REPORT_PATH"
|
||||
echo "SISO_REPORT_PATH=$SISO_REPORT_PATH" >> $env:GITHUB_ENV
|
||||
- name: Generate Artifact Key
|
||||
if: always() && !cancelled()
|
||||
shell: bash
|
||||
|
||||
5
.github/actions/checkout/action.yml
vendored
5
.github/actions/checkout/action.yml
vendored
@@ -143,16 +143,17 @@ runs:
|
||||
echo "No changes to patches detected"
|
||||
fi
|
||||
fi
|
||||
- name: Remove patch conflict problem matcher
|
||||
- name: Remove patch conflict problem matchers
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::remove-matcher owner=merge-conflict::"
|
||||
echo "::remove-matcher owner=patch-conflict::"
|
||||
echo "::remove-matcher owner=patch-needs-update::"
|
||||
- name: Upload patches stats
|
||||
if: ${{ inputs.target-platform == 'linux' && github.ref == 'refs/heads/main' }}
|
||||
shell: bash
|
||||
run: |
|
||||
npx node src/electron/script/patches-stats.mjs --upload-stats || true
|
||||
node src/electron/script/patches-stats.mjs --upload-stats || true
|
||||
# delete all .git directories under src/ except for
|
||||
# third_party/angle/ and third_party/dawn/ because of build time generation of files
|
||||
# gen/angle/commit.h depends on third_party/angle/.git/HEAD
|
||||
|
||||
16
.github/actions/fix-sync/action.yml
vendored
16
.github/actions/fix-sync/action.yml
vendored
@@ -37,6 +37,22 @@ runs:
|
||||
installation-dir: third_party/esbuild
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
package: infra/3pp/tools/esbuild/${platform}
|
||||
- name: Fix rollup
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
uses: ./src/electron/.github/actions/cipd-install
|
||||
with:
|
||||
cipd-root-prefix-path: src/third_party/devtools-frontend/src/
|
||||
dependency: rollup_libs
|
||||
deps-file: src/third_party/devtools-frontend/src/DEPS
|
||||
installation-dir: third_party/rollup_libs
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
package: infra/3pp/tools/rollup_libs/${platform}
|
||||
- name: Sync native rollup libs
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
shell: bash
|
||||
run : |
|
||||
cd src/third_party/devtools-frontend/src
|
||||
python3 scripts/deps/sync_rollup_libs.py
|
||||
- name: Fix rustc
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
shell: bash
|
||||
|
||||
13
.github/actions/free-space-macos/action.yml
vendored
13
.github/actions/free-space-macos/action.yml
vendored
@@ -64,15 +64,26 @@ runs:
|
||||
sudo rm -rf /Applications/Xcode_16.1.app
|
||||
sudo rm -rf /Applications/Xcode_16.2.app
|
||||
sudo rm -rf /Applications/Xcode_16.3.app
|
||||
sudo rm -rf /Applications/Xcode_26*
|
||||
sudo rm -rf /Applications/Google Chrome.app
|
||||
sudo rm -rf /Applications/Google Chrome for Testing.app
|
||||
sudo rm -rf /Applications/Firefox.app
|
||||
sudo rm -rf /Applications/Firefox.app
|
||||
sudo rm -rf /Applications/Microsoft Edge.app
|
||||
sudo rm -rf ~/project/src/third_party/catapult/tracing/test_data
|
||||
sudo rm -rf ~/project/src/third_party/angle/third_party/VK-GL-CTS
|
||||
sudo rm -rf /Users/runner/Library/Android
|
||||
sudo rm -rf $JAVA_HOME_11_arm64
|
||||
sudo rm -rf $JAVA_HOME_17_arm64
|
||||
sudo rm -rf $JAVA_HOME_21_arm64
|
||||
sudo rm -rf $JAVA_HOME_25_arm64
|
||||
sudo rm -rf /Users/runner/.dotnet/
|
||||
sudo rm -rf /Users/runner/.rustup
|
||||
|
||||
# remove homebrew packages we don't need
|
||||
if command -v brew &> /dev/null; then
|
||||
brew uninstall -f --zap aws-sam-cli session-manager-plugin gcc gcc@13 gcc@14 llvm@18 gradle maven ant azure-cli
|
||||
brew autoremove
|
||||
fi
|
||||
|
||||
# lipo off some huge binaries arm64 versions to save space
|
||||
strip_universal_deep $(xcode-select -p)/../SharedFrameworks
|
||||
|
||||
14
.github/actions/generate-types/action.yml
vendored
14
.github/actions/generate-types/action.yml
vendored
@@ -13,12 +13,16 @@ runs:
|
||||
- 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
|
||||
export ELECTRON_DIR=$(pwd)
|
||||
if [ "${{ inputs.sha-file }}" == ".dig-old" ]; then
|
||||
cd /tmp
|
||||
git clone https://github.com/electron/electron.git
|
||||
cd electron
|
||||
fi
|
||||
git checkout $(cat $ELECTRON_DIR/${{ inputs.sha-file }})
|
||||
node script/yarn.js install --immutable
|
||||
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 .
|
||||
mv artifacts/electron.d.ts $ELECTRON_DIR/artifacts/${{ inputs.filename }}
|
||||
working-directory: ./electron
|
||||
|
||||
@@ -15,7 +15,7 @@ runs:
|
||||
git config --global core.preloadindex true
|
||||
git config --global core.longpaths true
|
||||
fi
|
||||
export BUILD_TOOLS_SHA=a5d9f9052dcc36ee88bef5c8b13acbefd87b7d8d
|
||||
export BUILD_TOOLS_SHA=4430e4a505e0f4fa2a41b707a10a36f780bbdd26
|
||||
npm i -g @electron/build-tools
|
||||
# Update depot_tools to ensure python
|
||||
e d update_depot_tools
|
||||
|
||||
14
.github/actions/install-dependencies/action.yml
vendored
14
.github/actions/install-dependencies/action.yml
vendored
@@ -6,7 +6,7 @@ runs:
|
||||
- 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
|
||||
run: echo "dir=$(node src/electron/script/yarn.js config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
||||
id: yarn-cache
|
||||
with:
|
||||
@@ -18,4 +18,14 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd src/electron
|
||||
node script/yarn install --frozen-lockfile --prefer-offline
|
||||
if [ "$TARGET_ARCH" = "x86" ]; then
|
||||
export npm_config_arch="ia32"
|
||||
fi
|
||||
# if running on linux arm skip yarn Builds
|
||||
ARCH=$(uname -m)
|
||||
if [ "$ARCH" = "armv7l" ]; then
|
||||
echo "Skipping yarn build on linux arm"
|
||||
node script/yarn.js install --immutable --mode=skip-build
|
||||
else
|
||||
node script/yarn.js install --immutable
|
||||
fi
|
||||
|
||||
10
.github/problem-matchers/patch-conflict.json
vendored
10
.github/problem-matchers/patch-conflict.json
vendored
@@ -19,6 +19,16 @@
|
||||
"line": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "patch-needs-update",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^((patches\/.*): needs update)$",
|
||||
"message": 1,
|
||||
"file": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
12
.github/workflows/archaeologist-dig.yml
vendored
12
.github/workflows/archaeologist-dig.yml
vendored
@@ -3,19 +3,23 @@ name: Archaeologist
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
archaeologist-dig:
|
||||
name: Archaeologist Dig
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Node.js/npm
|
||||
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238
|
||||
with:
|
||||
node-version: 20.19.x
|
||||
node-version: 24.12.x
|
||||
- name: Setting Up Dig Site
|
||||
run: |
|
||||
echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}"
|
||||
@@ -41,7 +45,7 @@ jobs:
|
||||
sha-file: .dig-old
|
||||
filename: electron.old.d.ts
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 #v5.0.0
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6.0.0
|
||||
with:
|
||||
name: artifacts
|
||||
path: electron/artifacts
|
||||
|
||||
15
.github/workflows/audit-branch-ci.yml
vendored
15
.github/workflows/audit-branch-ci.yml
vendored
@@ -16,15 +16,25 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||
with:
|
||||
node-version: 22.17.x
|
||||
- run: npm install @actions/cache@4.0.3 @electron/fiddle-core@2.0.1
|
||||
- name: Sparse checkout repository
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
sparse-checkout: |
|
||||
.
|
||||
.github
|
||||
.yarn
|
||||
- run: yarn workspaces focus @electron/gha-workflows
|
||||
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||
id: audit-errors
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const { chdir } = require('node:process');
|
||||
chdir('${{ github.workspace }}/.github/workflows');
|
||||
|
||||
const cache = require('@actions/cache');
|
||||
const { ElectronVersions } = require('@electron/fiddle-core');
|
||||
|
||||
@@ -74,6 +84,7 @@ jobs:
|
||||
!message.startsWith("Process completed with exit code") &&
|
||||
!message.startsWith("Response status code does not indicate success") &&
|
||||
!message.startsWith("The hosted runner lost communication with the server") &&
|
||||
!message.startsWith("Dependabot encountered an error performing the update") &&
|
||||
!/Unable to make request/.test(message) &&
|
||||
!/The requested URL returned error/.test(message),
|
||||
)
|
||||
|
||||
2
.github/workflows/branch-created.yml
vendored
2
.github/workflows/branch-created.yml
vendored
@@ -68,7 +68,7 @@ jobs:
|
||||
done
|
||||
- name: Generate GitHub App token
|
||||
if: ${{ steps.check-major-version.outputs.MAJOR }}
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
|
||||
|
||||
20
.github/workflows/build-git-cache.yml
vendored
20
.github/workflows/build-git-cache.yml
vendored
@@ -6,11 +6,15 @@ on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build-git-cache-linux:
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
image: ghcr.io/electron/build:a82b87d7a4f5ff0cab61405f8151ac4cf4942aeb
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
@@ -19,7 +23,7 @@ jobs:
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -30,8 +34,10 @@ jobs:
|
||||
|
||||
build-git-cache-windows:
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
image: ghcr.io/electron/build:a82b87d7a4f5ff0cab61405f8151ac4cf4942aeb
|
||||
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
|
||||
volumes:
|
||||
- /mnt/win-cache:/mnt/win-cache
|
||||
@@ -41,7 +47,7 @@ jobs:
|
||||
TARGET_OS: 'win'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -52,10 +58,12 @@ jobs:
|
||||
|
||||
build-git-cache-macos:
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
# This job updates the same git cache as linux, so it needs to run after the linux one.
|
||||
needs: build-git-cache-linux
|
||||
container:
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
image: ghcr.io/electron/build:a82b87d7a4f5ff0cab61405f8151ac4cf4942aeb
|
||||
options: --user root
|
||||
volumes:
|
||||
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
||||
@@ -64,7 +72,7 @@ jobs:
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
|
||||
56
.github/workflows/build.yml
vendored
56
.github/workflows/build.yml
vendored
@@ -6,17 +6,17 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: '933c7d6ff6802706875270bec2e3c891cf8add3f'
|
||||
default: 'a82b87d7a4f5ff0cab61405f8151ac4cf4942aeb'
|
||||
required: true
|
||||
skip-macos:
|
||||
type: boolean
|
||||
description: 'Skip macOS builds'
|
||||
default: false
|
||||
default: true
|
||||
required: false
|
||||
skip-linux:
|
||||
type: boolean
|
||||
description: 'Skip Linux builds'
|
||||
default: false
|
||||
default: true
|
||||
required: false
|
||||
skip-windows:
|
||||
type: boolean
|
||||
@@ -43,10 +43,13 @@ defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
outputs:
|
||||
docs: ${{ steps.filter.outputs.docs }}
|
||||
@@ -54,7 +57,7 @@ jobs:
|
||||
build-image-sha: ${{ steps.set-output.outputs.build-image-sha }}
|
||||
docs-only: ${{ steps.set-output.outputs.docs-only }}
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
@@ -63,13 +66,17 @@ jobs:
|
||||
filters: |
|
||||
docs:
|
||||
- 'docs/**'
|
||||
- README.md
|
||||
- SECURITY.md
|
||||
- CONTRIBUTING.md
|
||||
- CODE_OF_CONDUCT.md
|
||||
src:
|
||||
- '!docs/**'
|
||||
- name: Set Outputs for Build Image SHA & Docs Only
|
||||
id: set-output
|
||||
run: |
|
||||
if [ -z "${{ inputs.build-image-sha }}" ]; then
|
||||
echo "build-image-sha=933c7d6ff6802706875270bec2e3c891cf8add3f" >> "$GITHUB_OUTPUT"
|
||||
echo "build-image-sha=a82b87d7a4f5ff0cab61405f8151ac4cf4942aeb" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
@@ -80,6 +87,8 @@ jobs:
|
||||
needs: setup
|
||||
if: ${{ !inputs.skip-lint }}
|
||||
uses: ./.github/workflows/pipeline-electron-lint.yml
|
||||
permissions:
|
||||
contents: read
|
||||
with:
|
||||
container: '{"image":"ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}","options":"--user root"}'
|
||||
secrets: inherit
|
||||
@@ -89,6 +98,8 @@ jobs:
|
||||
needs: [setup, checkout-linux]
|
||||
if: ${{ needs.setup.outputs.docs-only == 'true' }}
|
||||
uses: ./.github/workflows/pipeline-electron-docs-only.yml
|
||||
permissions:
|
||||
contents: read
|
||||
with:
|
||||
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"]}'
|
||||
secrets: inherit
|
||||
@@ -96,8 +107,10 @@ jobs:
|
||||
# Checkout Jobs
|
||||
checkout-macos:
|
||||
needs: setup
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-macos}}
|
||||
if: ${{ needs.setup.outputs.src == 'true' && inputs.skip-macos == 'false'}}
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
options: --user root
|
||||
@@ -111,7 +124,7 @@ jobs:
|
||||
build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -124,8 +137,10 @@ jobs:
|
||||
|
||||
checkout-linux:
|
||||
needs: setup
|
||||
if: ${{ !inputs.skip-linux}}
|
||||
if: ${{ inputs.skip-linux == 'false' }}
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
options: --user root
|
||||
@@ -141,7 +156,7 @@ jobs:
|
||||
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -155,6 +170,8 @@ jobs:
|
||||
needs: setup
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
|
||||
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
|
||||
@@ -171,7 +188,7 @@ jobs:
|
||||
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -185,6 +202,8 @@ jobs:
|
||||
# GN Check Jobs
|
||||
macos-gn-check:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: checkout-macos
|
||||
with:
|
||||
target-platform: macos
|
||||
@@ -195,6 +214,8 @@ jobs:
|
||||
|
||||
linux-gn-check:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: checkout-linux
|
||||
if: ${{ needs.setup.outputs.src == 'true' }}
|
||||
with:
|
||||
@@ -207,6 +228,8 @@ jobs:
|
||||
|
||||
windows-gn-check:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: checkout-windows
|
||||
with:
|
||||
target-platform: win
|
||||
@@ -310,7 +333,7 @@ jobs:
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
test-runs-on: electron-arc-centralus-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"]}'
|
||||
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 --memory=12g","volumes":["/home/runner/externals:/mnt/runner-externals"]}'
|
||||
target-platform: linux
|
||||
target-arch: arm
|
||||
is-release: false
|
||||
@@ -349,8 +372,9 @@ jobs:
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
test-runs-on: windows-latest
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
|
||||
target-platform: win
|
||||
target-arch: x64
|
||||
is-release: false
|
||||
@@ -368,8 +392,9 @@ jobs:
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
test-runs-on: windows-latest
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
|
||||
target-platform: win
|
||||
target-arch: x86
|
||||
is-release: false
|
||||
@@ -387,8 +412,9 @@ jobs:
|
||||
needs: checkout-windows
|
||||
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
|
||||
with:
|
||||
build-runs-on: electron-arc-centralus-windows-amd64-16core
|
||||
build-runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
test-runs-on: windows-11-arm
|
||||
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
|
||||
target-platform: win
|
||||
target-arch: arm64
|
||||
is-release: false
|
||||
@@ -400,6 +426,8 @@ jobs:
|
||||
gha-done:
|
||||
name: GitHub Actions Completed
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
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:
|
||||
|
||||
10
.github/workflows/clean-src-cache.yml
vendored
10
.github/workflows/clean-src-cache.yml
vendored
@@ -1,16 +1,20 @@
|
||||
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.
|
||||
# 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 * * *"
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
clean-src-cache:
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
|
||||
options: --user root
|
||||
|
||||
2
.github/workflows/issue-commented.yml
vendored
2
.github/workflows/issue-commented.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
AUTHOR_ASSOCIATION=$(gh api /repos/electron/electron/issues/comments/${{ github.event.comment.id }} --jq '.author_association')
|
||||
echo "author_association=$AUTHOR_ASSOCIATION" >> "$GITHUB_OUTPUT"
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
if: ${{ !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR"]'), steps.get-author-association.outputs.author_association) }}
|
||||
id: generate-token
|
||||
with:
|
||||
|
||||
15
.github/workflows/issue-labeled.yml
vendored
15
.github/workflows/issue-labeled.yml
vendored
@@ -4,17 +4,18 @@ on:
|
||||
issues:
|
||||
types: [labeled]
|
||||
|
||||
permissions: # added using https://github.com/step-security/secure-workflows
|
||||
contents: read
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
issue-labeled-with-status:
|
||||
name: status/{confirmed,reviewed} label added
|
||||
if: github.event.label.name == 'status/confirmed' || github.event.label.name == 'status/reviewed'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
@@ -31,9 +32,11 @@ jobs:
|
||||
name: blocked/* label added
|
||||
if: startsWith(github.event.label.name, 'blocked/')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
@@ -66,13 +69,13 @@ jobs:
|
||||
fi
|
||||
- name: Generate GitHub App token
|
||||
if: ${{ steps.check-for-comment.outputs.SHOULD_COMMENT }}
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
- name: Create comment
|
||||
if: ${{ steps.check-for-comment.outputs.SHOULD_COMMENT }}
|
||||
uses: actions-cool/issues-helper@50068f49b7b2b3857270ead65e2d02e4459b022c # v3.6.2
|
||||
uses: actions-cool/issues-helper@e2ff99831a4f13625d35064e2b3dfe65c07a0396 # v3.7.5
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
|
||||
28
.github/workflows/issue-opened.yml
vendored
28
.github/workflows/issue-opened.yml
vendored
@@ -11,9 +11,10 @@ jobs:
|
||||
add-to-issue-triage:
|
||||
if: ${{ contains(github.event.issue.labels.*.name, 'bug :beetle:') }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
@@ -28,14 +29,22 @@ jobs:
|
||||
set-labels:
|
||||
if: ${{ contains(github.event.issue.labels.*.name, 'bug :beetle:') }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
org: electron
|
||||
- run: npm install @electron/fiddle-core@1.3.3 mdast-util-from-markdown@2.0.0 unist-util-select@5.1.0 semver@7.6.0
|
||||
- name: Sparse checkout repository
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
sparse-checkout: |
|
||||
.
|
||||
.github
|
||||
.yarn
|
||||
- run: yarn workspaces focus @electron/gha-workflows
|
||||
- name: Add labels
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||
id: add-labels
|
||||
@@ -44,9 +53,13 @@ jobs:
|
||||
with:
|
||||
github-token: ${{ steps.generate-token.outputs.token }}
|
||||
script: |
|
||||
const { fromMarkdown } = await import('${{ github.workspace }}/node_modules/mdast-util-from-markdown/index.js');
|
||||
const { select } = await import('${{ github.workspace }}/node_modules/unist-util-select/index.js');
|
||||
const semver = await import('${{ github.workspace }}/node_modules/semver/index.js');
|
||||
const { chdir } = require('node:process');
|
||||
chdir('${{ github.workspace }}/.github/workflows');
|
||||
|
||||
const { ElectronVersions } = require('@electron/fiddle-core');
|
||||
const { fromMarkdown } = require('mdast-util-from-markdown');
|
||||
const { select } = require('unist-util-select');
|
||||
const semver = require('semver');
|
||||
|
||||
const [ owner, repo ] = '${{ github.repository }}'.split('/');
|
||||
const issue_number = ${{ github.event.issue.number }};
|
||||
@@ -77,7 +90,6 @@ jobs:
|
||||
labelExists = true;
|
||||
} catch {}
|
||||
|
||||
const { ElectronVersions } = await import('${{ github.workspace }}/node_modules/@electron/fiddle-core/dist/index.js');
|
||||
const electronVersions = await ElectronVersions.create(undefined, { ignoreCache: true });
|
||||
const validVersions = [...electronVersions.supportedMajors, ...electronVersions.prereleaseMajors];
|
||||
|
||||
@@ -134,7 +146,7 @@ jobs:
|
||||
}
|
||||
- name: Create unsupported major comment
|
||||
if: ${{ steps.add-labels.outputs.unsupportedMajor }}
|
||||
uses: actions-cool/issues-helper@50068f49b7b2b3857270ead65e2d02e4459b022c # v3.6.2
|
||||
uses: actions-cool/issues-helper@e2ff99831a4f13625d35064e2b3dfe65c07a0396 # v3.7.5
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
|
||||
3
.github/workflows/issue-transferred.yml
vendored
3
.github/workflows/issue-transferred.yml
vendored
@@ -10,10 +10,11 @@ jobs:
|
||||
issue-transferred:
|
||||
name: Issue Transferred
|
||||
runs-on: ubuntu-latest
|
||||
permissions: {}
|
||||
if: ${{ !github.event.changes.new_repository.private }}
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
|
||||
7
.github/workflows/issue-unlabeled.yml
vendored
7
.github/workflows/issue-unlabeled.yml
vendored
@@ -4,14 +4,15 @@ on:
|
||||
issues:
|
||||
types: [unlabeled]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
issue-unlabeled-blocked:
|
||||
name: All blocked/* labels removed
|
||||
if: startsWith(github.event.label.name, 'blocked/') && github.event.issue.state == 'open'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Check for any blocked labels
|
||||
id: check-for-blocked-labels
|
||||
@@ -23,7 +24,7 @@ jobs:
|
||||
fi
|
||||
- name: Generate GitHub App token
|
||||
if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }}
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
|
||||
14
.github/workflows/linux-publish.yml
vendored
14
.github/workflows/linux-publish.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: '933c7d6ff6802706875270bec2e3c891cf8add3f'
|
||||
default: 'a82b87d7a4f5ff0cab61405f8151ac4cf4942aeb'
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
required: false
|
||||
@@ -17,9 +17,13 @@ on:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
checkout-linux:
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
|
||||
options: --user root
|
||||
@@ -31,7 +35,7 @@ jobs:
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -40,6 +44,8 @@ jobs:
|
||||
|
||||
publish-x64:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: checkout-linux
|
||||
with:
|
||||
environment: production-release
|
||||
@@ -55,6 +61,8 @@ jobs:
|
||||
|
||||
publish-arm:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: checkout-linux
|
||||
with:
|
||||
environment: production-release
|
||||
@@ -70,6 +78,8 @@ jobs:
|
||||
|
||||
publish-arm64:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: checkout-linux
|
||||
with:
|
||||
environment: production-release
|
||||
|
||||
104
.github/workflows/macos-disk-cleanup.yml
vendored
Normal file
104
.github/workflows/macos-disk-cleanup.yml
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
name: macOS Disk Space Cleanup
|
||||
|
||||
# Description:
|
||||
# This workflow runs the disk space reclaimer on macOS runners every night
|
||||
# and logs disk space metrics to Datadog for monitoring.
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
macos-disk-cleanup:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
runner:
|
||||
- macos-15
|
||||
- macos-15-large
|
||||
- macos-15-xlarge
|
||||
runs-on: ${{ matrix.runner }}
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
sparse-checkout: |
|
||||
.github/actions/free-space-macos
|
||||
sparse-checkout-cone-mode: false
|
||||
|
||||
- name: Get Disk Space Before Cleanup
|
||||
id: disk-before
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Disk space before cleanup:"
|
||||
df -h /
|
||||
FREE_SPACE_BEFORE=$(df -k / | tail -1 | awk '{print $4}')
|
||||
echo "free_kb=$FREE_SPACE_BEFORE" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Free Space on macOS
|
||||
uses: ./.github/actions/free-space-macos
|
||||
|
||||
- name: Get Disk Space After Cleanup
|
||||
id: disk-after
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Disk space after cleanup:"
|
||||
df -h /
|
||||
FREE_SPACE_AFTER=$(df -k / | tail -1 | awk '{print $4}')
|
||||
echo "free_kb=$FREE_SPACE_AFTER" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Log Disk Space to Datadog
|
||||
if: ${{ env.DD_API_KEY != '' }}
|
||||
shell: bash
|
||||
env:
|
||||
DD_API_KEY: ${{ secrets.DD_API_KEY }}
|
||||
FREE_BEFORE: ${{ steps.disk-before.outputs.free_kb }}
|
||||
FREE_AFTER: ${{ steps.disk-after.outputs.free_kb }}
|
||||
MATRIX_RUNNER: ${{ matrix.runner }}
|
||||
run: |
|
||||
TIMESTAMP=$(date +%s)
|
||||
FREE_BEFORE_GB=$(echo "scale=2; $FREE_BEFORE / 1024 / 1024" | bc)
|
||||
FREE_AFTER_GB=$(echo "scale=2; $FREE_AFTER / 1024 / 1024" | bc)
|
||||
SPACE_FREED_GB=$(echo "scale=2; ($FREE_AFTER - $FREE_BEFORE) / 1024 / 1024" | bc)
|
||||
|
||||
echo "Free space before: ${FREE_BEFORE_GB}GB"
|
||||
echo "Free space after: ${FREE_AFTER_GB}GB"
|
||||
echo "Space freed: ${SPACE_FREED_GB}GB"
|
||||
|
||||
curl -s -X POST "https://api.datadoghq.com/api/v2/series" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "DD-API-KEY: ${DD_API_KEY}" \
|
||||
-d @- << EOF
|
||||
{
|
||||
"series": [
|
||||
{
|
||||
"metric": "electron.macos.disk.free_space_before_cleanup_gb",
|
||||
"points": [{"timestamp": ${TIMESTAMP}, "value": ${FREE_BEFORE_GB}}],
|
||||
"type": 3,
|
||||
"unit": "gigabyte",
|
||||
"tags": ["runner:${MATRIX_RUNNER}", "platform:macos"]
|
||||
},
|
||||
{
|
||||
"metric": "electron.macos.disk.free_space_after_cleanup_gb",
|
||||
"points": [{"timestamp": ${TIMESTAMP}, "value": ${FREE_AFTER_GB}}],
|
||||
"type": 3,
|
||||
"unit": "gigabyte",
|
||||
"tags": ["runner:${MATRIX_RUNNER}", "platform:macos"]
|
||||
},
|
||||
{
|
||||
"metric": "electron.macos.disk.space_freed_gb",
|
||||
"points": [{"timestamp": ${TIMESTAMP}, "value": ${SPACE_FREED_GB}}],
|
||||
"type": 3,
|
||||
"unit": "gigabyte",
|
||||
"tags": ["runner:${MATRIX_RUNNER}", "platform:macos"]
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "Disk space metrics logged to Datadog"
|
||||
16
.github/workflows/macos-publish.yml
vendored
16
.github/workflows/macos-publish.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: '933c7d6ff6802706875270bec2e3c891cf8add3f'
|
||||
default: 'a82b87d7a4f5ff0cab61405f8151ac4cf4942aeb'
|
||||
required: true
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
@@ -18,9 +18,13 @@ on:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
checkout-macos:
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
|
||||
options: --user root
|
||||
@@ -32,7 +36,7 @@ jobs:
|
||||
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -44,6 +48,8 @@ jobs:
|
||||
|
||||
publish-x64-darwin:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: checkout-macos
|
||||
with:
|
||||
environment: production-release
|
||||
@@ -59,6 +65,8 @@ jobs:
|
||||
|
||||
publish-x64-mas:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: checkout-macos
|
||||
with:
|
||||
environment: production-release
|
||||
@@ -74,6 +82,8 @@ jobs:
|
||||
|
||||
publish-arm64-darwin:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: checkout-macos
|
||||
with:
|
||||
environment: production-release
|
||||
@@ -89,6 +99,8 @@ jobs:
|
||||
|
||||
publish-arm64-mas:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: checkout-macos
|
||||
with:
|
||||
environment: production-release
|
||||
|
||||
@@ -7,6 +7,8 @@ on:
|
||||
- 'spec/yarn.lock'
|
||||
- '.github/workflows/**'
|
||||
- '.github/actions/**'
|
||||
- '.yarn/**'
|
||||
- '.yarnrc.yml'
|
||||
|
||||
permissions: {}
|
||||
|
||||
|
||||
13
.github/workflows/package.json
vendored
Normal file
13
.github/workflows/package.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "@electron/gha-workflows",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^4.0.3",
|
||||
"@electron/fiddle-core": "^2.0.1",
|
||||
"mdast-util-from-markdown": "^2.0.0",
|
||||
"semver": "^7.7.2",
|
||||
"unist-util-select": "^5.1.0"
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,8 @@ on:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
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_protected != true }}
|
||||
@@ -62,6 +64,8 @@ concurrency:
|
||||
jobs:
|
||||
build:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
permissions:
|
||||
contents: read
|
||||
with:
|
||||
build-runs-on: ${{ inputs.build-runs-on }}
|
||||
build-container: ${{ inputs.build-container }}
|
||||
@@ -74,6 +78,10 @@ jobs:
|
||||
secrets: inherit
|
||||
test:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-test.yml
|
||||
permissions:
|
||||
contents: read
|
||||
issues: read
|
||||
pull-requests: read
|
||||
needs: build
|
||||
with:
|
||||
target-arch: ${{ inputs.target-arch }}
|
||||
@@ -83,6 +91,8 @@ jobs:
|
||||
secrets: inherit
|
||||
nn-test:
|
||||
uses: ./.github/workflows/pipeline-segment-node-nan-test.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: build
|
||||
with:
|
||||
target-arch: ${{ inputs.target-arch }}
|
||||
|
||||
@@ -64,14 +64,13 @@ concurrency:
|
||||
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_protected != true }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: read
|
||||
pull-requests: read
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
permissions:
|
||||
contents: read
|
||||
with:
|
||||
build-runs-on: ${{ inputs.build-runs-on }}
|
||||
build-container: ${{ inputs.build-container }}
|
||||
@@ -86,6 +85,10 @@ jobs:
|
||||
secrets: inherit
|
||||
test:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-test.yml
|
||||
permissions:
|
||||
contents: read
|
||||
issues: read
|
||||
pull-requests: read
|
||||
needs: build
|
||||
with:
|
||||
target-arch: ${{ inputs.target-arch }}
|
||||
|
||||
@@ -8,6 +8,8 @@ on:
|
||||
description: 'Container to run the docs-only ts compile in'
|
||||
type: string
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: electron-docs-only-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
@@ -19,11 +21,13 @@ jobs:
|
||||
docs-only:
|
||||
name: Docs Only Compile
|
||||
runs-on: electron-arc-centralus-linux-amd64-4core
|
||||
permissions:
|
||||
contents: read
|
||||
timeout-minutes: 20
|
||||
container: ${{ fromJSON(inputs.container) }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -39,7 +43,7 @@ jobs:
|
||||
with:
|
||||
target-platform: linux
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -50,12 +54,12 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd src/electron
|
||||
node script/yarn create-typescript-definitions
|
||||
node script/yarn tsc -p tsconfig.default_app.json --noEmit
|
||||
node script/yarn.js create-typescript-definitions
|
||||
node script/yarn.js tsc -p tsconfig.default_app.json --noEmit
|
||||
for f in build/webpack/*.js
|
||||
do
|
||||
out="${f:29}"
|
||||
if [ "$out" != "base.js" ]; then
|
||||
node script/yarn webpack --config $f --output-filename=$out --output-path=./.tmp --env mode=development
|
||||
node script/yarn.js webpack --config $f --output-filename=$out --output-path=./.tmp --env mode=development
|
||||
fi
|
||||
done
|
||||
|
||||
12
.github/workflows/pipeline-electron-lint.yml
vendored
12
.github/workflows/pipeline-electron-lint.yml
vendored
@@ -8,6 +8,8 @@ on:
|
||||
description: 'Container to run lint in'
|
||||
type: string
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: electron-lint-${{ github.ref_protected == true && github.run_id || github.ref }}
|
||||
cancel-in-progress: ${{ github.ref_protected != true }}
|
||||
@@ -19,11 +21,13 @@ jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: electron-arc-centralus-linux-amd64-4core
|
||||
permissions:
|
||||
contents: read
|
||||
timeout-minutes: 20
|
||||
container: ${{ fromJSON(inputs.container) }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -74,11 +78,11 @@ jobs:
|
||||
# but then we would lint its contents (at least gn format), and it doesn't pass it.
|
||||
|
||||
cd src/electron
|
||||
node script/yarn install --frozen-lockfile
|
||||
node script/yarn lint
|
||||
node script/yarn.js install --immutable
|
||||
node script/yarn.js lint
|
||||
- name: Run Script Typechecker
|
||||
shell: bash
|
||||
run: |
|
||||
cd src/electron
|
||||
node script/yarn tsc -p tsconfig.script.json
|
||||
node script/yarn.js tsc -p tsconfig.script.json
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ on:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
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_protected != true }}
|
||||
@@ -81,6 +83,8 @@ jobs:
|
||||
run:
|
||||
shell: bash
|
||||
runs-on: ${{ inputs.build-runs-on }}
|
||||
permissions:
|
||||
contents: read
|
||||
container: ${{ fromJSON(inputs.build-container) }}
|
||||
environment: ${{ inputs.environment }}
|
||||
env:
|
||||
@@ -91,7 +95,7 @@ jobs:
|
||||
run: |
|
||||
mkdir src
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -115,9 +119,9 @@ jobs:
|
||||
run: df -h
|
||||
- name: Setup Node.js/npm
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238
|
||||
with:
|
||||
node-version: 20.19.x
|
||||
node-version: 22.21.x
|
||||
cache: yarn
|
||||
cache-dependency-path: src/electron/yarn.lock
|
||||
- name: Install Dependencies
|
||||
@@ -125,6 +129,10 @@ jobs:
|
||||
- name: Install AZCopy
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: brew install azcopy
|
||||
- name: Enable windows toolchain
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
run: |
|
||||
echo "ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN=1" >> $GITHUB_ENV
|
||||
- name: Set GN_EXTRA_ARGS for Linux
|
||||
if: ${{ inputs.target-platform == 'linux' }}
|
||||
run: |
|
||||
@@ -151,21 +159,23 @@ jobs:
|
||||
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
|
||||
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
|
||||
- name: Restore src cache via AZCopy
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/restore-cache-azcopy
|
||||
with:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
- name: Restore src cache via AKS
|
||||
if: ${{ inputs.target-platform == 'linux' }}
|
||||
if: ${{ inputs.target-platform != 'macos' }}
|
||||
uses: ./src/electron/.github/actions/restore-cache-aks
|
||||
with:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Fix Sync
|
||||
if: ${{ inputs.target-platform != 'linux' }}
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
uses: ./src/electron/.github/actions/fix-sync
|
||||
with:
|
||||
target-platform: ${{ inputs.target-platform }}
|
||||
@@ -174,9 +184,21 @@ jobs:
|
||||
- name: Init Build Tools
|
||||
run: |
|
||||
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} --remote-build siso
|
||||
e sanitize-config
|
||||
- name: Run Electron Only Hooks
|
||||
run: |
|
||||
e d gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
rm -rf src/third_party/depot_tools/win_toolchain/vs_files*
|
||||
fi
|
||||
echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
echo "target_os=['win']" >> tmpgclient
|
||||
fi
|
||||
gclient runhooks --gclientfile=tmpgclient
|
||||
# Fix VS Toolchain
|
||||
if [ "${{ inputs.target-platform }}" = "win" ]; then
|
||||
e d python3 src/build/vs_toolchain.py update --force
|
||||
fi
|
||||
- name: Regenerate DEPS Hash
|
||||
run: |
|
||||
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js
|
||||
@@ -214,3 +236,11 @@ jobs:
|
||||
generate-symbols: '${{ inputs.generate-symbols }}'
|
||||
upload-to-storage: '${{ inputs.upload-to-storage }}'
|
||||
step-suffix: '(mas)'
|
||||
- name: Wait for active SSH sessions
|
||||
shell: bash
|
||||
if: always() && !cancelled()
|
||||
run: |
|
||||
while [ -f /var/.ssh-lock ]
|
||||
do
|
||||
sleep 60
|
||||
done
|
||||
|
||||
@@ -26,6 +26,8 @@ on:
|
||||
type: string
|
||||
default: testing
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: electron-gn-check-${{ inputs.target-platform }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
@@ -41,10 +43,12 @@ jobs:
|
||||
run:
|
||||
shell: bash
|
||||
runs-on: ${{ inputs.check-runs-on }}
|
||||
permissions:
|
||||
contents: read
|
||||
container: ${{ fromJSON(inputs.check-container) }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -111,7 +115,7 @@ jobs:
|
||||
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
|
||||
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -35,10 +35,7 @@ concurrency:
|
||||
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_protected != true }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: read
|
||||
pull-requests: read
|
||||
permissions: {}
|
||||
|
||||
env:
|
||||
CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
|
||||
@@ -53,6 +50,10 @@ jobs:
|
||||
run:
|
||||
shell: bash
|
||||
runs-on: ${{ inputs.test-runs-on }}
|
||||
permissions:
|
||||
contents: read
|
||||
issues: read
|
||||
pull-requests: read
|
||||
container: ${{ fromJSON(inputs.test-container) }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -71,9 +72,9 @@ jobs:
|
||||
cp $(which node) /mnt/runner-externals/node24/bin/
|
||||
- name: Setup Node.js/npm
|
||||
if: ${{ inputs.target-platform == 'win' }}
|
||||
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238
|
||||
with:
|
||||
node-version: 20.19.x
|
||||
node-version: 22.21.x
|
||||
- name: Add TCC permissions on macOS
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: |
|
||||
@@ -118,7 +119,7 @@ jobs:
|
||||
if: ${{ inputs.target-platform == 'macos' }}
|
||||
run: sudo xcode-select --switch /Applications/Xcode_16.4.app
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -167,12 +168,12 @@ jobs:
|
||||
echo "DISABLE_CRASH_REPORTER_TESTS=true" >> $GITHUB_ENV
|
||||
echo "IS_ASAN=true" >> $GITHUB_ENV
|
||||
- name: Download Generated Artifacts
|
||||
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
|
||||
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
|
||||
with:
|
||||
name: generated_artifacts_${{ env.ARTIFACT_KEY }}
|
||||
path: ./generated_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
|
||||
- name: Download Src Artifacts
|
||||
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
|
||||
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
|
||||
with:
|
||||
name: src_artifacts_${{ env.ARTIFACT_KEY }}
|
||||
path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
|
||||
@@ -196,10 +197,7 @@ jobs:
|
||||
# sudo security authorizationdb write com.apple.trust-settings.admin allow
|
||||
# cd src/electron
|
||||
# ./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
|
||||
shell: bash
|
||||
env:
|
||||
@@ -225,7 +223,7 @@ jobs:
|
||||
export ELECTRON_FORCE_TEST_SUITE_EXIT="true"
|
||||
fi
|
||||
fi
|
||||
node script/yarn test --runners=main --enableRerun=3 --trace-uncaught --enable-logging --files $tests_files
|
||||
node script/yarn.js test --runners=main --enableRerun=3 --trace-uncaught --enable-logging --files $tests_files
|
||||
else
|
||||
chown :builduser .. && chmod g+w ..
|
||||
chown -R :builduser . && chmod -R g+w .
|
||||
@@ -242,9 +240,14 @@ jobs:
|
||||
export MOCHA_TIMEOUT=180000
|
||||
echo "Piping output to ASAN_SYMBOLIZE ($ASAN_SYMBOLIZE)"
|
||||
cd electron
|
||||
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files | $ASAN_SYMBOLIZE
|
||||
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn.js test --runners=main --trace-uncaught --enable-logging --files $tests_files | $ASAN_SYMBOLIZE
|
||||
else
|
||||
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
|
||||
if [ "${{ inputs.target-arch }}" = "arm" ]; then
|
||||
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn.js test --skipYarnInstall --runners=main --enableRerun=3 --trace-uncaught --enable-logging --files $tests_files
|
||||
else
|
||||
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn.js test --runners=main --enableRerun=3 --trace-uncaught --enable-logging --files $tests_files
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
- name: Upload Test results to Datadog
|
||||
@@ -256,13 +259,14 @@ jobs:
|
||||
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
|
||||
cd src/electron
|
||||
export DATADOG_PATH=`node script/yarn.js bin datadog-ci`
|
||||
$DATADOG_PATH junit upload junit/test-results-main.xml
|
||||
fi
|
||||
if: always() && !cancelled()
|
||||
- name: Upload Test Artifacts
|
||||
if: always() && !cancelled()
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
|
||||
with:
|
||||
name: test_artifacts_${{ env.ARTIFACT_KEY }}_${{ matrix.shard }}
|
||||
path: src/electron/spec/artifacts
|
||||
|
||||
@@ -26,6 +26,8 @@ on:
|
||||
type: string
|
||||
default: testing
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
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_protected != true }}
|
||||
@@ -39,6 +41,8 @@ jobs:
|
||||
node-tests:
|
||||
name: Run Node.js Tests
|
||||
runs-on: electron-arc-centralus-linux-amd64-8core
|
||||
permissions:
|
||||
contents: read
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
||||
@@ -46,7 +50,7 @@ jobs:
|
||||
container: ${{ fromJSON(inputs.test-container) }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -61,12 +65,12 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
uses: ./src/electron/.github/actions/install-dependencies
|
||||
- name: Download Generated Artifacts
|
||||
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
|
||||
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
|
||||
with:
|
||||
name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
|
||||
path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
|
||||
- name: Download Src Artifacts
|
||||
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
|
||||
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
|
||||
with:
|
||||
name: src_artifacts_linux_${{ env.TARGET_ARCH }}
|
||||
path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
|
||||
@@ -93,6 +97,8 @@ jobs:
|
||||
nan-tests:
|
||||
name: Run Nan Tests
|
||||
runs-on: electron-arc-centralus-linux-amd64-4core
|
||||
permissions:
|
||||
contents: read
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
||||
@@ -100,7 +106,7 @@ jobs:
|
||||
container: ${{ fromJSON(inputs.test-container) }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -115,12 +121,12 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
uses: ./src/electron/.github/actions/install-dependencies
|
||||
- name: Download Generated Artifacts
|
||||
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
|
||||
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
|
||||
with:
|
||||
name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
|
||||
path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
|
||||
- name: Download Src Artifacts
|
||||
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
|
||||
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
|
||||
with:
|
||||
name: src_artifacts_linux_${{ env.TARGET_ARCH }}
|
||||
path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
|
||||
@@ -132,10 +138,16 @@ jobs:
|
||||
unzip -:o dist.zip
|
||||
- name: Setup Linux for Headless Testing
|
||||
run: sh -e /etc/init.d/xvfb start
|
||||
- name: Add Clang problem matcher
|
||||
shell: bash
|
||||
run: echo "::add-matcher::src/electron/.github/problem-matchers/clang.json"
|
||||
- name: Run Nan Tests
|
||||
run: |
|
||||
cd src
|
||||
node electron/script/nan-spec-runner.js
|
||||
- name: Remove Clang problem matcher
|
||||
shell: bash
|
||||
run: echo "::remove-matcher owner=clang::"
|
||||
- name: Wait for active SSH sessions
|
||||
shell: bash
|
||||
if: always() && !cancelled()
|
||||
|
||||
4
.github/workflows/pull-request-labeled.yml
vendored
4
.github/workflows/pull-request-labeled.yml
vendored
@@ -11,6 +11,7 @@ jobs:
|
||||
name: backport/requested label added
|
||||
if: github.event.label.name == 'backport/requested 🗳'
|
||||
runs-on: ubuntu-latest
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Trigger Slack workflow
|
||||
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
|
||||
@@ -28,9 +29,10 @@ jobs:
|
||||
name: deprecation-review/complete label added
|
||||
if: github.event.label.name == 'deprecation-review/complete ✅'
|
||||
runs-on: ubuntu-latest
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
|
||||
|
||||
6
.github/workflows/scorecards.yml
vendored
6
.github/workflows/scorecards.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
@@ -50,6 +50,6 @@ jobs:
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v3.29.5
|
||||
uses: github/codeql-action/upload-sarif@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v3.29.5
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
3
.github/workflows/semantic.yml
vendored
3
.github/workflows/semantic.yml
vendored
@@ -7,8 +7,7 @@ on:
|
||||
- edited
|
||||
- synchronize
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
main:
|
||||
|
||||
3
.github/workflows/stable-prep-items.yml
vendored
3
.github/workflows/stable-prep-items.yml
vendored
@@ -11,9 +11,10 @@ jobs:
|
||||
check-stable-prep-items:
|
||||
name: Check Stable Prep Items
|
||||
runs-on: ubuntu-latest
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
|
||||
|
||||
10
.github/workflows/stale.yml
vendored
10
.github/workflows/stale.yml
vendored
@@ -10,13 +10,14 @@ permissions: {}
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
- uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # tag: v10.1.0
|
||||
- uses: actions/stale@997185467fa4f803885201cee163a9f38240193d # tag: v10.1.1
|
||||
with:
|
||||
repo-token: ${{ steps.generate-token.outputs.token }}
|
||||
days-before-stale: 90
|
||||
@@ -31,15 +32,16 @@ jobs:
|
||||
only-pr-labels: not-a-real-label
|
||||
pending-repro:
|
||||
runs-on: ubuntu-latest
|
||||
permissions: {}
|
||||
if: ${{ always() }}
|
||||
needs: stale
|
||||
steps:
|
||||
- name: Generate GitHub App token
|
||||
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
|
||||
uses: electron/github-app-auth-action@e14e47722ed120360649d0789e25b9baece12725 # v2.0.0
|
||||
id: generate-token
|
||||
with:
|
||||
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
|
||||
- uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # tag: v10.1.0
|
||||
- uses: actions/stale@997185467fa4f803885201cee163a9f38240193d # tag: v10.1.1
|
||||
with:
|
||||
repo-token: ${{ steps.generate-token.outputs.token }}
|
||||
days-before-stale: -1
|
||||
|
||||
39
.github/workflows/update-website-docs.yml
vendored
Normal file
39
.github/workflows/update-website-docs.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Update Website Docs
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
update-website-docs:
|
||||
name: Update Website Docs
|
||||
runs-on: ubuntu-latest
|
||||
environment: website-docs-updater
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write # needed for secret-service-action
|
||||
steps:
|
||||
- name: Get GitHub App token
|
||||
id: secret-service
|
||||
uses: electron/secret-service-action@3476425e8b30555aac15b1b7096938e254b0e155 # v1.0.0
|
||||
- name: Check if this release is the latest
|
||||
id: check-if-latest-release
|
||||
env:
|
||||
GH_REPO: electron/electron
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
LATEST_RELEASE_TAG="$(gh release view --json tagName --jq '.tagName')"
|
||||
if [ "$LATEST_RELEASE_TAG" = "${GITHUB_REF#refs/tags/}" ]; then
|
||||
echo "isLatestRelease=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "isLatestRelease=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Trigger website docs update
|
||||
if: ${{ steps.check-if-latest-release.outputs.isLatestRelease }}
|
||||
env:
|
||||
GH_REPO: electron/website
|
||||
GH_TOKEN: ${{ fromJSON(steps.secret-service.outputs.secrets).WEBSITE_DOCS_UPDATER_APP_TOKEN }}
|
||||
run: |
|
||||
gh workflow run update-docs.yml -f sha=$GITHUB_SHA
|
||||
14
.github/workflows/windows-publish.yml
vendored
14
.github/workflows/windows-publish.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
build-image-sha:
|
||||
type: string
|
||||
description: 'SHA for electron/build image'
|
||||
default: '933c7d6ff6802706875270bec2e3c891cf8add3f'
|
||||
default: 'a82b87d7a4f5ff0cab61405f8151ac4cf4942aeb'
|
||||
required: true
|
||||
upload-to-storage:
|
||||
description: 'Uploads to Azure storage'
|
||||
@@ -18,9 +18,13 @@ on:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
checkout-windows:
|
||||
runs-on: electron-arc-centralus-linux-amd64-32core
|
||||
permissions:
|
||||
contents: read
|
||||
container:
|
||||
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
|
||||
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
|
||||
@@ -36,7 +40,7 @@ jobs:
|
||||
build-image-sha: ${{ inputs.build-image-sha }}
|
||||
steps:
|
||||
- name: Checkout Electron
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
||||
with:
|
||||
path: src/electron
|
||||
fetch-depth: 0
|
||||
@@ -48,6 +52,8 @@ jobs:
|
||||
|
||||
publish-x64-win:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: checkout-windows
|
||||
with:
|
||||
environment: production-release
|
||||
@@ -62,6 +68,8 @@ jobs:
|
||||
|
||||
publish-arm64-win:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: checkout-windows
|
||||
with:
|
||||
environment: production-release
|
||||
@@ -76,6 +84,8 @@ jobs:
|
||||
|
||||
publish-x86-win:
|
||||
uses: ./.github/workflows/pipeline-segment-electron-build.yml
|
||||
permissions:
|
||||
contents: read
|
||||
needs: checkout-windows
|
||||
with:
|
||||
environment: production-release
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -53,3 +53,5 @@ ts-gen
|
||||
patches/mtime-cache.json
|
||||
|
||||
spec/fixtures/logo.png
|
||||
|
||||
.yarn/install-state.gz
|
||||
942
.yarn/releases/yarn-4.12.0.cjs
vendored
Executable file
942
.yarn/releases/yarn-4.12.0.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
12
.yarnrc.yml
Normal file
12
.yarnrc.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
enableScripts: false
|
||||
|
||||
nmHoistingLimits: workspaces
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
npmMinimalAgeGate: 10080
|
||||
|
||||
npmPreapprovedPackages:
|
||||
- "@electron/*"
|
||||
|
||||
yarnPath: .yarn/releases/yarn-4.12.0.cjs
|
||||
5
BUILD.gn
5
BUILD.gn
@@ -446,6 +446,7 @@ source_set("electron_lib") {
|
||||
"shell/services/node/public/mojom",
|
||||
"//base:base_static",
|
||||
"//base/allocator:buildflags",
|
||||
"//build/util:chromium_git_revision",
|
||||
"//chrome:strings",
|
||||
"//chrome/app:command_ids",
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
@@ -480,6 +481,7 @@ source_set("electron_lib") {
|
||||
"//device/bluetooth",
|
||||
"//device/bluetooth/public/cpp",
|
||||
"//gin",
|
||||
"//gpu/ipc/client",
|
||||
"//media/capture/mojom:video_capture",
|
||||
"//media/mojo/mojom",
|
||||
"//media/mojo/mojom:web_speech_recognition",
|
||||
@@ -527,6 +529,7 @@ source_set("electron_lib") {
|
||||
"//base",
|
||||
"//base:i18n",
|
||||
"//content/public/app",
|
||||
"//ui/base/unowned_user_data",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
@@ -761,11 +764,13 @@ source_set("electron_lib") {
|
||||
if (enable_pdf_viewer) {
|
||||
deps += [
|
||||
"//chrome/browser/resources/pdf:resources",
|
||||
"//chrome/browser/ui:browser_element_identifiers",
|
||||
"//components/pdf/browser",
|
||||
"//components/pdf/browser:interceptors",
|
||||
"//components/pdf/common:constants",
|
||||
"//components/pdf/common:util",
|
||||
"//components/pdf/renderer",
|
||||
"//components/user_education/webui",
|
||||
"//pdf",
|
||||
"//pdf:content_restriction",
|
||||
]
|
||||
|
||||
226
CLAUDE.md
Normal file
226
CLAUDE.md
Normal file
@@ -0,0 +1,226 @@
|
||||
# Electron Development Guide
|
||||
|
||||
## Project Overview
|
||||
|
||||
Electron is a framework for building cross-platform desktop applications using web technologies. It embeds Chromium for rendering and Node.js for backend functionality.
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```text
|
||||
electron/ # This repo (run `e` commands here)
|
||||
├── shell/ # Core C++ application code
|
||||
│ ├── browser/ # Main process implementation (107+ API modules)
|
||||
│ ├── renderer/ # Renderer process code
|
||||
│ ├── common/ # Shared code between processes
|
||||
│ ├── app/ # Application entry points
|
||||
│ └── services/ # Node.js service integration
|
||||
├── lib/ # TypeScript/JavaScript library code
|
||||
│ ├── browser/ # Main process JS (47 API implementations)
|
||||
│ ├── renderer/ # Renderer process JS
|
||||
│ └── common/ # Shared JS modules
|
||||
├── patches/ # Patches for upstream dependencies
|
||||
│ ├── chromium/ # ~159 patches to Chromium
|
||||
│ ├── node/ # ~48 patches to Node.js
|
||||
│ └── ... # Other targets (v8, boringssl, etc.)
|
||||
├── spec/ # Test suite (1189+ TypeScript test files)
|
||||
├── docs/ # API documentation and guides
|
||||
├── build/ # Build configuration
|
||||
├── script/ # Build and automation scripts
|
||||
└── chromium_src/ # Chromium source overrides
|
||||
../ # Parent directory is Chromium source
|
||||
```
|
||||
|
||||
## Build Tools Setup
|
||||
|
||||
Electron uses `@electron/build-tools` for development. The `e` command is the primary CLI.
|
||||
|
||||
**Installation:**
|
||||
|
||||
```bash
|
||||
npm i -g @electron/build-tools
|
||||
```
|
||||
|
||||
**Configuration location:** `~/.electron_build_tools/configs/`
|
||||
|
||||
## Essential Commands
|
||||
|
||||
### Configuration Management
|
||||
|
||||
| Command | Purpose |
|
||||
|---------|---------|
|
||||
| `e init <name> --root=<path> --bootstrap testing` | Create new build config and sync |
|
||||
| `e use <name>` | Switch to a different build configuration |
|
||||
| `e show current` | Display active configuration name |
|
||||
| `e show configs` | List all available configurations |
|
||||
|
||||
### Build & Development Loop
|
||||
|
||||
| Command | Purpose |
|
||||
|---------|---------|
|
||||
| `e sync` | Fetch/update all source code and apply patches |
|
||||
| `e sync --3` | Sync with 3-way merge (required for Chromium upgrades) |
|
||||
| `e build` | Build Electron (runs GN + Ninja) |
|
||||
| `e build -k 999` | Build and continue on errors (up to 999) |
|
||||
| `e build -t <target>` | Build specific target (e.g., `electron:node_headers`) |
|
||||
| `e start` | Run the built Electron executable |
|
||||
| `e start --version` | Verify Electron launches and print version |
|
||||
| `e test` | Run the test suite |
|
||||
| `e debug` | Run Electron in debugger (lldb on macOS, gdb on Linux) |
|
||||
|
||||
### Patch Management
|
||||
|
||||
| Command | Purpose |
|
||||
|---------|---------|
|
||||
| `e patches <target>` | Export patches for a target (chromium, node, v8, etc.) |
|
||||
| `e patches all` | Export all patches from all targets |
|
||||
| `e patches --list-targets` | List available patch targets |
|
||||
|
||||
## Typical Development Workflow
|
||||
|
||||
```bash
|
||||
# 1. Ensure you're on the right config
|
||||
e show current
|
||||
|
||||
# 2. Sync to get latest code
|
||||
e sync
|
||||
|
||||
# 3. Make your changes in shell/ or lib/ or ../
|
||||
|
||||
# 4. Build
|
||||
e build
|
||||
|
||||
# 5. Test your changes (Leave the user to do this, don't run these commands unless asked)
|
||||
e start
|
||||
e test
|
||||
|
||||
# 6. If you modified patched files in Chromium:
|
||||
cd .. # Go to Chromium repo
|
||||
git add <files>
|
||||
git commit -m "description of change"
|
||||
cd electron
|
||||
e patches chromium # Export the patch
|
||||
```
|
||||
|
||||
## Patches System
|
||||
|
||||
Electron patches upstream dependencies (Chromium, Node.js, V8, etc.) to add features or modify behavior.
|
||||
|
||||
**How patches work:**
|
||||
|
||||
```text
|
||||
patches/{target}/*.patch → [e sync --3] → target repo commits
|
||||
← [e patches] ←
|
||||
```
|
||||
|
||||
**Patch configuration:** `patches/config.json` maps patch directories to target repos.
|
||||
|
||||
**Key rules:**
|
||||
|
||||
- Fix existing patches 99% of the time rather than creating new ones
|
||||
- Preserve original authorship in TODO comments
|
||||
- Never change TODO assignees (`TODO(name)` must retain original name)
|
||||
- Each patch file includes commit message explaining its purpose
|
||||
|
||||
**Creating/modifying patches:**
|
||||
|
||||
1. Make changes in the target repo (e.g., `../` for Chromium)
|
||||
2. Create a git commit
|
||||
3. Run `e patches <target>` to export
|
||||
|
||||
## Testing
|
||||
|
||||
**Test location:** `spec/` directory
|
||||
|
||||
**Running tests:**
|
||||
|
||||
```bash
|
||||
e test # Run full test suite
|
||||
```
|
||||
|
||||
**Test frameworks:** Mocha, Chai, Sinon
|
||||
|
||||
## Build Configuration
|
||||
|
||||
**GN build arguments:** Located in `build/args/`:
|
||||
|
||||
- `testing.gn` - Debug/testing builds
|
||||
- `release.gn` - Release builds
|
||||
- `all.gn` - Common arguments for all builds
|
||||
|
||||
**Main build file:** `BUILD.gn`
|
||||
|
||||
**Feature flags:** `buildflags/buildflags.gni`
|
||||
|
||||
## Chromium Upgrade Workflow
|
||||
|
||||
When working on the `roller/chromium/main` branch to upgrade Chromium activate the "Electron Chromium Upgrade" skill.
|
||||
|
||||
## Code Style
|
||||
|
||||
**C++:** Follows Chromium style, enforced by clang-format
|
||||
**TypeScript/JavaScript:** ESLint configuration in `.eslintrc.json`
|
||||
|
||||
**Linting:**
|
||||
|
||||
```bash
|
||||
npm run lint # Run all linters
|
||||
npm run lint:clang-format # C++ formatting
|
||||
```
|
||||
|
||||
## Key Files
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `BUILD.gn` | Main GN build configuration |
|
||||
| `DEPS` | Dependency versions and checkout paths |
|
||||
| `patches/config.json` | Patch target configuration |
|
||||
| `filenames.gni` | Source file lists by platform |
|
||||
| `package.json` | Node.js dependencies and scripts |
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Purpose |
|
||||
|----------|---------|
|
||||
| `GN_EXTRA_ARGS` | Additional GN arguments (useful in CI) |
|
||||
| `ELECTRON_RUN_AS_NODE=1` | Run Electron as Node.js |
|
||||
|
||||
## Useful Git Commands for Chromium
|
||||
|
||||
```bash
|
||||
# Find CL that changed a file
|
||||
cd ..
|
||||
git log --oneline -10 -- {file}
|
||||
git blame -L {start},{end} -- {file}
|
||||
|
||||
# Look for Chromium CL reference in commit
|
||||
git log -1 {commit_sha} # Find "Reviewed-on:" line
|
||||
|
||||
# Find which patch affects a file
|
||||
grep -l "filename.cc" patches/chromium/*.patch
|
||||
```
|
||||
|
||||
## CI/CD
|
||||
|
||||
GitHub Actions workflows in `.github/workflows/`:
|
||||
|
||||
- `build.yml` - Main build workflow
|
||||
- `pipeline-electron-lint.yml` - Linting
|
||||
- `pipeline-segment-electron-test.yml` - Testing
|
||||
|
||||
## Common Issues
|
||||
|
||||
**Patch conflict during sync:**
|
||||
|
||||
- Use `e sync --3` for 3-way merge
|
||||
- Check if file was renamed/moved upstream
|
||||
- Verify patch is still needed
|
||||
|
||||
**Build error in patched file:**
|
||||
|
||||
- Find the patch: `grep -l "filename" patches/chromium/*.patch`
|
||||
- Match existing patch style (#if 0 guards, BUILDFLAG conditionals, etc.)
|
||||
|
||||
**Remote build issues:**
|
||||
|
||||
- Try `e build --no-remote` to build locally
|
||||
- Check reclient/siso configuration in your build config
|
||||
11
DEPS
11
DEPS
@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'143.0.7497.0',
|
||||
'146.0.7645.0',
|
||||
'node_version':
|
||||
'v22.20.0',
|
||||
'v24.13.0',
|
||||
'nan_version':
|
||||
'675cefebca42410733da8a454c8d9391fcebfbc2',
|
||||
'squirrel.mac_version':
|
||||
@@ -12,7 +12,7 @@ vars = {
|
||||
'reactiveobjc_version':
|
||||
'74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76',
|
||||
'mantle_version':
|
||||
'78d3966b3c331292ea29ec38661b25df0a245948',
|
||||
'2a8e2123a3931038179ee06105c9e6ec336b12ea',
|
||||
'engflow_reclient_configs_version':
|
||||
'955335c30a752e9ef7bff375baab5e0819b6c00d',
|
||||
|
||||
@@ -30,9 +30,6 @@ vars = {
|
||||
# The path of the sysroots.json file.
|
||||
'sysroots_json_path': 'electron/script/sysroots.json',
|
||||
|
||||
# KEEP IN SYNC WITH utils.js FILE
|
||||
'yarn_version': '1.22.22',
|
||||
|
||||
# To be able to build clean Chromium from sources.
|
||||
'apply_patches': True,
|
||||
|
||||
@@ -155,7 +152,7 @@ hooks = [
|
||||
'action': [
|
||||
'python3',
|
||||
'-c',
|
||||
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python3", "script/lib/npx.py", "yarn@' + (Var("yarn_version")) + '", "install", "--frozen-lockfile"]);',
|
||||
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["node", ".yarn/releases/yarn-4.12.0.cjs", "install", "--immutable"]);',
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ For more installation options and troubleshooting tips, see
|
||||
|
||||
Each Electron release provides binaries for macOS, Windows, and Linux.
|
||||
|
||||
* macOS (Big Sur and up): Electron provides 64-bit Intel and Apple Silicon / ARM binaries for macOS.
|
||||
* macOS (Monterey and up): Electron provides 64-bit Intel and Apple Silicon / ARM binaries for macOS.
|
||||
* Windows (Windows 10 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8. Support for Windows 7, 8 and 8.1 was [removed in Electron 23, in line with Chromium's Windows deprecation policy](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice).
|
||||
* Linux: The prebuilt binaries of Electron are built on Ubuntu 22.04. They have also been verified to work on:
|
||||
* Ubuntu 18.04 and newer
|
||||
|
||||
@@ -2,7 +2,7 @@ is_electron_build = true
|
||||
root_extra_deps = [ "//electron" ]
|
||||
|
||||
# Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json
|
||||
node_module_version = 143
|
||||
node_module_version = 145
|
||||
|
||||
v8_promise_internal_field_count = 1
|
||||
v8_embedder_string = "-electron.0"
|
||||
|
||||
@@ -39,18 +39,18 @@ def init(ctx):
|
||||
"clang_large": step_config["platforms"]["default"],
|
||||
})
|
||||
|
||||
if runtime.os == "windows":
|
||||
# Add additional Windows SDK headers needed by Electron
|
||||
win_toolchain_dir = win_sdk.toolchain_dir(ctx)
|
||||
if win_toolchain_dir:
|
||||
sdk_version = gn_logs.read(ctx).get("windows_sdk_version")
|
||||
step_config["input_deps"][win_toolchain_dir + ":headers"].extend([
|
||||
# third_party/electron_node/deps/uv/include/uv/win.h includes mswsock.h
|
||||
path.join(win_toolchain_dir, "Windows Kits/10/Include", sdk_version, "um/mswsock.h"),
|
||||
# third_party/electron_node/src/debug_utils.cc includes lm.h
|
||||
path.join(win_toolchain_dir, "Windows Kits/10/Include", sdk_version, "um/Lm.h"),
|
||||
])
|
||||
|
||||
# Add additional Windows SDK headers needed by Electron
|
||||
win_toolchain_dir = win_sdk.toolchain_dir(ctx)
|
||||
if win_toolchain_dir:
|
||||
sdk_version = gn_logs.read(ctx).get("windows_sdk_version")
|
||||
step_config["input_deps"][win_toolchain_dir + ":headers"].extend([
|
||||
# third_party/electron_node/deps/uv/include/uv/win.h includes mswsock.h
|
||||
path.join(win_toolchain_dir, "Windows Kits", "10/Include", sdk_version, "um/mswsock.h"),
|
||||
# third_party/electron_node/src/debug_utils.cc includes lm.h
|
||||
path.join(win_toolchain_dir, "Windows Kits", "10/Include", sdk_version, "um/Lm.h"),
|
||||
])
|
||||
|
||||
if runtime.os == "windows":
|
||||
# Update platforms to match our default siso config instead of reclient configs.
|
||||
step_config["platforms"].update({
|
||||
"clang-cl": step_config["platforms"]["default"],
|
||||
|
||||
@@ -383,6 +383,8 @@ static_library("chrome") {
|
||||
"//chrome/browser/pdf/chrome_pdf_stream_delegate.h",
|
||||
"//chrome/browser/pdf/pdf_extension_util.cc",
|
||||
"//chrome/browser/pdf/pdf_extension_util.h",
|
||||
"//chrome/browser/pdf/pdf_help_bubble_handler_factory.cc",
|
||||
"//chrome/browser/pdf/pdf_help_bubble_handler_factory.h",
|
||||
"//chrome/browser/pdf/pdf_viewer_stream_manager.cc",
|
||||
"//chrome/browser/pdf/pdf_viewer_stream_manager.h",
|
||||
"//chrome/browser/plugins/pdf_iframe_navigation_throttle.cc",
|
||||
@@ -391,6 +393,8 @@ static_library("chrome") {
|
||||
deps += [
|
||||
"//components/pdf/browser",
|
||||
"//components/pdf/renderer",
|
||||
"//ui/base/interaction",
|
||||
"//ui/webui/resources/cr_components/help_bubble:mojo_bindings",
|
||||
]
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -110,11 +110,9 @@ async function loadApplicationPackage (packagePath: string) {
|
||||
} else if (packageJson.name) {
|
||||
app.name = packageJson.name;
|
||||
}
|
||||
if (packageJson.desktopName) {
|
||||
app.setDesktopName(packageJson.desktopName);
|
||||
} else {
|
||||
app.setDesktopName(`${app.name}.desktop`);
|
||||
}
|
||||
|
||||
app.setDesktopName(packageJson.desktopName || `${app.name}.desktop`);
|
||||
|
||||
// Set v8 flags, deliberately lazy load so that apps that do not use this
|
||||
// feature do not pay the price
|
||||
if (packageJson.v8Flags) {
|
||||
|
||||
@@ -565,8 +565,9 @@ and subscribing to the `ready` event if the app is not ready yet.
|
||||
* `steal` boolean _macOS_ - Make the receiver the active app even if another app is
|
||||
currently active.
|
||||
|
||||
On Linux, focuses on the first visible window. On macOS, makes the application
|
||||
the active app. On Windows, focuses on the application's first window.
|
||||
On macOS, makes the application the active app. On Windows, focuses on the application's
|
||||
first window. On Linux, either focuses on the first visible window (X11) or requests
|
||||
focus but may instead show a notification or flash the app icon (Wayland).
|
||||
|
||||
You should seek to use the `steal` option as sparingly as possible.
|
||||
|
||||
@@ -611,7 +612,7 @@ Returns `string` - The current application directory.
|
||||
may backup this directory to cloud storage.
|
||||
* `sessionData` The directory for storing data generated by `Session`, such
|
||||
as localStorage, cookies, disk cache, downloaded dictionaries, network
|
||||
state, devtools files. By default this points to `userData`. Chromium may
|
||||
state, DevTools files. By default this points to `userData`. Chromium may
|
||||
write very large disk cache here, so if your app does not rely on browser
|
||||
storage like localStorage or cookies to save user data, it is recommended
|
||||
to set this directory to other locations to avoid polluting the `userData`
|
||||
@@ -1217,7 +1218,7 @@ This method can only be called before app is ready.
|
||||
|
||||
### `app.isHardwareAccelerationEnabled()`
|
||||
|
||||
Returns `boolean` - whether hardware acceleration is currently disabled.
|
||||
Returns `boolean` - whether hardware acceleration is currently enabled.
|
||||
|
||||
> [!NOTE]
|
||||
> This information is only usable after the `gpu-info-update` event is emitted.
|
||||
|
||||
@@ -100,6 +100,13 @@ On Windows only `releaseName` is available.
|
||||
|
||||
### Event: 'before-quit-for-update'
|
||||
|
||||
<!--
|
||||
```YAML history
|
||||
added:
|
||||
- pr-url: https://github.com/electron/electron/pull/12619
|
||||
```
|
||||
-->
|
||||
|
||||
This event is emitted after a user calls `quitAndInstall()`.
|
||||
|
||||
When this API is called, the `before-quit` event is not emitted before all windows are closed. As a result you should listen to this event if you wish to perform actions before the windows are closed while a process is quitting, as well as listening to `before-quit`.
|
||||
@@ -110,6 +117,16 @@ The `autoUpdater` object has the following methods:
|
||||
|
||||
### `autoUpdater.setFeedURL(options)`
|
||||
|
||||
<!--
|
||||
```YAML history
|
||||
changes:
|
||||
- pr-url: https://github.com/electron/electron/pull/5879
|
||||
description: "Added `headers` as a second parameter."
|
||||
- pr-url: https://github.com/electron/electron/pull/11925
|
||||
description: "Changed API to accept a single `options` argument (contains `url`, `headers`, and `serverType` properties)."
|
||||
```
|
||||
-->
|
||||
|
||||
* `options` Object
|
||||
* `url` string
|
||||
* `headers` Record\<string, string\> (optional) _macOS_ - HTTP request headers.
|
||||
|
||||
@@ -140,6 +140,10 @@ state is `hidden` in order to minimize power consumption.
|
||||
move.
|
||||
* 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 Wayland (Linux) it is generally not possible to programmatically resize windows
|
||||
after creation, or to position, move, focus, or blur windows without user input.
|
||||
If your app needs these capabilities, run it in Xwayland by appending the flag
|
||||
`--ozone-platform=x11`.
|
||||
|
||||
## Class: BrowserWindow extends `BaseWindow`
|
||||
|
||||
@@ -656,10 +660,15 @@ the [close event](#event-close).
|
||||
|
||||
Focuses on the window.
|
||||
|
||||
On Wayland (Linux), the desktop environment may show a notification or flash
|
||||
the app icon if the window or app is not already focused.
|
||||
|
||||
#### `win.blur()`
|
||||
|
||||
Removes focus from the window.
|
||||
|
||||
Not supported on Wayland (Linux).
|
||||
|
||||
#### `win.isFocused()`
|
||||
|
||||
Returns `boolean` - Whether the window is focused.
|
||||
@@ -676,6 +685,8 @@ Shows and gives focus to the window.
|
||||
|
||||
Shows the window but doesn't focus on it.
|
||||
|
||||
Not supported on Wayland (Linux).
|
||||
|
||||
#### `win.hide()`
|
||||
|
||||
Hides the window.
|
||||
@@ -824,6 +835,8 @@ Closes the currently open [Quick Look][quick-look] panel.
|
||||
|
||||
Resizes and moves the window to the supplied bounds. Any properties that are not supplied will default to their current values.
|
||||
|
||||
On Wayland (Linux), has the same limitations as `setSize` and `setPosition`.
|
||||
|
||||
```js
|
||||
const { BrowserWindow } = require('electron')
|
||||
|
||||
@@ -866,6 +879,8 @@ See [Setting `backgroundColor`](#setting-the-backgroundcolor-property).
|
||||
Resizes and moves the window's client area (e.g. the web page) to
|
||||
the supplied bounds.
|
||||
|
||||
On Wayland (Linux), has the same limitations as `setContentSize` and `setPosition`.
|
||||
|
||||
#### `win.getContentBounds()`
|
||||
|
||||
Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window's client area as `Object`.
|
||||
@@ -895,6 +910,8 @@ Returns `boolean` - whether the window is enabled.
|
||||
|
||||
Resizes the window to `width` and `height`. If `width` or `height` are below any set minimum size constraints the window will snap to its minimum size.
|
||||
|
||||
On Wayland (Linux), may not work as some window managers restrict programmatic window resizing.
|
||||
|
||||
#### `win.getSize()`
|
||||
|
||||
Returns `Integer[]` - Contains the window's width and height.
|
||||
@@ -907,6 +924,8 @@ Returns `Integer[]` - Contains the window's width and height.
|
||||
|
||||
Resizes the window's client area (e.g. the web page) to `width` and `height`.
|
||||
|
||||
On Wayland (Linux), may not work as some window managers restrict programmatic window resizing.
|
||||
|
||||
#### `win.getContentSize()`
|
||||
|
||||
Returns `Integer[]` - Contains the window's client area's width and height.
|
||||
@@ -1044,12 +1063,16 @@ this method throws an error.
|
||||
|
||||
#### `win.moveTop()`
|
||||
|
||||
Moves window to top(z-order) regardless of focus
|
||||
Moves window to top(z-order) regardless of focus.
|
||||
|
||||
Not supported on Wayland (Linux).
|
||||
|
||||
#### `win.center()`
|
||||
|
||||
Moves window to the center of the screen.
|
||||
|
||||
Not supported on Wayland (Linux).
|
||||
|
||||
#### `win.setPosition(x, y[, animate])`
|
||||
|
||||
* `x` Integer
|
||||
@@ -1058,6 +1081,8 @@ Moves window to the center of the screen.
|
||||
|
||||
Moves window to `x` and `y`.
|
||||
|
||||
Not supported on Wayland (Linux).
|
||||
|
||||
#### `win.getPosition()`
|
||||
|
||||
Returns `Integer[]` - Contains the window's current position.
|
||||
@@ -1227,7 +1252,8 @@ Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
|
||||
|
||||
Returns `Promise<void>` - the promise will resolve when the page has finished loading
|
||||
(see [`did-finish-load`](web-contents.md#event-did-finish-load)), and rejects
|
||||
if the page fails to load (see [`did-fail-load`](web-contents.md#event-did-fail-load)).
|
||||
if the page fails to load (see
|
||||
[`did-fail-load`](web-contents.md#event-did-fail-load)). A noop rejection handler is already attached, which avoids unhandled rejection errors. If the existing page has a beforeUnload handler, [`did-fail-load`](web-contents.md#event-did-fail-load) will be called unless [`will-prevent-unload`](web-contents.md#event-did-fail-load) is handled.
|
||||
|
||||
Same as [`webContents.loadURL(url[, options])`](web-contents.md#contentsloadurlurl-options).
|
||||
|
||||
|
||||
@@ -25,6 +25,11 @@ following properties:
|
||||
with which the request is associated. Defaults to the empty string. The
|
||||
`session` option supersedes `partition`. Thus if a `session` is explicitly
|
||||
specified, `partition` is ignored.
|
||||
* `bypassCustomProtocolHandlers` boolean (optional) - When set to `true`,
|
||||
custom protocol handlers registered for the request's URL scheme will not be
|
||||
called. This allows forwarding an intercepted request to the built-in
|
||||
handler. [webRequest](web-request.md) handlers will still be triggered
|
||||
when bypassing custom protocols. Defaults to `false`.
|
||||
* `credentials` string (optional) - Can be `include`, `omit` or
|
||||
`same-origin`. Whether to send
|
||||
[credentials](https://fetch.spec.whatwg.org/#credentials) with this
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
> Perform copy and paste operations on the system clipboard.
|
||||
|
||||
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process) (non-sandboxed only)
|
||||
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process) _Deprecated_ (non-sandboxed only)
|
||||
|
||||
> [!NOTE]
|
||||
> Using the `clipoard` API from the renderer process is deprecated.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> If you want to call this API from a renderer process with context isolation enabled,
|
||||
> If you want to call this API from a renderer process,
|
||||
> place the API call in your preload script and
|
||||
> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the
|
||||
> [`contextBridge`](context-bridge.md) API.
|
||||
|
||||
@@ -49,6 +49,10 @@ Disables the disk cache for HTTP requests.
|
||||
|
||||
Disable HTTP/2 and SPDY/3.1 protocols.
|
||||
|
||||
### --disable-geolocation _macOS_
|
||||
|
||||
Disables the Geolocation API. Permission requests for geolocation will be denied internally regardless of the decision made by a handler set via `session.setPermissionRequestHandler`. This functionality is currently implemented only for macOS. Has no effect on other platforms.
|
||||
|
||||
### --disable-renderer-backgrounding
|
||||
|
||||
Prevents Chromium from lowering the priority of invisible pages' renderer
|
||||
@@ -313,7 +317,7 @@ By default inspector websocket url is available in stderr and under /json/list e
|
||||
|
||||
### `--experimental-network-inspection`
|
||||
|
||||
Enable support for devtools network inspector events, for visibility into requests made by the nodejs `http` and `https` modules.
|
||||
Enable support for DevTools network inspector events, for visibility into requests made by the nodejs `http` and `https` modules.
|
||||
|
||||
### `--no-deprecation`
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ Returns:
|
||||
* `reason` string - Reason for detaching debugger.
|
||||
|
||||
Emitted when the debugging session is terminated. This happens either when
|
||||
`webContents` is closed or devtools is invoked for the attached `webContents`.
|
||||
`webContents` is closed or DevTools is invoked for the attached `webContents`.
|
||||
|
||||
#### Event: 'message'
|
||||
|
||||
|
||||
@@ -186,3 +186,14 @@ the one downloaded by `npm install`. Usage:
|
||||
```sh
|
||||
export ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing
|
||||
```
|
||||
|
||||
### `ELECTRON_SKIP_BINARY_DOWNLOAD`
|
||||
|
||||
If you want to install your project's dependencies but don't need to use Electron functionality,
|
||||
you can set the `ELECTRON_SKIP_BINARY_DOWNLOAD` environment variable to prevent the binary from being
|
||||
downloaded. For instance, this feature can be useful in continuous integration environments when
|
||||
running unit tests that mock out the `electron` module.
|
||||
|
||||
```sh
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install
|
||||
```
|
||||
|
||||
@@ -57,7 +57,7 @@ The following methods are available on instances of `Extensions`:
|
||||
* `options` Object (optional)
|
||||
* `allowFileAccess` boolean - Whether to allow the extension to read local files over `file://`
|
||||
protocol and inject content scripts into `file://` pages. This is required e.g. for loading
|
||||
devtools extensions on `file://` URLs. Defaults to false.
|
||||
DevTools extensions on `file://` URLs. Defaults to false.
|
||||
|
||||
Returns `Promise<Extension>` - resolves when the extension is loaded.
|
||||
|
||||
@@ -83,7 +83,7 @@ const path = require('node:path')
|
||||
app.whenReady().then(async () => {
|
||||
await session.defaultSession.extensions.loadExtension(
|
||||
path.join(__dirname, 'react-devtools'),
|
||||
// allowFileAccess is required to load the devtools extension on file:// URLs.
|
||||
// allowFileAccess is required to load the DevTools extension on file:// URLs.
|
||||
{ allowFileAccess: true }
|
||||
)
|
||||
// Note that in order to use the React DevTools extension, you'll need to
|
||||
|
||||
@@ -34,7 +34,8 @@ See [`Menu`](menu.md) for examples.
|
||||
* `sublabel` string (optional) _macOS_ - Available in macOS >= 14.4
|
||||
* `toolTip` string (optional) _macOS_ - Hover text for this menu item.
|
||||
* `accelerator` string (optional) - An [Accelerator](../tutorial/keyboard-shortcuts.md#accelerators) string.
|
||||
* `icon` ([NativeImage](native-image.md) | string) (optional)
|
||||
* `icon` ([NativeImage](native-image.md) | string) (optional) - Can be a
|
||||
[NativeImage](native-image.md) or the file path of an icon.
|
||||
* `enabled` boolean (optional) - If false, the menu item will be greyed out and
|
||||
unclickable.
|
||||
* `acceleratorWorksWhenHidden` boolean (optional) _macOS_ - default is `true`, and when `false` will prevent the accelerator from triggering the item if the item is not visible.
|
||||
|
||||
@@ -2,10 +2,15 @@
|
||||
|
||||
## Class: Menu
|
||||
|
||||
> Create native application menus and context menus.
|
||||
> Create application menus and context menus.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
The presentation of menus varies depending on the operating system:
|
||||
|
||||
- Under Windows and Linux, menus are visually similar to Chromium.
|
||||
- Under macOS, these will be native menus.
|
||||
|
||||
> [!TIP]
|
||||
> See also: [A detailed guide about how to implement menus in your application](../tutorial/menus.md).
|
||||
|
||||
|
||||
@@ -202,8 +202,7 @@ Creates a new `NativeImage` instance from `dataUrl`, a base 64 encoded [Data URL
|
||||
Returns `NativeImage`
|
||||
|
||||
Creates a new `NativeImage` instance from the `NSImage` that maps to the
|
||||
given image name. See Apple's [`NSImageName`](https://developer.apple.com/documentation/appkit/nsimagename#2901388)
|
||||
documentation for a list of possible values.
|
||||
given image name. See Apple's [`NSImageName`](https://developer.apple.com/documentation/appkit/nsimagename#2901388) documentation and [SF Symbols](https://developer.apple.com/sf-symbols/) for a list of possible values.
|
||||
|
||||
The `hslShift` is applied to the image with the following rules:
|
||||
|
||||
@@ -231,6 +230,15 @@ echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME);
|
||||
|
||||
where `SYSTEM_IMAGE_NAME` should be replaced with any value from [this list](https://developer.apple.com/documentation/appkit/nsimagename?language=objc).
|
||||
|
||||
For SF Symbols, usage looks as follows:
|
||||
|
||||
```js
|
||||
const image = nativeImage.createFromNamedImage('square.and.pencil')
|
||||
```
|
||||
|
||||
where `'square.and.pencil'` is the symbol name from the
|
||||
[SF Symbols app](https://developer.apple.com/sf-symbols/).
|
||||
|
||||
## Class: NativeImage
|
||||
|
||||
> Natively wrap images such as tray, dock, and application icons.
|
||||
|
||||
@@ -36,7 +36,7 @@ everything will be reset to the OS default. By default `themeSource` is `system
|
||||
Settings this property to `dark` will have the following effects:
|
||||
|
||||
* `nativeTheme.shouldUseDarkColors` will be `true` when accessed
|
||||
* Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the dark UI.
|
||||
* Any UI Electron renders on Linux and Windows including context menus, DevTools, etc. will use the dark UI.
|
||||
* Any UI the OS renders on macOS including menus, window frames, etc. will use the dark UI.
|
||||
* The [`prefers-color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) CSS query will match `dark` mode.
|
||||
* The `updated` event will be emitted
|
||||
@@ -44,7 +44,7 @@ Settings this property to `dark` will have the following effects:
|
||||
Settings this property to `light` will have the following effects:
|
||||
|
||||
* `nativeTheme.shouldUseDarkColors` will be `false` when accessed
|
||||
* Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the light UI.
|
||||
* Any UI Electron renders on Linux and Windows including context menus, DevTools, etc. will use the light UI.
|
||||
* Any UI the OS renders on macOS including menus, window frames, etc. will use the light UI.
|
||||
* The [`prefers-color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) CSS query will match `light` mode.
|
||||
* The `updated` event will be emitted
|
||||
|
||||
@@ -1512,7 +1512,7 @@ will not work on non-persistent (in-memory) sessions.
|
||||
* `options` Object (optional)
|
||||
* `allowFileAccess` boolean - Whether to allow the extension to read local files over `file://`
|
||||
protocol and inject content scripts into `file://` pages. This is required e.g. for loading
|
||||
devtools extensions on `file://` URLs. Defaults to false.
|
||||
DevTools extensions on `file://` URLs. Defaults to false.
|
||||
|
||||
Returns `Promise<Extension>` - resolves when the extension is loaded.
|
||||
|
||||
@@ -1538,7 +1538,7 @@ const path = require('node:path')
|
||||
app.whenReady().then(async () => {
|
||||
await session.defaultSession.loadExtension(
|
||||
path.join(__dirname, 'react-devtools'),
|
||||
// allowFileAccess is required to load the devtools extension on file:// URLs.
|
||||
// allowFileAccess is required to load the DevTools extension on file:// URLs.
|
||||
{ allowFileAccess: true }
|
||||
)
|
||||
// Note that in order to use the React DevTools extension, you'll need to
|
||||
|
||||
@@ -9,6 +9,13 @@ For including the share menu as a submenu of other menus, please use the
|
||||
|
||||
## Class: ShareMenu
|
||||
|
||||
<!--
|
||||
```YAML history
|
||||
added:
|
||||
- pr-url: https://github.com/electron/electron/pull/25629
|
||||
```
|
||||
-->
|
||||
|
||||
> Create share menu on macOS.
|
||||
|
||||
Process: [Main](../glossary.md#main-process)
|
||||
|
||||
58
docs/api/shared-texture.md
Normal file
58
docs/api/shared-texture.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# sharedTexture
|
||||
|
||||
> Import shared textures into Electron and converts platform specific handles into [`VideoFrame`](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame). Supports all Web rendering systems, and can be transferred across Electron processes. Read [here](https://github.com/electron/electron/blob/main/shell/common/api/shared_texture/README.md) for more information.
|
||||
|
||||
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
|
||||
|
||||
## Methods
|
||||
|
||||
The `sharedTexture` module has the following methods:
|
||||
|
||||
**Note:** Experimental APIs are marked as such and could be removed in the future.
|
||||
|
||||
### `sharedTexture.importSharedTexture(options)` _Experimental_
|
||||
|
||||
* `options` Object - Options for importing shared textures.
|
||||
* `textureInfo` [SharedTextureImportTextureInfo](structures/shared-texture-import-texture-info.md) - The information of the shared texture to import.
|
||||
* `allReferencesReleased` Function (optional) - Called when all references in all processes are released. You should keep the imported texture valid until this callback is called.
|
||||
|
||||
Imports the shared texture from the given options.
|
||||
|
||||
> [!NOTE]
|
||||
> This method is only available in the main process.
|
||||
|
||||
Returns `SharedTextureImported` - The imported shared texture.
|
||||
|
||||
### `sharedTexture.sendSharedTexture(options, ...args)` _Experimental_
|
||||
|
||||
* `options` Object - Options for sending shared texture.
|
||||
* `frame` [WebFrameMain](web-frame-main.md) - The target frame to transfer the shared texture to. For `WebContents`, you can pass `webContents.mainFrame`. If you provide a `webFrameMain` that is not a main frame, you'll need to enable `webPreferences.nodeIntegrationInSubFrames` for this, since this feature requires [IPC](https://www.electronjs.org/docs/latest/api/web-frame-main#frameipc-readonly) between main and the frame.
|
||||
* `importedSharedTexture` [SharedTextureImported](structures/shared-texture-imported.md) - The imported shared texture.
|
||||
* `...args` any[] - Additional arguments to pass to the renderer process.
|
||||
|
||||
Send the imported shared texture to a renderer process. You must register a receiver at renderer process before calling this method. This method has a 1000ms timeout. Ensure the receiver is set and the renderer process is alive before calling this method.
|
||||
|
||||
> [!NOTE]
|
||||
> This method is only available in the main process.
|
||||
|
||||
Returns `Promise<void>` - Resolves when the transfer is complete.
|
||||
|
||||
### `sharedTexture.setSharedTextureReceiver(callback)` _Experimental_
|
||||
|
||||
* `callback` Function\<Promise\<void\>\> - The function to receive the imported shared texture.
|
||||
* `receivedSharedTextureData` Object - The data received from the main process.
|
||||
* `importedSharedTexture` [SharedTextureImported](structures/shared-texture-imported.md) - The imported shared texture.
|
||||
* `...args` any[] - Additional arguments passed from the main process.
|
||||
|
||||
Set a callback to receive imported shared textures from the main process.
|
||||
|
||||
> [!NOTE]
|
||||
> This method is only available in the renderer process.
|
||||
|
||||
## Properties
|
||||
|
||||
The `sharedTexture` module has the following properties:
|
||||
|
||||
### `sharedTexture.subtle` _Experimental_
|
||||
|
||||
A [`SharedTextureSubtle`](structures/shared-texture-subtle.md) property, provides subtle APIs for interacting with shared texture for advanced users.
|
||||
@@ -29,6 +29,14 @@ Show the given file in a file manager. If possible, select the file.
|
||||
|
||||
### `shell.openPath(path)`
|
||||
|
||||
<!--
|
||||
```YAML history
|
||||
added:
|
||||
- pr-url: https://github.com/electron/electron/pull/20682
|
||||
breaking-changes-header: api-changed-shellopenitem-is-now-shellopenpath
|
||||
```
|
||||
-->
|
||||
|
||||
* `path` string
|
||||
|
||||
Returns `Promise<string>` - Resolves with a string containing the error message corresponding to the failure if a failure occurred, otherwise "".
|
||||
@@ -37,6 +45,18 @@ Open the given file in the desktop's default manner.
|
||||
|
||||
### `shell.openExternal(url[, options])`
|
||||
|
||||
<!--
|
||||
```YAML history
|
||||
changes:
|
||||
- pr-url: https://github.com/electron/electron/pull/4508
|
||||
description: "Added `activate` option."
|
||||
- pr-url: https://github.com/electron/electron/pull/15065
|
||||
description: "Added `workingDirectory` option."
|
||||
- pr-url: https://github.com/electron/electron/pull/37139
|
||||
description: "Added `logUsage` option."
|
||||
```
|
||||
-->
|
||||
|
||||
* `url` string - Max 2081 characters on Windows.
|
||||
* `options` Object (optional)
|
||||
* `activate` boolean (optional) _macOS_ - `true` to bring the opened application to the foreground. The default is `true`.
|
||||
@@ -50,6 +70,14 @@ Open the given external protocol URL in the desktop's default manner. (For examp
|
||||
|
||||
### `shell.trashItem(path)`
|
||||
|
||||
<!--
|
||||
```YAML history
|
||||
added:
|
||||
- pr-url: https://github.com/electron/electron/pull/25114
|
||||
breaking-changes-header: deprecated-shellmoveitemtotrash
|
||||
```
|
||||
-->
|
||||
|
||||
* `path` string - path to the item to be moved to the trash.
|
||||
|
||||
Returns `Promise<void>` - Resolves when the operation has been completed.
|
||||
@@ -58,6 +86,10 @@ Rejects if there was an error while deleting the requested item.
|
||||
This moves a path to the OS-specific trash location (Trash on macOS, Recycle
|
||||
Bin on Windows, and a desktop-environment-specific location on Linux).
|
||||
|
||||
The path must use the default path separator for the platform (backslash on
|
||||
Windows). Use `path.resolve()` from the `node:path` module to ensure correct
|
||||
handling on all filesystems.
|
||||
|
||||
### `shell.beep()`
|
||||
|
||||
Play the beep sound.
|
||||
|
||||
@@ -72,6 +72,9 @@
|
||||
some GTK+3 desktop environments. Default is `false`.
|
||||
* `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.
|
||||
When you add a [`View`](../view.md) to a `BaseWindow`, you'll need to call
|
||||
[`view.setBackgroundColor`](../view.md#viewsetbackgroundcolorcolor) with a transparent
|
||||
background color on that view to make its background transparent as well.
|
||||
* `type` string (optional) - The type of window, default is normal window. See more about
|
||||
this below.
|
||||
* `visualEffectState` string (optional) _macOS_ - Specify how the material
|
||||
@@ -99,9 +102,9 @@
|
||||
* `trafficLightPosition` [Point](point.md) (optional) _macOS_ -
|
||||
Set a custom position for the traffic light buttons in frameless windows.
|
||||
* `roundedCorners` boolean (optional) _macOS_ _Windows_ - Whether frameless window
|
||||
should have rounded corners. Default is `true`. Setting this property
|
||||
to `false` will prevent the window from being fullscreenable on macOS.
|
||||
On Windows versions older than Windows 11 Build 22000 this property has no effect, and frameless windows will not have rounded corners.
|
||||
should have rounded corners. Default is `true`. On Windows versions older than
|
||||
Windows 11 Build 22000 this property has no effect, and frameless windows will
|
||||
not have rounded corners.
|
||||
* `thickFrame` boolean (optional) _Windows_ - Use `WS_THICKFRAME` style for
|
||||
frameless windows on Windows, which adds the standard window frame. Setting it
|
||||
to `false` will remove window shadow and window animations, and disable window
|
||||
|
||||
13
docs/api/structures/shared-texture-import-texture-info.md
Normal file
13
docs/api/structures/shared-texture-import-texture-info.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# SharedTextureImportTextureInfo Object
|
||||
|
||||
* `pixelFormat` string - The pixel format of the texture.
|
||||
* `bgra` - 32bpp BGRA (byte-order), 1 plane.
|
||||
* `rgba` - 32bpp RGBA (byte-order), 1 plane.
|
||||
* `rgbaf16` - Half float RGBA, 1 plane.
|
||||
* `nv12` - 12bpp with Y plane followed by a 2x2 interleaved UV plane.
|
||||
* `p010le` - 4:2:0 10-bit YUV (little-endian), Y plane followed by a 2x2 interleaved UV plane.
|
||||
* `colorSpace` [ColorSpace](color-space.md) (optional) - The color space of the texture.
|
||||
* `codedSize` [Size](size.md) - The full dimensions of the shared texture.
|
||||
* `visibleRect` [Rectangle](rectangle.md) (optional) - A subsection of [0, 0, codedSize.width, codedSize.height]. In common cases, it is the full section area.
|
||||
* `timestamp` number (optional) - A timestamp in microseconds that will be reflected to `VideoFrame`.
|
||||
* `handle` [SharedTextureHandle](shared-texture-handle.md) - The shared texture handle.
|
||||
9
docs/api/structures/shared-texture-imported-subtle.md
Normal file
9
docs/api/structures/shared-texture-imported-subtle.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# SharedTextureImportedSubtle Object
|
||||
|
||||
* `getVideoFrame` Function\<[VideoFrame](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame)\> - Create a `VideoFrame` that uses the imported shared texture in the current process. You can call `VideoFrame.close()` once you've finished using the object. The underlying resources will wait for GPU finish internally.
|
||||
* `release` Function - Release the resources. If you transferred and get multiple `SharedTextureImported` objects, you have to `release` every one of them. The resource on the GPU process will be destroyed when the last one is released.
|
||||
* `callback` Function (optional) - Callback when the GPU command buffer finishes using this shared texture. It provides a precise event to safely release dependent resources. For example, if this object is created by `finishTransferSharedTexture`, you can use this callback to safely release the original one that called `startTransferSharedTexture` in other processes. You can also release the source shared texture that was used to `importSharedTexture` safely.
|
||||
* `startTransferSharedTexture` Function\<[SharedTextureTransfer](shared-texture-transfer.md)\> - Create a `SharedTextureTransfer` that can be serialized and transferred to other processes.
|
||||
* `getFrameCreationSyncToken` Function\<[SharedTextureSyncToken](shared-texture-sync-token.md)\> - This method is for advanced users. If used, it is typically called after `finishTransferSharedTexture`, and should be passed to the object which was called `startTransferSharedTexture` to prevent the source object release the underlying resource before the target object actually acquire the reference at gpu process asyncly.
|
||||
* `setReleaseSyncToken` Function - This method is for advanced users. If used, this object's underlying resource will not be released until the set sync token is fulfilled at gpu process. By using sync tokens, users are not required to use release callbacks for lifetime management.
|
||||
* `syncToken` [SharedTextureSyncToken](shared-texture-sync-token.md) - The sync token to set.
|
||||
6
docs/api/structures/shared-texture-imported.md
Normal file
6
docs/api/structures/shared-texture-imported.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# SharedTextureImported Object
|
||||
|
||||
* `textureId` string - The unique identifier of the imported shared texture.
|
||||
* `getVideoFrame` Function\<[VideoFrame](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame)\> - Create a `VideoFrame` that uses the imported shared texture in the current process. You can call `VideoFrame.close()` once you've finished using the object. The underlying resources will wait for GPU finish internally.
|
||||
* `release` Function - Release this object's reference of the imported shared texture. The underlying resource will be alive until every reference is released.
|
||||
* `subtle` [SharedTextureImportedSubtle](shared-texture-imported-subtle.md) - Provides subtle APIs to interact with the imported shared texture for advanced users.
|
||||
6
docs/api/structures/shared-texture-subtle.md
Normal file
6
docs/api/structures/shared-texture-subtle.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# SharedTextureSubtle Object
|
||||
|
||||
* `importSharedTexture` Function\<[SharedTextureImportedSubtle](shared-texture-imported-subtle.md)\> - Imports the shared texture from the given options. Returns the imported shared texture.
|
||||
* `textureInfo` [SharedTextureImportTextureInfo](shared-texture-import-texture-info.md) - The information of shared texture to import.
|
||||
* `finishTransferSharedTexture` Function\<[SharedTextureImportedSubtle](shared-texture-imported-subtle.md)\> - Finishes the transfer of the shared texture and gets the transferred shared texture. Returns the imported shared texture from the transfer object.
|
||||
* `transfer` [SharedTextureTransfer](shared-texture-transfer.md) - The transfer object of the shared texture.
|
||||
3
docs/api/structures/shared-texture-sync-token.md
Normal file
3
docs/api/structures/shared-texture-sync-token.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# SharedTextureSyncToken Object
|
||||
|
||||
* `syncToken` string - The opaque data for sync token.
|
||||
10
docs/api/structures/shared-texture-transfer.md
Normal file
10
docs/api/structures/shared-texture-transfer.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# SharedTextureTransfer Object
|
||||
|
||||
* `transfer` string _Readonly_ - The opaque transfer data of the shared texture. This can be transferred across Electron processes.
|
||||
* `syncToken` string _Readonly_ - The opaque sync token data for frame creation.
|
||||
* `pixelFormat` string _Readonly_ - The pixel format of the transferring texture.
|
||||
* `codedSize` [Size](size.md) _Readonly_ - The full dimensions of the shared texture.
|
||||
* `visibleRect` [Rectangle](rectangle.md) _Readonly_ - A subsection of [0, 0, codedSize.width(), codedSize.height()]. In common cases, it is the full section area.
|
||||
* `timestamp` number _Readonly_ - A timestamp in microseconds that will be reflected to `VideoFrame`.
|
||||
|
||||
Use `sharedTexture.subtle.finishTransferSharedTexture` to get [`SharedTextureImportedSubtle`](shared-texture-imported-subtle.md) back.
|
||||
@@ -94,6 +94,7 @@
|
||||
The actual output pixel format and color space of the texture should refer to [`OffscreenSharedTexture`](../structures/offscreen-shared-texture.md) object in the `paint` event.
|
||||
* `argb` - The requested output texture format is 8-bit unorm RGBA, with SRGB SDR color space.
|
||||
* `rgbaf16` - The requested output texture format is 16-bit float RGBA, with scRGB HDR color space.
|
||||
* `deviceScaleFactor` number (optional) _Experimental_ - The device scale factor of the offscreen rendering output. If not set, will use primary display's scale factor as default.
|
||||
* `contextIsolation` boolean (optional) - Whether to run Electron APIs and
|
||||
the specified `preload` script in a separate JavaScript context. Defaults
|
||||
to `true`. The context that the `preload` script runs in will only have
|
||||
@@ -156,6 +157,8 @@
|
||||
`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.
|
||||
* `enableDeprecatedPaste` boolean (optional) _Deprecated_ - Whether to enable the `paste` [execCommand](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand). Default is `false`.
|
||||
* `focusOnNavigation` boolean (optional) - Whether to focus the WebContents
|
||||
when navigating. Default is `true`.
|
||||
|
||||
[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
|
||||
|
||||
@@ -62,7 +62,7 @@ console.log(webContents)
|
||||
### `webContents.getAllWebContents()`
|
||||
|
||||
Returns `WebContents[]` - An array of all `WebContents` instances. This will contain web contents
|
||||
for all windows, webviews, opened devtools, and devtools extension background pages.
|
||||
for all windows, webviews, opened DevTools, and DevTools extension background pages.
|
||||
|
||||
### `webContents.getFocusedWebContents()`
|
||||
|
||||
@@ -958,7 +958,7 @@ win.loadURL('https://github.com')
|
||||
|
||||
#### Event: 'devtools-reload-page'
|
||||
|
||||
Emitted when the devtools window instructs the webContents to reload
|
||||
Emitted when the DevTools window instructs the webContents to reload
|
||||
|
||||
#### Event: 'will-attach-webview'
|
||||
|
||||
@@ -1079,7 +1079,7 @@ Emitted when the [mainFrame](web-contents.md#contentsmainframe-readonly), an `<i
|
||||
Returns `Promise<void>` - the promise will resolve when the page has finished loading
|
||||
(see [`did-finish-load`](web-contents.md#event-did-finish-load)), and rejects
|
||||
if the page fails to load (see
|
||||
[`did-fail-load`](web-contents.md#event-did-fail-load)). A noop rejection handler is already attached, which avoids unhandled rejection errors.
|
||||
[`did-fail-load`](web-contents.md#event-did-fail-load)). A noop rejection handler is already attached, which avoids unhandled rejection errors. If the existing page has a beforeUnload handler, [`did-fail-load`](web-contents.md#event-did-fail-load) will be called unless [`will-prevent-unload`](web-contents.md#event-did-fail-load) is handled.
|
||||
|
||||
Loads the `url` in the window. The `url` must contain the protocol prefix,
|
||||
e.g. the `http://` or `file://`. If the load should bypass http cache then
|
||||
@@ -1865,66 +1865,20 @@ Removes the specified path from DevTools workspace.
|
||||
|
||||
* `devToolsWebContents` WebContents
|
||||
|
||||
Uses the `devToolsWebContents` as the target `WebContents` to show devtools.
|
||||
Uses the `devToolsWebContents` as the target `WebContents` to show DevTools.
|
||||
|
||||
The `devToolsWebContents` must not have done any navigation, and it should not
|
||||
be used for other purposes after the call.
|
||||
|
||||
By default Electron manages the devtools by creating an internal `WebContents`
|
||||
By default, Electron manages the DevTools by creating an internal `WebContents`
|
||||
with native view, which developers have very limited control of. With the
|
||||
`setDevToolsWebContents` method, developers can use any `WebContents` to show
|
||||
the devtools in it, including `BrowserWindow`, `BrowserView` and `<webview>`
|
||||
tag.
|
||||
the DevTools in it, such as [`BrowserWindow`](./browser-window.md) or [`WebContentsView`](./web-contents-view.md).
|
||||
|
||||
Note that closing the devtools does not destroy the `devToolsWebContents`, it
|
||||
is caller's responsibility to destroy `devToolsWebContents`.
|
||||
Note that closing the DevTools does not destroy the `devToolsWebContents`, it
|
||||
is the caller's responsibility to destroy `devToolsWebContents` manually.
|
||||
|
||||
An example of showing devtools in a `<webview>` tag:
|
||||
|
||||
```html
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
* { margin: 0; }
|
||||
#browser { height: 70%; }
|
||||
#devtools { height: 30%; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<webview id="browser" src="https://github.com"></webview>
|
||||
<webview id="devtools" src="about:blank"></webview>
|
||||
<script>
|
||||
const { ipcRenderer } = require('electron')
|
||||
const emittedOnce = (element, eventName) => new Promise(resolve => {
|
||||
element.addEventListener(eventName, event => resolve(event), { once: true })
|
||||
})
|
||||
const browserView = document.getElementById('browser')
|
||||
const devtoolsView = document.getElementById('devtools')
|
||||
const browserReady = emittedOnce(browserView, 'dom-ready')
|
||||
const devtoolsReady = emittedOnce(devtoolsView, 'dom-ready')
|
||||
Promise.all([browserReady, devtoolsReady]).then(() => {
|
||||
const targetId = browserView.getWebContentsId()
|
||||
const devtoolsId = devtoolsView.getWebContentsId()
|
||||
ipcRenderer.send('open-devtools', targetId, devtoolsId)
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```js
|
||||
// Main process
|
||||
const { ipcMain, webContents } = require('electron')
|
||||
|
||||
ipcMain.on('open-devtools', (event, targetContentsId, devtoolsContentsId) => {
|
||||
const target = webContents.fromId(targetContentsId)
|
||||
const devtools = webContents.fromId(devtoolsContentsId)
|
||||
target.setDevToolsWebContents(devtools)
|
||||
target.openDevTools()
|
||||
})
|
||||
```
|
||||
|
||||
An example of showing devtools in a `BrowserWindow`:
|
||||
An example of showing DevTools in a `BrowserWindow`:
|
||||
|
||||
```js title='main.js'
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
@@ -1944,31 +1898,31 @@ app.whenReady().then(() => {
|
||||
#### `contents.openDevTools([options])`
|
||||
|
||||
* `options` Object (optional)
|
||||
* `mode` string - Opens the devtools with specified dock state, can be
|
||||
* `mode` string - Opens the DevTools with specified dock state, can be
|
||||
`left`, `right`, `bottom`, `undocked`, `detach`. Defaults to last used dock state.
|
||||
In `undocked` mode it's possible to dock back. In `detach` mode it's not.
|
||||
* `activate` boolean (optional) - Whether to bring the opened devtools window
|
||||
* `activate` boolean (optional) - Whether to bring the opened DevTools window
|
||||
to the foreground. The default is `true`.
|
||||
* `title` string (optional) - A title for the DevTools window (only in `undocked` or `detach` mode).
|
||||
|
||||
Opens the devtools.
|
||||
Opens the DevTools.
|
||||
|
||||
When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
|
||||
explicitly passing an empty `mode` can force using last used dock state.
|
||||
|
||||
On Windows, if Windows Control Overlay is enabled, Devtools will be opened with `mode: 'detach'`.
|
||||
On Windows, if Windows Control Overlay is enabled, DevTools will be opened with `mode: 'detach'`.
|
||||
|
||||
#### `contents.closeDevTools()`
|
||||
|
||||
Closes the devtools.
|
||||
Closes the DevTools view.
|
||||
|
||||
#### `contents.isDevToolsOpened()`
|
||||
|
||||
Returns `boolean` - Whether the devtools is opened.
|
||||
Returns `boolean` - Whether the DevTools view is opened.
|
||||
|
||||
#### `contents.isDevToolsFocused()`
|
||||
|
||||
Returns `boolean` - Whether the devtools view is focused .
|
||||
Returns `boolean` - Whether the DevTools view is focused .
|
||||
|
||||
#### `contents.getDevToolsTitle()`
|
||||
|
||||
@@ -2410,7 +2364,8 @@ A [`NavigationHistory`](navigation-history.md) used by this webContents.
|
||||
|
||||
#### `contents.hostWebContents` _Readonly_
|
||||
|
||||
A [`WebContents`](web-contents.md) instance that might own this `WebContents`.
|
||||
A `WebContents | null` property that represents a [`WebContents`](web-contents.md)
|
||||
instance that might own this `WebContents`.
|
||||
|
||||
#### `contents.devToolsWebContents` _Readonly_
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ dispatch errors of isolated worlds to foreign worlds.
|
||||
* `info` Object
|
||||
* `securityOrigin` string (optional) - Security origin for the isolated world.
|
||||
* `csp` string (optional) - Content Security Policy for the isolated world.
|
||||
* `name` string (optional) - Name for isolated world. Useful in devtools.
|
||||
* `name` string (optional) - Name for isolated world. Useful in DevTools.
|
||||
|
||||
Set the security origin, content security policy and name of the isolated world.
|
||||
|
||||
|
||||
@@ -12,6 +12,37 @@ This document uses the following convention to categorize breaking changes:
|
||||
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
|
||||
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
|
||||
|
||||
## Planned Breaking API Changes (42.0)
|
||||
|
||||
### Behavior Changed: Offscreen rendering will use `1.0` as default device scale factor.
|
||||
|
||||
Previously, OSR used the primary display's device scale factor for rendering, which made the output frame size vary across users.
|
||||
Developers had to manually calculate the correct size using `screen.getPrimaryDisplay().scaleFactor`. We now provide an optional property
|
||||
`webPreferences.offscreen.deviceScaleFactor` to specify a custom value when creating an OSR window. At first, if the property is not set, it defaults
|
||||
to the primary display's scale factor (preserving the old behavior). Starting from Electron 42, the default will change to a constant value of `1.0`
|
||||
for more consistent output sizes.
|
||||
|
||||
## Planned Breaking API Changes (41.0)
|
||||
|
||||
### Behavior Changed: PDFs no longer create a separate WebContents
|
||||
|
||||
Previously, PDF resources created a separate guest [WebContents](https://www.electronjs.org/docs/latest/api/web-contents) for rendering. Now, PDFs are rendered within the same WebContents instead. If you have code to detect PDF resources, use the [frame tree](https://www.electronjs.org/docs/latest/api/web-frame-main) instead of WebContents.
|
||||
|
||||
Under the hood, Chromium [enabled](https://chromium-review.googlesource.com/c/chromium/src/+/7239572) a feature that changes PDFs to use out-of-process iframes (OOPIFs) instead of the `MimeHandlerViewGuest` extension.
|
||||
|
||||
## Planned Breaking API Changes (40.0)
|
||||
|
||||
### Deprecated: `clipboard` API access from renderer processes
|
||||
|
||||
Using the `clipboard` API directly in the renderer process is deprecated.
|
||||
If you want to call this API from a renderer process, place the API call in
|
||||
your preload script and expose it using the [contextBridge](https://www.electronjs.org/docs/latest/api/context-bridge) API.
|
||||
|
||||
### Behavior Changed: MacOS dSYM files now compressed with tar.xz
|
||||
|
||||
Debug symbols for MacOS (dSYM) now use xz compression in order to handle larger file sizes. `dsym.zip` files are now
|
||||
`dsym.tar.xz` files. End users using debug symbols may need to update their zip utilities.
|
||||
|
||||
## Planned Breaking API Changes (39.0)
|
||||
|
||||
### Deprecated: `--host-rules` command line switch
|
||||
@@ -41,7 +72,7 @@ webContents.setWindowOpenHandler((details) => {
|
||||
|
||||
When using shared texture offscreen rendering feature, the `paint` event now emits a more structured object.
|
||||
It moves the `sharedTextureHandle`, `planes`, `modifier` into a unified `handle` property.
|
||||
See [here](https://www.electronjs.org/docs/latest/api/structures/offscreen-shared-texture) for more details.
|
||||
See the [OffscreenSharedTexture](./api/structures/offscreen-shared-texture.md) API structure for more details.
|
||||
|
||||
## Planned Breaking API Changes (38.0)
|
||||
|
||||
@@ -2664,6 +2695,18 @@ Replace with: https://atom.io/download/electron
|
||||
|
||||
The following list includes the breaking API changes made in Electron 2.0.
|
||||
|
||||
### `autoUpdater`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
autoUpdater.setFeedURL(url, headers)
|
||||
// Replace with
|
||||
autoUpdater.setFeedURL({
|
||||
url,
|
||||
headers
|
||||
})
|
||||
```
|
||||
|
||||
### `BrowserWindow`
|
||||
|
||||
```js
|
||||
|
||||
@@ -6,30 +6,104 @@ Follow the guidelines below for building **Electron itself**, for the purposes o
|
||||
|
||||
## Platform prerequisites
|
||||
|
||||
Check the build prerequisites for your platform before proceeding
|
||||
Check the build prerequisites for your platform before proceeding:
|
||||
|
||||
* [macOS](build-instructions-macos.md#prerequisites)
|
||||
* [Linux](build-instructions-linux.md#prerequisites)
|
||||
* [Windows](build-instructions-windows.md#prerequisites)
|
||||
|
||||
## Build Tools
|
||||
## Setting up `@electron/build-tools` (recommended)
|
||||
|
||||
[Electron's Build Tools](https://github.com/electron/build-tools) automate much of the setup for compiling Electron from source with different configurations and build targets. If you wish to set up the environment manually, the instructions are listed below.
|
||||
[Electron Build Tools](https://github.com/electron/build-tools) automate much of the setup for
|
||||
compiling Electron from source with different configurations and build targets.
|
||||
Most of the [manual setup](#manual-setup-advanced) instructions can be replaced by simpler Build Tools commands.
|
||||
|
||||
> [!TIP]
|
||||
> Build Tools also gives you access to [remote execution and caching of build actions](./reclient.md),
|
||||
> which will dramatically improve build times.
|
||||
|
||||
Electron Build Tools can be installed globally from npm:
|
||||
|
||||
```sh
|
||||
npm install -g @electron/build-tools
|
||||
```
|
||||
|
||||
Once installed, the `e` command should be globally available in your command line. The `e init`
|
||||
command bootstraps a local checkout of Electron:
|
||||
|
||||
```sh
|
||||
# The 'Hello, World!' of build-tools: get and build `main`
|
||||
# Choose the directory where Electron's source and build files will reside.
|
||||
# You can specify any path you like; this command defaults to `$PWD/electron`.
|
||||
# If you're going to use multiple branches, you may want something like:
|
||||
# `--root=~/electron/branch` (e.g. `~/electron-gn/main`)
|
||||
e init --root=~/electron --bootstrap testing
|
||||
```
|
||||
|
||||
The `--bootstrap` flag also runs `e sync` (synchronizes source code branches from
|
||||
[`DEPS`](https://github.com/electron/electron/blob/main/DEPS) using
|
||||
[`gclient`](https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/HEAD/README.gclient.md))
|
||||
and `e build` (compiles the Electron binary into the `${root}/src/out` folder).
|
||||
|
||||
> [!IMPORTANT]
|
||||
>
|
||||
> Sometime after the initial `e sync` phase, you will be asked to run `e d rbe login` to auth into
|
||||
> remote build execution and proceed into the build. This may take about 20-30 minutes!
|
||||
|
||||
Once the build is done compiling, you can test it by running `e start` (or by loading it into
|
||||
[Electron Fiddle](http://electronjs.org/fiddle)).
|
||||
|
||||
### Navigating the project
|
||||
|
||||
Some quick tips on building once your checkout is set up:
|
||||
|
||||
* **Directory structure:** Within the project, Chromium code is synced to `${root}/src/` while Electron's code (i.e. code in
|
||||
https://github.com/electron/electron) lives in `${root}/src/electron/`. Note that both directories
|
||||
have their own git repositories.
|
||||
* **Updating your checkout:** Run git commands such as `git checkout <branch>` and `git pull` from `${root}/src/electron`.
|
||||
Whenever you update your commit `HEAD`, make sure to `e sync` before `e build` to sync dependencies
|
||||
such as Chromium and Node.js. This is especially relevant because the Chromium version in
|
||||
[`DEPS`](https://github.com/electron/electron/blob/main/DEPS) changes frequently.
|
||||
* **Rebuilding:** When making changes to code in `${root}/src/electron/` in a local branch, you only need to re-run `e build`.
|
||||
* **Adding patches:** When contributing changes in `${root}/src/` outside of `${root}/src/electron/`, you need to do so
|
||||
via Electron's [patch system](./patches.md). The `e patches` command can export all relevant patches to
|
||||
`${root}/src/electron/patches/` once your code change is ready.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Unless you're applying upstream patches, you should treat `${root}/src/` as a read-only folder and
|
||||
> spend most of your development time in `${root}/src/electron/`. You should not need to make any
|
||||
> changes or run `git` commands in `${root}/src/`.
|
||||
|
||||
> [!TIP]
|
||||
> Detailed documentation for all available `e` commands can be found in the
|
||||
> repository's [README.md](https://github.com/electron/build-tools/blob/main/README.md). You can
|
||||
> also run `e --help` to list all commands and use the `--help` flag on any command to get more
|
||||
> usage info.
|
||||
|
||||
> [!TIP]
|
||||
> For more information on project structure, see the [Source Code Directory Structure](./source-code-directory-structure.md)
|
||||
> guide.
|
||||
|
||||
<details>
|
||||
<!-- markdownlint-disable-next-line MD033 -->
|
||||
<summary><strong>Manual setup (advanced)</strong></summary>
|
||||
|
||||
## Manual setup (advanced)
|
||||
|
||||
Electron uses [GN](https://gn.googlesource.com/gn) for project generation and
|
||||
[ninja](https://ninja-build.org/) for building. Project configurations can
|
||||
be found in the `.gn` and `.gni` files.
|
||||
[siso](https://chromium.googlesource.com/build/+/refs/heads/main/siso/README.md) for building.
|
||||
Project configurations can be found in the `.gn` and `.gni` files in the `electron/electron` repo.
|
||||
|
||||
## GN Files
|
||||
### GN files
|
||||
|
||||
The following `gn` files contain the main rules for building Electron:
|
||||
|
||||
* `BUILD.gn` defines how Electron itself is built and
|
||||
includes the default configurations for linking with Chromium.
|
||||
* `build/args/{testing,release,all}.gn` contain the default build arguments for
|
||||
building Electron.
|
||||
* [`BUILD.gn`](https://github.com/electron/electron/blob/main/BUILD.gn) defines how Electron itself
|
||||
is built and includes the default configurations for linking with Chromium.
|
||||
* [`build/args/{testing,release,all}.gn`](https://github.com/electron/electron/tree/main/build/args)
|
||||
contain the default build arguments for building Electron.
|
||||
|
||||
## GN prerequisites
|
||||
### GN prerequisites
|
||||
|
||||
You'll need to install [`depot_tools`][depot-tools], the toolset
|
||||
used for fetching Chromium and its dependencies.
|
||||
@@ -56,7 +130,7 @@ $ mkdir -p "${GIT_CACHE_PATH}"
|
||||
# This will use about 16G.
|
||||
```
|
||||
|
||||
## Getting the code
|
||||
### Getting the code
|
||||
|
||||
```sh
|
||||
$ mkdir electron && cd electron
|
||||
@@ -68,7 +142,7 @@ $ gclient sync --with_branch_heads --with_tags
|
||||
> Instead of `https://github.com/electron/electron`, you can use your own fork
|
||||
> here (something like `https://github.com/<username>/electron`).
|
||||
|
||||
### A note on pulling/pushing
|
||||
#### A note on pulling/pushing
|
||||
|
||||
If you intend to `git pull` or `git push` from the official `electron`
|
||||
repository in the future, you now need to update the respective folder's
|
||||
@@ -83,12 +157,13 @@ $ git branch --set-upstream-to=origin/main
|
||||
$ cd -
|
||||
```
|
||||
|
||||
:memo: `gclient` works by checking a file called `DEPS` inside the
|
||||
`src/electron` folder for dependencies (like Chromium or Node.js).
|
||||
> [!TIP]
|
||||
> `gclient` works by checking a file called `DEPS` inside the
|
||||
`${root}/src/electron` folder for dependencies (like Chromium or Node.js).
|
||||
Running `gclient sync -f` ensures that all dependencies required
|
||||
to build Electron match that file.
|
||||
|
||||
So, in order to pull, you'd run the following commands:
|
||||
In order to pull, you'd run the following commands:
|
||||
|
||||
```sh
|
||||
$ cd src/electron
|
||||
@@ -96,7 +171,7 @@ $ git pull
|
||||
$ gclient sync -f
|
||||
```
|
||||
|
||||
## Building
|
||||
### Building
|
||||
|
||||
**Set the environment variable for chromium build tools**
|
||||
|
||||
@@ -156,7 +231,7 @@ $ gn gen out/Release --args="import(\`"//electron/build/args/release.gn\`")"
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> This will generate a `out/Testing` or `out/Release` build directory under `src/` with the testing or release build depending upon the configuration passed above. You can replace `Testing|Release` with another names, but it should be a subdirectory of `out`.
|
||||
> This will generate a `out/Testing` or `out/Release` build directory under `${root}/src/` with the testing or release build depending upon the configuration passed above. You can replace `Testing|Release` with another names, but it should be a subdirectory of `out`.
|
||||
|
||||
Also you shouldn't have to run `gn gen` again—if you want to change the build arguments, you can run `gn args out/Testing` to bring up an editor. To see the list of available build configuration options, run `gn args out/Testing --list`.
|
||||
|
||||
@@ -189,7 +264,7 @@ $ ./out/Testing/electron.exe
|
||||
$ ./out/Testing/electron
|
||||
```
|
||||
|
||||
### Packaging
|
||||
#### Packaging
|
||||
|
||||
To package the electron build as a distributable zip file:
|
||||
|
||||
@@ -197,7 +272,7 @@ To package the electron build as a distributable zip file:
|
||||
$ ninja -C out/Release electron:electron_dist_zip
|
||||
```
|
||||
|
||||
### Cross-compiling
|
||||
#### Cross-compiling
|
||||
|
||||
To compile for a platform that isn't the same as the one you're building on,
|
||||
set the `target_cpu` and `target_os` GN arguments. For example, to compile an
|
||||
@@ -223,7 +298,7 @@ and [`target_cpu`][target_cpu values].
|
||||
[target_os values]: https://gn.googlesource.com/gn/+/main/docs/reference.md#built_in-predefined-variables-target_os_the-desired-operating-system-for-the-build-possible-values
|
||||
[target_cpu values]: https://gn.googlesource.com/gn/+/main/docs/reference.md#built_in-predefined-variables-target_cpu_the-desired-cpu-architecture-for-the-build-possible-values
|
||||
|
||||
#### Windows on Arm (experimental)
|
||||
#### Windows on Arm
|
||||
|
||||
To cross-compile for Windows on Arm, [follow Chromium's guide](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/windows_build_instructions.md#Visual-Studio) to get the necessary dependencies, SDK and libraries, then build with `ELECTRON_BUILDING_WOA=1` in your environment before running `gclient sync`.
|
||||
|
||||
@@ -241,12 +316,12 @@ gclient sync -f --with_branch_heads --with_tags
|
||||
|
||||
Next, run `gn gen` as above with `target_cpu="arm64"`.
|
||||
|
||||
## Tests
|
||||
### Tests
|
||||
|
||||
To run the tests, you'll first need to build the test modules against the
|
||||
same version of Node.js that was built as part of the build process. To
|
||||
generate build headers for the modules to compile against, run the following
|
||||
under `src/` directory.
|
||||
under `${root}/src/` directory.
|
||||
|
||||
```sh
|
||||
$ ninja -C out/Testing electron:node_headers
|
||||
@@ -262,7 +337,7 @@ $ npm run test -- \
|
||||
--enable-logging -g 'BrowserWindow module'
|
||||
```
|
||||
|
||||
## Sharing the git cache between multiple machines
|
||||
### Sharing the git cache between multiple machines
|
||||
|
||||
It is possible to share the gclient git cache with other machines by exporting it as
|
||||
SMB share on linux, but only one process/machine can be using the cache at a
|
||||
@@ -284,11 +359,14 @@ This can be set quickly in powershell (ran as administrator):
|
||||
New-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\Lanmanworkstation\Parameters" -Name DirectoryCacheLifetime -Value 0 -PropertyType DWORD -Force
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### gclient sync complains about rebase
|
||||
### `sync` complains about rebase
|
||||
|
||||
If `gclient sync` is interrupted the git tree may be left in a bad state, leading to a cryptic message when running `gclient sync` in the future:
|
||||
If `e sync` (or `gclient sync`) is interrupted, the git tree may be left in a bad state, leading to
|
||||
a cryptic message when running `sync` in the future:
|
||||
|
||||
```plaintext
|
||||
2> Conflict while rebasing this branch.
|
||||
@@ -296,17 +374,19 @@ If `gclient sync` is interrupted the git tree may be left in a bad state, leadin
|
||||
2> See man git-rebase for details.
|
||||
```
|
||||
|
||||
If there are no git conflicts or rebases in `src/electron`, you may need to abort a `git am` in `src`:
|
||||
If there are no git conflicts or rebases in `${root}/src/electron`, you may need to abort a `git am`
|
||||
in `${root}/src`:
|
||||
|
||||
```sh
|
||||
$ cd ../
|
||||
$ git am --abort
|
||||
$ cd electron
|
||||
$ gclient sync -f
|
||||
$ e sync -f
|
||||
```
|
||||
|
||||
This may also happen if you have checked out a branch (as opposed to having a detached head) in `electron/src/`
|
||||
or some other dependency’s repository. If that is the case, a `git checkout --detach HEAD` in the appropriate repository should do the trick.
|
||||
This may also happen if you have checked out a branch (as opposed to having a detached head) in `${root}/src/`
|
||||
or some other dependency’s repository. If that is the case, a `git checkout --detach HEAD` in the
|
||||
appropriate repository should do the trick.
|
||||
|
||||
### I'm being asked for a username/password for chromium-internal.googlesource.com
|
||||
|
||||
@@ -315,16 +395,6 @@ If you see a prompt for `Username for 'https://chrome-internal.googlesource.com'
|
||||
your locally installed version of Visual Studio (by default, `depot_tools` will
|
||||
try to download a Google-internal version that only Googlers have access to).
|
||||
|
||||
### `e` Module not found
|
||||
|
||||
If `e` is not recognized despite running `npm i -g @electron/build-tools`, ie:
|
||||
|
||||
```sh
|
||||
Error: Cannot find module '/Users/<user>/.electron_build_tools/src/e'
|
||||
```
|
||||
|
||||
We recommend installing Node through [nvm](https://github.com/nvm-sh/nvm). This allows for easier Node version management, and is often a fix for missing `e` modules.
|
||||
|
||||
### RBE authentication randomly fails with "Token not valid"
|
||||
|
||||
This could be caused by the local clock time on the machine being off by a small amount. Use [time.is](https://time.is/) to check.
|
||||
|
||||
@@ -6,77 +6,17 @@ Follow the guidelines below for building **Electron itself** on Linux, for the p
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* At least 25GB disk space and 8GB RAM.
|
||||
* Python >= 3.9.
|
||||
* [Node.js](https://nodejs.org/download/) >= 22.12.0
|
||||
* [clang](https://clang.llvm.org/get_started.html) 3.4 or later.
|
||||
* Development headers of GTK 3 and libnotify.
|
||||
Due to Electron's dependency on Chromium, prerequisites and dependencies for Electron change over time. [Chromium's documentation on building on Linux](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/linux/build_instructions.md) has up to date information for building Chromium on Linux. This documentation can generally
|
||||
be followed for building Electron on Linux as well.
|
||||
|
||||
On Ubuntu >= 20.04, install the following libraries:
|
||||
|
||||
```sh
|
||||
$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \
|
||||
libnotify-dev libasound2-dev libcap-dev \
|
||||
libcups2-dev libxtst-dev \
|
||||
libxss1 libnss3-dev gcc-multilib g++-multilib curl \
|
||||
gperf bison python3-dbusmock openjdk-8-jre
|
||||
```
|
||||
|
||||
On Ubuntu < 20.04, install the following libraries:
|
||||
|
||||
```sh
|
||||
$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \
|
||||
libnotify-dev libgnome-keyring-dev \
|
||||
libasound2-dev libcap-dev libcups2-dev libxtst-dev \
|
||||
libxss1 libnss3-dev gcc-multilib g++-multilib curl \
|
||||
gperf bison python-dbusmock openjdk-8-jre
|
||||
```
|
||||
|
||||
On RHEL / CentOS, install the following libraries:
|
||||
|
||||
```sh
|
||||
$ sudo yum install clang dbus-devel gtk3-devel libnotify-devel \
|
||||
libgnome-keyring-devel xorg-x11-server-utils libcap-devel \
|
||||
cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \
|
||||
nss-devel python-dbusmock openjdk-8-jre
|
||||
```
|
||||
|
||||
On Fedora, install the following libraries:
|
||||
|
||||
```sh
|
||||
$ sudo dnf install clang dbus-devel gperf gtk3-devel \
|
||||
libnotify-devel libgnome-keyring-devel libcap-devel \
|
||||
cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \
|
||||
nss-devel python-dbusmock
|
||||
```
|
||||
|
||||
On Arch Linux / Manjaro, install the following libraries:
|
||||
|
||||
```sh
|
||||
$ sudo pacman -Syu base-devel clang libdbus gtk2 libnotify \
|
||||
libgnome-keyring alsa-lib libcap libcups libxtst \
|
||||
libxss nss gcc-multilib curl gperf bison \
|
||||
python2 python-dbusmock jdk8-openjdk
|
||||
```
|
||||
|
||||
Other distributions may offer similar packages for installation via package
|
||||
managers such as pacman. Or one can compile from source code.
|
||||
Additionally, Electron's [Linux dependency installer](https://github.com/electron/build-images/blob/main/tools/install-deps.sh) can be referenced to get the current dependencies that Electron requires in addition to what Chromium installs via [build/install-deps.sh](https://chromium.googlesource.com/chromium/src/+/HEAD/build/install-build-deps.sh).
|
||||
|
||||
### Cross compilation
|
||||
|
||||
If you want to build for an `arm` target you should also install the following
|
||||
dependencies:
|
||||
If you want to build for an `arm` target, you can use Electron's [Linux dependency installer](https://github.com/electron/build-images/blob/main/tools/install-deps.sh) to install the additional dependencies by passing the `--arm argument`:
|
||||
|
||||
```sh
|
||||
$ sudo apt-get install libc6-dev-armhf-cross linux-libc-dev-armhf-cross \
|
||||
g++-arm-linux-gnueabihf
|
||||
```
|
||||
|
||||
Similarly for `arm64`, install the following:
|
||||
|
||||
```sh
|
||||
$ sudo apt-get install libc6-dev-arm64-cross linux-libc-dev-arm64-cross \
|
||||
g++-aarch64-linux-gnu
|
||||
$ sudo install-deps.sh --arm
|
||||
```
|
||||
|
||||
And to cross-compile for `arm` or targets, you should pass the
|
||||
|
||||
@@ -6,7 +6,7 @@ Follow the guidelines below for building **Electron itself** on macOS, for the p
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* macOS >= 11.6.0
|
||||
* macOS >= 12
|
||||
* [Xcode](https://developer.apple.com/technologies/tools/). The exact version
|
||||
needed depends on what branch you are building, but the latest version of
|
||||
Xcode is generally a good bet for building `main`.
|
||||
|
||||
@@ -4,12 +4,40 @@ The source code of Electron is separated into a few parts, mostly
|
||||
following Chromium on the separation conventions.
|
||||
|
||||
You may need to become familiar with
|
||||
[Chromium's multi-process architecture](https://dev.chromium.org/developers/design-documents/multi-process-architecture)
|
||||
[Chromium's multi-process architecture](https://www.chromium.org/developers/design-documents/multi-process-architecture/)
|
||||
to understand the source code better.
|
||||
|
||||
## Structure of Source Code
|
||||
## Project structure
|
||||
|
||||
```diff
|
||||
Electron is a complex project containing multiple upstream dependencies, which are tracked in source
|
||||
control via the [`DEPS`](https://github.com/electron/electron/blob/main/DEPS) file. When
|
||||
[initializing a local Electron checkout](./build-instructions-gn.md), Electron's source code is just one
|
||||
of many nested folders within the project root.
|
||||
|
||||
The project contains a single `src` folder that corresponds a specific git checkout of
|
||||
[Chromium's `src` folder](https://source.chromium.org/chromium/chromium/src). In addition, Electron's
|
||||
repository code is contained in `src/electron` (with its own nested git repository), and other
|
||||
Electron-specific third-party dependencies (e.g. [nan](https://github.com/nodejs/nan) or
|
||||
[node](https://github.com/nodejs/node)) are located in `src/third_party` (along with all other
|
||||
Chromium third-party dependencies, such as WebRTC or ANGLE).
|
||||
|
||||
For all code outside of `src/electron`, Electron-specific code changes are maintained via git patches.
|
||||
See the [Patches](./patches.md) development guide for more information.
|
||||
|
||||
```plaintext
|
||||
Project Root
|
||||
└── src
|
||||
├── electron
|
||||
├── third_party
|
||||
│ ├── nan
|
||||
│ ├── electron_node
|
||||
│ └── ...other third party deps
|
||||
└── ...other folders
|
||||
```
|
||||
|
||||
## Structure of Electron source code
|
||||
|
||||
```plaintext
|
||||
Electron
|
||||
├── build/ - Build configuration files needed to build with GN.
|
||||
├── buildflags/ - Determines the set of features that can be conditionally built.
|
||||
@@ -25,24 +53,23 @@ Electron
|
||||
├── lib/ - JavaScript/TypeScript source code.
|
||||
| ├── browser/ - Main process initialization code.
|
||||
| | ├── api/ - API implementation for main process modules.
|
||||
| | └── remote/ - Code related to the remote module as it is
|
||||
| | used in the main process.
|
||||
| ├── common/ - Relating to logic needed by both main and renderer processes.
|
||||
| | └── api/ - API implementation for modules that can be used in
|
||||
| | both the main and renderer processes
|
||||
| ├── isolated_renderer/ - Handles creation of isolated renderer processes when
|
||||
| | contextIsolation is enabled.
|
||||
| ├── node/ - Initialization code for Node.js in the main process.
|
||||
│ ├── preload_realm/ - Initialization code for sandboxed renderer preload scripts.
|
||||
│ │ └── api/ - API implementation for preload scripts.
|
||||
| ├── renderer/ - Renderer process initialization code.
|
||||
| | ├── api/ - API implementation for renderer process modules.
|
||||
| | ├── extension/ - Code related to use of Chrome Extensions
|
||||
| | | in Electron's renderer process.
|
||||
| | ├── remote/ - Logic that handles use of the remote module in
|
||||
| | | the main process.
|
||||
| | └── web-view/ - Logic that handles the use of webviews in the
|
||||
| | renderer process.
|
||||
| ├── sandboxed_renderer/ - Logic that handles creation of sandboxed renderer
|
||||
| | | processes.
|
||||
| | └── api/ - API implementation for sandboxed renderer processes.
|
||||
│ ├── utility/ - Utility process initialization code.
|
||||
│ │ └── api/ - API implementation for utility process modules.
|
||||
| └── worker/ - Logic that handles proper functionality of Node.js
|
||||
| environments in Web Workers.
|
||||
├── patches/ - Patches applied on top of Electron's core dependencies
|
||||
@@ -67,27 +94,30 @@ Electron
|
||||
| | └── resources/ - Icons, platform-dependent files, etc.
|
||||
| ├── renderer/ - Code that runs in renderer process.
|
||||
| | └── api/ - The implementation of renderer process APIs.
|
||||
| └── common/ - Code that used by both the main and renderer processes,
|
||||
| | including some utility functions and code to integrate node's
|
||||
| | message loop into Chromium's message loop.
|
||||
| └── api/ - The implementation of common APIs, and foundations of
|
||||
| Electron's built-in modules.
|
||||
| ├── common/ - Code that used by both the main and renderer processes,
|
||||
| | | including some helper functions and code to integrate node's
|
||||
| | | message loop into Chromium's message loop.
|
||||
| | └── api/ - The implementation of common APIs, and foundations of
|
||||
| | Electron's built-in modules.
|
||||
│ ├── services/node/ - Provides a Node.js runtime to utility processes.
|
||||
│ └── utility - Code that runs in the utility process.
|
||||
├── spec/ - Components of Electron's test suite run in the main process.
|
||||
├── typings/ - Internal TypeScript types that aren't exported in electron.d.ts.
|
||||
└── BUILD.gn - Building rules of Electron.
|
||||
```
|
||||
|
||||
## Structure of Other Directories
|
||||
## Structure of other Electron directories
|
||||
|
||||
* **.github** - GitHub-specific config files including issues templates, CI with GitHub Actions and CODEOWNERS.
|
||||
* **dist** - Temporary directory created by `script/create-dist.py` script
|
||||
when creating a distribution.
|
||||
* **node_modules** - Third party node modules used for building.
|
||||
* **npm** - Logic for installation of Electron via npm.
|
||||
* **out** - Temporary output directory of `ninja`.
|
||||
* **out** - Temporary output directory for `siso`.
|
||||
* **script** - Scripts used for development purpose like building, packaging,
|
||||
testing, etc.
|
||||
|
||||
```diff
|
||||
```plaintext
|
||||
script/ - The set of all scripts Electron runs for a variety of purposes.
|
||||
├── codesign/ - Fakes codesigning for Electron apps; used for testing.
|
||||
├── lib/ - Miscellaneous python utility scripts.
|
||||
|
||||
@@ -99,7 +99,7 @@ Using `autoUpdater` as an example:
|
||||
|
||||
## Methods
|
||||
|
||||
### `autoUpdater.setFeedURL(url[, requestHeaders])`
|
||||
### `autoUpdater.setFeedURL(options)`
|
||||
```
|
||||
|
||||
### Classes
|
||||
|
||||
@@ -94,7 +94,7 @@ If the extension works on Chrome but not on Electron, file a bug in Electron's
|
||||
[issue tracker][issue-tracker] and describe which part
|
||||
of the extension is not working as expected.
|
||||
|
||||
[devtools-extension]: https://developer.chrome.com/extensions/devtools
|
||||
[devtools-extension]: https://developer.chrome.com/docs/extensions/how-to/devtools/extend-devtools
|
||||
[session]: ../api/session.md
|
||||
[react-devtools]: https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi
|
||||
[load-extension]: ../api/extensions-api.md#extensionsloadextensionpath-options
|
||||
|
||||
@@ -9,7 +9,7 @@ check out our [Electron Versioning](./electron-versioning.md) doc.
|
||||
|
||||
| Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported |
|
||||
| ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- |
|
||||
| 40.0.0 | 2025-Oct-30 | 2025-Dec-03 | 2025-Oct-28 | 2026-Jun-30 | M144 | TBD | ✅ |
|
||||
| 40.0.0 | 2025-Oct-30 | 2025-Dec-03 | 2026-Jan-13 | 2026-Jun-30 | M144 | TBD | ✅ |
|
||||
| 39.0.0 | 2025-Sep-04 | 2025-Oct-01 | 2025-Oct-28 | 2026-May-05 | M142 | v22.20 | ✅ |
|
||||
| 38.0.0 | 2025-Jun-26 | 2025-Aug-06 | 2025-Sep-02 | 2026-Mar-10 | M140 | v22.18 | ✅ |
|
||||
| 37.0.0 | 2025-May-01 | 2025-May-28 | 2025-Jun-24 | 2026-Jan-13 | M138 | v22.16 | ✅ |
|
||||
|
||||
@@ -110,4 +110,10 @@ the item is a Markdown file located in the root of the project:
|
||||
|
||||

|
||||
|
||||
## Dragging files into your app
|
||||
|
||||
You can use the standard
|
||||
[Drag and Drop web API](https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API)
|
||||
for dragging and dropping files into your app.
|
||||
|
||||
[`contextBridge`]: ../api/context-bridge.md
|
||||
|
||||
@@ -60,7 +60,7 @@ at once, consider the [Chrome Tracing](https://www.chromium.org/developers/how-t
|
||||
## Checklist: Performance recommendations
|
||||
|
||||
Chances are that your app could be a little leaner, faster, and generally less
|
||||
resource-hungry if you attempt these steps.
|
||||
resource-hungry if you avoid the following common pitfalls.
|
||||
|
||||
1. [Carelessly including modules](#1-carelessly-including-modules)
|
||||
2. [Loading and running code too soon](#2-loading-and-running-code-too-soon)
|
||||
|
||||
@@ -118,13 +118,6 @@ You should at least follow these steps to improve the security of your applicati
|
||||
19. [Check which fuses you can change](#19-check-which-fuses-you-can-change)
|
||||
20. [Do not expose Electron APIs to untrusted web content](#20-do-not-expose-electron-apis-to-untrusted-web-content)
|
||||
|
||||
To automate the detection of misconfigurations and insecure patterns, it is
|
||||
possible to use
|
||||
[Electronegativity](https://github.com/doyensec/electronegativity). For
|
||||
additional details on potential weaknesses and implementation bugs when
|
||||
developing applications using Electron, please refer to this
|
||||
[guide for developers and auditors](https://doyensec.com/resources/us-17-Carettoni-Electronegativity-A-Study-Of-Electron-Security-wp.pdf).
|
||||
|
||||
### 1. Only load secure content
|
||||
|
||||
Any resources not included with your application should be loaded using a
|
||||
|
||||
@@ -44,11 +44,25 @@ have to worry about wiring them all together.
|
||||
You can install Electron Forge's CLI in your project's `devDependencies` and import your
|
||||
existing project with a handy conversion script.
|
||||
|
||||
```sh npm2yarn
|
||||
<Tabs>
|
||||
<TabItem value="npm" label="npm">
|
||||
|
||||
```sh
|
||||
npm install --save-dev @electron-forge/cli
|
||||
npx electron-forge import
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="yarn" label="Yarn">
|
||||
|
||||
```sh
|
||||
yarn add --dev @electron-forge/cli
|
||||
yarn electron-forge import
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
Once the conversion script is done, Forge should have added a few scripts
|
||||
to your `package.json` file.
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ auto_filenames = {
|
||||
"docs/api/service-workers.md",
|
||||
"docs/api/session.md",
|
||||
"docs/api/share-menu.md",
|
||||
"docs/api/shared-texture.md",
|
||||
"docs/api/shell.md",
|
||||
"docs/api/structures",
|
||||
"docs/api/system-preferences.md",
|
||||
@@ -145,6 +146,12 @@ auto_filenames = {
|
||||
"docs/api/structures/shared-dictionary-info.md",
|
||||
"docs/api/structures/shared-dictionary-usage-info.md",
|
||||
"docs/api/structures/shared-texture-handle.md",
|
||||
"docs/api/structures/shared-texture-import-texture-info.md",
|
||||
"docs/api/structures/shared-texture-imported-subtle.md",
|
||||
"docs/api/structures/shared-texture-imported.md",
|
||||
"docs/api/structures/shared-texture-subtle.md",
|
||||
"docs/api/structures/shared-texture-sync-token.md",
|
||||
"docs/api/structures/shared-texture-transfer.md",
|
||||
"docs/api/structures/shared-worker-info.md",
|
||||
"docs/api/structures/sharing-item.md",
|
||||
"docs/api/structures/shortcut-details.md",
|
||||
@@ -176,6 +183,7 @@ auto_filenames = {
|
||||
"lib/renderer/api/context-bridge.ts",
|
||||
"lib/renderer/api/crash-reporter.ts",
|
||||
"lib/renderer/api/ipc-renderer.ts",
|
||||
"lib/renderer/api/shared-texture.ts",
|
||||
"lib/renderer/api/web-frame.ts",
|
||||
"lib/renderer/api/web-utils.ts",
|
||||
"lib/renderer/common-init.ts",
|
||||
@@ -257,6 +265,7 @@ auto_filenames = {
|
||||
"lib/browser/api/service-worker-main.ts",
|
||||
"lib/browser/api/session.ts",
|
||||
"lib/browser/api/share-menu.ts",
|
||||
"lib/browser/api/shared-texture.ts",
|
||||
"lib/browser/api/system-preferences.ts",
|
||||
"lib/browser/api/touch-bar.ts",
|
||||
"lib/browser/api/tray.ts",
|
||||
@@ -312,6 +321,7 @@ auto_filenames = {
|
||||
"lib/renderer/api/exports/electron.ts",
|
||||
"lib/renderer/api/ipc-renderer.ts",
|
||||
"lib/renderer/api/module-list.ts",
|
||||
"lib/renderer/api/shared-texture.ts",
|
||||
"lib/renderer/api/web-frame.ts",
|
||||
"lib/renderer/api/web-utils.ts",
|
||||
"lib/renderer/common-init.ts",
|
||||
@@ -352,6 +362,7 @@ auto_filenames = {
|
||||
"lib/renderer/api/exports/electron.ts",
|
||||
"lib/renderer/api/ipc-renderer.ts",
|
||||
"lib/renderer/api/module-list.ts",
|
||||
"lib/renderer/api/shared-texture.ts",
|
||||
"lib/renderer/api/web-frame.ts",
|
||||
"lib/renderer/api/web-utils.ts",
|
||||
"lib/renderer/ipc-renderer-bindings.ts",
|
||||
|
||||
@@ -194,6 +194,8 @@ filenames = {
|
||||
"shell/common/api/electron_api_clipboard_mac.mm",
|
||||
"shell/common/api/electron_api_native_image_mac.mm",
|
||||
"shell/common/asar/archive_mac.mm",
|
||||
"shell/common/asar/integrity_digest.h",
|
||||
"shell/common/asar/integrity_digest.mm",
|
||||
"shell/common/application_info_mac.mm",
|
||||
"shell/common/language_util_mac.mm",
|
||||
"shell/common/mac/main_application_bundle.h",
|
||||
@@ -456,7 +458,6 @@ filenames = {
|
||||
"shell/browser/net/system_network_context_manager.h",
|
||||
"shell/browser/net/url_loader_network_observer.cc",
|
||||
"shell/browser/net/url_loader_network_observer.h",
|
||||
"shell/browser/net/web_request_api_interface.h",
|
||||
"shell/browser/network_hints_handler_impl.cc",
|
||||
"shell/browser/network_hints_handler_impl.h",
|
||||
"shell/browser/notifications/notification.cc",
|
||||
@@ -564,6 +565,7 @@ filenames = {
|
||||
"shell/common/api/electron_api_native_image.cc",
|
||||
"shell/common/api/electron_api_native_image.h",
|
||||
"shell/common/api/electron_api_net.cc",
|
||||
"shell/common/api/electron_api_shared_texture.cc",
|
||||
"shell/common/api/electron_api_shell.cc",
|
||||
"shell/common/api/electron_api_testing.cc",
|
||||
"shell/common/api/electron_api_url_loader.cc",
|
||||
@@ -580,6 +582,7 @@ filenames = {
|
||||
"shell/common/asar/asar_util.h",
|
||||
"shell/common/asar/scoped_temporary_file.cc",
|
||||
"shell/common/asar/scoped_temporary_file.h",
|
||||
"shell/common/callback_util.h",
|
||||
"shell/common/color_util.cc",
|
||||
"shell/common/color_util.h",
|
||||
"shell/common/crash_keys.cc",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user