* build: run linux clang-tidy as remotely cached siso build steps
Prototype for the linux-x64 leg. Instead of run-clang-tidy.ts walking
shell/ on the runner's own cores, generate one ninja step per translation
unit and let siso treat it like a compile: include-scan the inputs, look
the action up in the RBE cache, and execute misses on the worker pool.
- script/gen-clang-tidy-ninja.py writes out/<dir>/clang_tidy.ninja from
compile_commands.json: `run-clang-tidy-action.sh <clang++> <flags> -c
<src> -o <stamp>` per shell/ TU, with a gcc depfile so ninja/siso track
header deps.
- build/run-clang-tidy-action.sh runs clang-tidy with
--warnings-as-errors=* (so only clean results are cached), then
`clang -M` for the depfile, then touches the stamp.
- build/siso/main.star is build-tools' siso entry file plus an
`electron/clang-tidy` step rule (remote, clang-tidy/.clang-tidy files as
inputs); the tidy job points ELECTRON_BUILD_TOOLS_MAIN_STAR at it.
- The linux leg of the clang-tidy segment now does `e init --remote-build
siso`, gn gen with compile commands for //electron:*, generates the
ninja file and runs `e build -f clang_tidy.ninja electron_clang_tidy`.
It gets ELECTRON_RBE_JWT for that. mac and win legs are unchanged.
Measured against out/Testing on rbe.notgoma.com: 343 TUs, cold run all
remote in 115 s wall (150 CPU-min of work, bounded by the slowest TU),
fully cached rerun 2.3 s, and a planted finding fails the step with the
diagnostic and is not cached.
* build: tidy up the clang-tidy step generator and wrapper
* build: run macOS and Windows clang-tidy through siso too
- gen-clang-tidy-ninja.py understands clang-cl commands (drops /c, /Fo,
/Fd, /showIncludes) and emits `deps = msvc` for them, which is also what
tells siso to parse the command cl-style when scanning for #includes.
- run-clang-tidy-action.sh: for clang-cl, run clang-tidy in cl driver mode
and report headers via /showIncludes; when the host toolchain isn't
runnable (macOS binaries on the Linux workers) use the Linux one that
clang_remote_wrapper stages under Release+Asserts_linux.
- build/siso/main.star: off Linux, run the tidy step through
clang_remote_wrapper with the Linux clang and clang-tidy as inputs, like
the clang rules.
- The clang-tidy segment uses the siso path on every platform; on macOS it
first generates the reclient configs (which fetches the Linux clang) and
downloads the Linux clang-tidy package next to it.
* build: hand clang-tidy a one-entry compile db so clang-cl keeps a relative source path
clang-tidy appends an absolute source path to `-- <flags>` commands, and on the RBE workers that path starts with /worker, which the cl driver parses as a /w option ('no input files'). A compilation database entry keeps the command as written.
* build: upload siso metrics from the clang-tidy job
* build: install the macOS siso binary in the clang-tidy job
* build: one clang-tidy step per object, not per source file
A source built by several targets (electron_app and the helper app on macOS) has several compile commands with different flags; picking one by source path was order-dependent and cost two cache misses per run. Key steps on the object path instead.
* build: sync build/siso/main.star with the current build-tools pin
* build: use build-tools' clang-tidy siso rule
electron/build-tools#896 carries the electron/clang-tidy rule, so bump the build-tools pin to it and drop the in-repo copy of build-tools' main.star and the ELECTRON_BUILD_TOOLS_MAIN_STAR override. The pin bump also picks up electron/build-tools#895 (retry the initial depot_tools clone).
* build: set clang-tidy's header filter in .clang-tidy
Both clang-tidy entry points passed their own --header-filter. Set HeaderFilterRegex in .clang-tidy instead so they can't diverge. This clang-tidy reports header diagnostics when no filter is set, so the flags and the config change together.
* build: run gn gen from gen-clang-tidy-ninja.py
The steps are only right if compile_commands.json matches the out dir, so the generator now regenerates it instead of trusting an old one. Also say that the generator and the wrapper are CI plumbing, and what a local run needs.
* build: bump build-tools for nested .clang-tidy configs
Picks up electron/build-tools#897, which sends any .clang-tidy under electron/shell to the RBE worker and into the cache key.
📝 Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪. View these docs in other languages on our Crowdin project.
The Electron framework lets you write cross-platform desktop applications using JavaScript, HTML and CSS. It is based on Node.js and Chromium and is used by the Visual Studio Code and many other apps.
Follow @electronjs on Twitter for important announcements.
This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to coc@electronjs.org.
Installation
To install prebuilt Electron binaries, use npm.
The preferred method is to install Electron as a development dependency in your
app:
npm install electron --save-dev
For more installation options and troubleshooting tips, see installation. For info on how to manage Electron versions in your apps, see Electron versioning.
Platform support
Each Electron release provides binaries for macOS, Windows, and Linux.
- macOS (Ventura and up): Electron provides 64-bit Intel and Apple Silicon / ARM binaries for macOS.
- Windows (Windows 10 and up): Electron provides
x64(amd64) andarm64binaries for Windows. - Linux: Electron provides
x64(amd64) andarm64binaries for Linux. Electron supports major Linux distributions (e.g., Ubuntu, Fedora, Debian) in versions that are still supported by both Chromium and the distro maker (without requiring a paid subscription). The prebuilt binaries are built on Ubuntu.
In general, Electron tries to align with Chromium on platform support.
Electron Fiddle
Use Electron Fiddle
to build, run, and package small Electron experiments, to see code examples for all of Electron's APIs, and
to try out different versions of Electron. It's designed to make the start of your journey with
Electron easier.
Resources for learning Electron
- electronjs.org/docs - All of Electron's documentation
- electron/fiddle - A tool to build, run, and package small Electron experiments
- electronjs.org/community#boilerplates - Sample starter apps created by the community
Programmatic usage
Most people use Electron from the command line, but if you require electron inside
your Node app (not your Electron app) it will return the file path to the
binary. Use this to spawn Electron from Node scripts:
const electron = require('electron')
const proc = require('node:child_process')
// will print something similar to /Users/maf/.../Electron
console.log(electron)
// spawn Electron
const child = proc.spawn(electron)
Mirrors
See the Advanced Installation Instructions to learn how to use a custom mirror.
Documentation translations
We crowdsource translations for our documentation via Crowdin. We currently accept translations for Chinese (Simplified), French, German, Japanese, Portuguese, Russian, and Spanish.
Contributing
If you are interested in reporting/fixing issues and contributing directly to the code base, please see CONTRIBUTING.md for more information on what we're looking for and how to get started.
Community
Info on reporting bugs, getting help, finding third-party tools and sample apps, and more can be found on the Community page.
License
When using Electron logos, make sure to follow OpenJS Foundation Trademark Policy.