gnrt_config.toml (4612B)
1 # Copyright 2023 The Chromium Authors 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 # Provides per-crate and overall configuration options to gnrt. 6 # 7 # Most commonly needed configuration options can be found in the top-level doc 8 # comment in //third_party/rust/chromium_crates_io/gnrt_config.toml. As a 9 # fallback, one may also read the doc comments in 10 # `//tools/crates/gnrt/lib/config.rs` (e.g. `CrateConfig`'s fields correspond 11 # to per-crate options). 12 13 [resolve] 14 # `/build/rust/std/fake_root` is an artificial crate that depends on a 15 # `sysroot` crate from `//third_party/rust-src/library/sysroot` while also 16 # turning on all the required crate features of `sysroot`. `sysroot` includes 17 # all sysroot libraries as dependencies. 18 root = "fake_root" 19 20 # Workaround for Cargo issue: hashbrown's Cargo.toml uses an unstable Cargo 21 # feature that leads to incorrect `cargo metadata` output. 22 # 23 # TODO(https://github.com/rust-lang/cargo/issues/10801): remove workaround once 24 # issue is fixed. 25 remove_crates = ['allocator-api2', 'shlex'] 26 27 [gn] 28 build_file_template = "BUILD.gn.hbs" 29 30 [all-crates] 31 # std crates should have metadata applied to them. This would avoid any symbol 32 # conflicts between std dependencies and third_party/rust crates. 33 # 34 # However, we can't apply it yet. GN can't automatically clean old artifacts, 35 # nor can we delete and rebuild the sysroot on every build. 36 # 37 # TODO(crbug.com/40196262): set up GN rules to rebuilt the sysroot only when 38 # needed. Then set this metadata. 39 # 40 # rustc_metadata = "libstd" 41 42 extra_kv = { include_coverage = true } 43 44 [crate.compiler_builtins] 45 # Dependencies of profiler_builtins must have instrumentation disabled 46 # The build script conditionally generates a file; it's simplest to just paste 47 # raw GN into the output. (crbug.com/1470653) 48 extra_kv = { include_coverage = false, raw_gn = 'if (target_cpu == "arm64") { build_script_outputs = ["outlined_atomics.rs"] }' } 49 extra_src_roots = [ 50 # compiler_builtins depends on libm on windows crbug.com/1472681 51 '../libm', 52 ] 53 extra_build_script_src_roots = [ 54 '../configure.rs', 55 ] 56 57 [crate.core] 58 # Dependencies of profiler_builtins must have instrumentation disabled 59 extra_kv = { include_coverage = false, immediate_abort = true } 60 extra_src_roots = ['../../portable-simd/crates/core_simd', '../../stdarch/crates/core_arch'] 61 62 [crate.hashbrown] 63 # Workaround for Cargo issue: hashbrown's Cargo.toml uses an unstable Cargo 64 # feature that leads to incorrect `cargo metadata` output. 65 # 66 # TODO(https://github.com/rust-lang/cargo/issues/10801): remove workaround once 67 # issue is fixed. 68 remove_deps = ['allocator-api2'] 69 70 [crate.libc] 71 # This target is #[no_core] when included by std, which is incompatible with 72 # profiling. 73 extra_kv = { include_coverage = false } 74 75 [crate.profiler_builtins] 76 # The build script is used to compile a profiler-rt library, but we get 77 # the profiler rt library from clang, so we skip this. 78 # 79 # profiler_builtins cannot depend on itself, which it would if build with 80 # instrumentation. 81 extra_kv = { include_coverage = false, skip_build_rs = true } 82 83 [crate.rustc-std-workspace-alloc] 84 # This target is #[no_core] which is incompatible with profiling. 85 extra_kv = { include_coverage = false } 86 87 [crate.rustc-std-workspace-core] 88 # Dependencies of profiler_builtins must have instrumentation disabled 89 extra_kv = { include_coverage = false } 90 91 [crate.std] 92 extra_src_roots = ['../../backtrace/src', '../../portable-simd/crates/std_float/src', '../../core/src/primitive_docs.rs'] 93 extra_input_roots = [ '../../portable-simd/crates/core_simd/src', '../../stdarch/crates/core_arch/src', '../../core/src'] 94 95 # Remove this from std. It will be depended on directly when needed. 96 exclude_deps_in_gn = ['profiler_builtins'] 97 98 extra_kv = { immediate_abort = true } 99 100 [crate.test] 101 # test only depends on proc_macro as an internal detail of the Rust build, so 102 # it's implicitly included with std/test. However, we list the std crates and 103 # construct the sysroot explicitly. We don't need this, and we don't even want 104 # it during cross-compiles (since we will only build host proc_macro crates). 105 exclude_deps_in_gn = ['proc_macro'] 106 107 [crate.unwind] 108 # The build script is used to set up the link directives which we skip below. 109 # It uses `cc` to run a compiler to do so, which we don't support in build 110 # scripts. 111 # 112 # Suppress link directives since we specify the deps in GN configs. 113 extra_kv = { skip_build_rs = true, no_link_directives = true } 114 115 [crate.windows-targets] 116 # This target is #[no_core] which is incompatible with profiling. 117 extra_kv = { include_coverage = false }