mozilla/gecko-dev
Tooling
The Firefox build/dev toolchain is large. This page summarizes the moving parts that contributors interact with.
mach: the unified driver
The top-level mach script (with mach.cmd and mach.ps1 for Windows) is implemented in python/mach/. It autoloads mach_commands.py files from across the tree, where commands like build, test, lint, vendor, etc., are registered as Python decorators.
./mach help lists every available command. ./mach <command> --help describes one.
mozbuild: the build engine
python/mozbuild/ is the engine that interprets moz.build, moz.configure, and friends to produce the actual Makefiles and ninja files used during compilation.
Stages of a build:
./mach configure— runsmoz.configure, writesconfig.statusandmozinfo.json../mach build-backend— reads allmoz.buildfiles, generates Makefiles in<objdir>/../mach build— runsmake(which delegates to clang, rustc, javac, etc.)../mach package(release builds) — assembles a shippable tar/dmg/zip.
Configure system
moz.configure files use a Python-with-decorators DSL. Top-level moz.configure imports per-subsystem config files (build/moz.configure/*.configure, etc.). Options become available as --enable-foo / --with-foo flags and as ac_add_options lines in .mozconfig.
Linters
./mach lint orchestrates a suite of linters via tools/lint/:
- eslint — JS lint, configured via
eslint.config.mjsplus the per-directory configs (eslint-file-globals.config.mjs,eslint-ignores.config.mjs,eslint-rollouts.config.mjs,eslint-subdirs.config.mjs,eslint-test-paths.config.mjs). - prettier — formatter for JS/CSS/JSON.
- stylelint — CSS lint.
- clang-format — C/C++ formatter.
- clang-tidy — selected C++ checks.
- rustfmt + clippy — Rust.
- ruff, black — Python.
- codespell — typo checker.
- mots — module ownership consistency.
- license — header / SPDX consistency.
Code generators
| Generator | Input | Output |
|---|---|---|
xpidl (xpcom/idl-parser/) |
*.idl |
C++ headers, typelibs, JS bindings |
WebIDL bindings (dom/bindings/) |
*.webidl |
C++ binding glue (JS ↔ C++) |
IPDL (ipc/ipdl/) |
*.ipdl |
C++ actor classes (*Parent, *Child) |
Glean YAML (toolkit/components/glean/) |
metrics.yaml, pings.yaml |
C++/JS metric APIs |
uniffi-bindgen-gecko-js (toolkit/components/uniffi-bindgen-gecko-js/) |
Rust UniFFI components | JS bindings to Rust |
mozbuild backend (python/mozbuild/) |
moz.build |
Makefiles / ninja |
StaticPrefs (modules/libpref/init/StaticPrefList.yaml) |
YAML | C++ accessor headers |
Vendoring
Third-party Rust crates live under third_party/rust/ and are managed via:
./mach vendor rustThis reads Cargo.toml, downloads crates, runs the supply-chain audit, and regenerates lockfiles. The audit policy lives in supply-chain/ (config.toml, audits.toml, imports.lock).
NPM dependencies for ESLint/prettier/etc. are pinned in package.json and package-lock.json. Mozilla does not use npm for runtime dependencies.
TaskCluster
taskcluster/ defines what runs in CI. Highlights:
taskcluster/config.yml— global config.taskcluster/kinds/— one directory per "kind" (build, test, l10n, …) with task definitions.taskcluster/gecko_taskgraph/— the Python task-graph generator.taskcluster/android_taskgraph/— Android-specific generator.taskcluster/docker/— Dockerfile and tarball builders for CI workers.taskcluster/scripts/— entry-point scripts run inside CI containers.
The decision task on every push reads these files, generates the task graph, and submits it to TaskCluster.
try: the previewing branch
./mach try pushes a snapshot of your tree to a special branch (try) where TaskCluster runs your selected subset of tests. Selectors include:
./mach try fuzzy— interactive selection../mach try auto— heuristic auto-selection../mach try chooser— full taxonomy picker../mach try empty— bare push (just for try server side-effects)../mach try syntax -b do -p all -u all -t none— syntax-style selectors.
Results display on Treeherder.
Other notable tooling
./mach watch— incrementally rebuild on file change../mach addtest— scaffolding for new test files../mach analyze— static-analysis runs../mach python <script>— run any tree script with PYTHONPATH set../mach python-test— run Python unit tests../mach setup/./mach bootstrap— toolchain setup../mach install— install the built browser somewhere../mach tps— Sync TPS tests.
Editor integrations
- VS Code — Mozilla provides a workspace via
./mach ide vscode. Includes recommended extensions and clangd config. - Other —
./mach ide eclipse,./mach ide visualstudio(Windows), etc.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.