|
| 1 | +//! This module defines the `Build` struct, which represents the `[build]` table |
| 2 | +//! in the `bootstrap.toml` configuration file. |
| 3 | +//! |
| 4 | +//! The `[build]` table contains global options that influence the overall build process, |
| 5 | +//! such as default host and target triples, paths to tools, build directories, and |
| 6 | +//! various feature flags. These options apply across different stages and components |
| 7 | +//! unless specifically overridden by other configuration sections or command-line flags. |
| 8 | +
|
| 9 | +use serde::{Deserialize, Deserializer}; |
| 10 | + |
| 11 | +use crate::core::config::toml::ReplaceOpt; |
| 12 | +use crate::core::config::{Merge, StringOrBool}; |
| 13 | +use crate::{HashSet, PathBuf, define_config, exit}; |
| 14 | + |
| 15 | +define_config! { |
| 16 | + /// TOML representation of various global build decisions. |
| 17 | + #[derive(Default)] |
| 18 | + struct Build { |
| 19 | + build: Option<String> = "build", |
| 20 | + description: Option<String> = "description", |
| 21 | + host: Option<Vec<String>> = "host", |
| 22 | + target: Option<Vec<String>> = "target", |
| 23 | + build_dir: Option<String> = "build-dir", |
| 24 | + cargo: Option<PathBuf> = "cargo", |
| 25 | + rustc: Option<PathBuf> = "rustc", |
| 26 | + rustfmt: Option<PathBuf> = "rustfmt", |
| 27 | + cargo_clippy: Option<PathBuf> = "cargo-clippy", |
| 28 | + docs: Option<bool> = "docs", |
| 29 | + compiler_docs: Option<bool> = "compiler-docs", |
| 30 | + library_docs_private_items: Option<bool> = "library-docs-private-items", |
| 31 | + docs_minification: Option<bool> = "docs-minification", |
| 32 | + submodules: Option<bool> = "submodules", |
| 33 | + gdb: Option<String> = "gdb", |
| 34 | + lldb: Option<String> = "lldb", |
| 35 | + nodejs: Option<String> = "nodejs", |
| 36 | + npm: Option<String> = "npm", |
| 37 | + python: Option<String> = "python", |
| 38 | + reuse: Option<String> = "reuse", |
| 39 | + locked_deps: Option<bool> = "locked-deps", |
| 40 | + vendor: Option<bool> = "vendor", |
| 41 | + full_bootstrap: Option<bool> = "full-bootstrap", |
| 42 | + bootstrap_cache_path: Option<PathBuf> = "bootstrap-cache-path", |
| 43 | + extended: Option<bool> = "extended", |
| 44 | + tools: Option<HashSet<String>> = "tools", |
| 45 | + verbose: Option<usize> = "verbose", |
| 46 | + sanitizers: Option<bool> = "sanitizers", |
| 47 | + profiler: Option<bool> = "profiler", |
| 48 | + cargo_native_static: Option<bool> = "cargo-native-static", |
| 49 | + low_priority: Option<bool> = "low-priority", |
| 50 | + configure_args: Option<Vec<String>> = "configure-args", |
| 51 | + local_rebuild: Option<bool> = "local-rebuild", |
| 52 | + print_step_timings: Option<bool> = "print-step-timings", |
| 53 | + print_step_rusage: Option<bool> = "print-step-rusage", |
| 54 | + check_stage: Option<u32> = "check-stage", |
| 55 | + doc_stage: Option<u32> = "doc-stage", |
| 56 | + build_stage: Option<u32> = "build-stage", |
| 57 | + test_stage: Option<u32> = "test-stage", |
| 58 | + install_stage: Option<u32> = "install-stage", |
| 59 | + dist_stage: Option<u32> = "dist-stage", |
| 60 | + bench_stage: Option<u32> = "bench-stage", |
| 61 | + patch_binaries_for_nix: Option<bool> = "patch-binaries-for-nix", |
| 62 | + // NOTE: only parsed by bootstrap.py, `--feature build-metrics` enables metrics unconditionally |
| 63 | + metrics: Option<bool> = "metrics", |
| 64 | + android_ndk: Option<PathBuf> = "android-ndk", |
| 65 | + optimized_compiler_builtins: Option<bool> = "optimized-compiler-builtins", |
| 66 | + jobs: Option<u32> = "jobs", |
| 67 | + compiletest_diff_tool: Option<String> = "compiletest-diff-tool", |
| 68 | + compiletest_use_stage0_libtest: Option<bool> = "compiletest-use-stage0-libtest", |
| 69 | + ccache: Option<StringOrBool> = "ccache", |
| 70 | + exclude: Option<Vec<PathBuf>> = "exclude", |
| 71 | + } |
| 72 | +} |
0 commit comments