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# There is a virtual "sysroot" crate that includes all sysroot libraries as 15# dependencies. 16root = "sysroot" 17 18# Workaround for Cargo issue: hashbrown's Cargo.toml uses an unstable Cargo 19# feature that leads to incorrect `cargo metadata` output. 20# 21# TODO(https://github.com/rust-lang/cargo/issues/10801): remove workaround once 22# issue is fixed. 23remove_crates = ['allocator-api2'] 24 25[gn] 26build_file_template = "BUILD.gn.hbs" 27 28[all-crates] 29# std crates should have metadata applied to them. This would avoid any symbol 30# conflicts between std dependencies and third_party/rust crates. 31# 32# However, we can't apply it yet. GN can't automatically clean old artifacts, 33# nor can we delete and rebuild the sysroot on every build. 34# 35# TODO(crbug.com/1245714): set up GN rules to rebuilt the sysroot only when 36# needed. Then set this metadata. 37# 38# rustc_metadata = "libstd" 39 40extra_kv = { include_coverage = true } 41 42[crate.compiler_builtins] 43# Dependencies of profiler_builtins must have instrumentation disabled 44# The build script conditionally generates a file; it's simplest to just paste 45# raw GN into the output. (crbug.com/1470653) 46extra_kv = { include_coverage = false, raw_gn = 'if (current_cpu == "arm64") { build_script_outputs = ["outlined_atomics.rs"] }' } 47 48# compiler_builtins depends on libm on windows crbug.com/1472681 49extra_src_roots = ['../libm'] 50 51[crate.core] 52# Dependencies of profiler_builtins must have instrumentation disabled 53extra_kv = { include_coverage = false, immediate_abort = true } 54extra_src_roots = ['../../portable-simd/crates/core_simd', '../../stdarch/crates/core_arch'] 55 56[crate.hashbrown] 57# Workaround for Cargo issue: hashbrown's Cargo.toml uses an unstable Cargo 58# feature that leads to incorrect `cargo metadata` output. 59# 60# TODO(https://github.com/rust-lang/cargo/issues/10801): remove workaround once 61# issue is fixed. 62remove_deps = ['allocator-api2'] 63 64[crate.libc] 65# This target is #[no_core] when included by std, which is incompatible with 66# profiling. 67# 68# Suppress link directives since we specify the deps in GN configs. 69extra_kv = { include_coverage = false, no_link_directives = true } 70 71[crate.profiler_builtins] 72# The build script is used to compile a profiler-rt library, but we get 73# the profiler rt library from clang, so we skip this. 74# 75# profiler_builtins cannot depend on itself, which it would if build with 76# instrumentation. 77extra_kv = { include_coverage = false, skip_build_rs = true } 78 79[crate.rustc-std-workspace-alloc] 80# This target is #[no_core] which is incompatible with profiling. 81extra_kv = { include_coverage = false } 82 83[crate.rustc-std-workspace-core] 84# Dependencies of profiler_builtins must have instrumentation disabled 85extra_kv = { include_coverage = false } 86 87[crate.std] 88extra_src_roots = ['../../backtrace/src', '../../portable-simd/crates/std_float/src', '../../core/src/primitive_docs.rs'] 89extra_input_roots = [ '../../portable-simd/crates/core_simd/src', '../../stdarch/crates/core_arch/src', '../../core/src'] 90 91# Remove this from std. It will be depended on directly when needed. 92exclude_deps_in_gn = ['profiler_builtins'] 93 94extra_kv = { immediate_abort = true } 95 96[crate.test] 97# test only depends on proc_macro as an internal detail of the Rust build, so 98# it's implicitly included with std/test. However, we list the std crates and 99# construct the sysroot explicitly. We don't need this, and we don't even want 100# it during cross-compiles (since we will only build host proc_macro crates). 101exclude_deps_in_gn = ['proc_macro'] 102 103[crate.unwind] 104# The build script is used to set up the link directives which we skip below. 105# It uses `cc` to run a compiler to do so, which we don't support in build 106# scripts. 107# 108# Suppress link directives since we specify the deps in GN configs. 109extra_kv = { skip_build_rs = true, no_link_directives = true } 110