tauri-apps/tauri
tauri-build
Active contributors: Lucas Fernandes Nogueira, Amr Bashir
Purpose
crates/tauri-build is what users [build-dependencies]-on. Their src-tauri/build.rs calls tauri_build::build(), which:
- Parses
tauri.conf.jsonand re-runs the build whenever it changes. - Resolves the application's ACL (capabilities × permissions) into a single
Resolvedblob and emits it toOUT_DIRfor the runtime to consume. - Writes the Windows resource file (
.rc) so the app picks up icon/version metadata. - Embeds the application manifest on Windows (DPI awareness, manifestv1 vs v6 common controls).
- Generates Cargo metadata for mobile targets (
cargo:rustc-link-search=and friends), and helps glob native libraries. - Optionally invokes
tauri-codegento embed assets early, before the main crate build runs.
Directory layout
crates/tauri-build/
├── Cargo.toml
├── src/
│ ├── lib.rs # 24,430 bytes: build() entry, Attributes, options
│ ├── acl.rs # 14.2 KB: resolve permissions+capabilities -> Resolved
│ ├── codegen/ # internal calls into tauri-codegen
│ ├── manifest.rs # tauri.conf.json → Cargo features
│ ├── mobile.rs # mobile target plumbing (Android NDK, iOS metal toolchain)
│ ├── static_vcruntime.rs
│ └── windows-app-manifest.xml
└── build.rsKey abstractions
| Type / function | File | Role |
|---|---|---|
build / try_build |
crates/tauri-build/src/lib.rs |
Public entry. build() panics on error; try_build() returns Result. |
Attributes |
crates/tauri-build/src/lib.rs |
Builder for opting in to extra behaviour (Windows app manifest, codegen pre-embedding, ACL options). |
WindowsAttributes |
crates/tauri-build/src/lib.rs |
.rc content, manifest tweaks, app icon paths. |
acl::resolve_acl |
crates/tauri-build/src/acl.rs |
Read every plugin's permissions/, the app's capabilities/, produce a Resolved. |
manifest::* |
crates/tauri-build/src/manifest.rs |
Translate tauri.conf.json → Cargo cfg(...) and feature emissions. |
mobile::* |
crates/tauri-build/src/mobile.rs |
Mobile-target globbing and tauri-android/ios bridge wiring. |
How it works
graph TD
UserBuild["src-tauri/build.rs<br/>(downstream app)"] -->|"tauri_build::build()"| Entry["lib.rs#build"]
Entry --> ManifestOut["manifest::*<br/>cargo:rustc-cfg, features"]
Entry --> ACLOut["acl::resolve_acl<br/>writes Resolved JSON to OUT_DIR"]
Entry --> WinRC["WindowsAttributes -> embed .rc"]
Entry --> CodegenStep["(optional) tauri-codegen::context_codegen"]
ACLOut -->|read at runtime| TauriCore["tauri::ipc::RuntimeAuthority"]The Resolved ACL written here is what tauri::generate_context! (via tauri-codegen) embeds into the binary. At runtime, RuntimeAuthority reads it.
The Windows manifest XML at crates/tauri-build/src/windows-app-manifest.xml is the default; WindowsAttributes::app_manifest lets users override it.
Cargo features
codegen— pull intauri-codegenso users can also do their asset embedding here.config-json5/config-toml— accept alternative config formats.
Integration points
- Up: every Tauri downstream app's
build.rs. - Down: depends on
tauri-utils(config types, ACL types) and optionallytauri-codegen.
Entry points for modification
| Goal | Start here |
|---|---|
| New Windows manifest behaviour | crates/tauri-build/src/lib.rs (search WindowsAttributes) and windows-app-manifest.xml |
| Change ACL resolution rules | crates/tauri-build/src/acl.rs (mirrors runtime in crates/tauri/src/ipc/authority.rs) |
Change a cfg emitted to user crates |
crates/tauri-build/src/manifest.rs |
| Mobile NDK/Xcode globbing | crates/tauri-build/src/mobile.rs |
See tauri-codegen for the embedding it triggers, and systems/acl-and-capabilities for the ACL story.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.