xref: /aosp_15_r20/external/angle/build/rust/std/gnrt_config.toml (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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', 'shlex']
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/40196262): 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"] }' }
47extra_src_roots = [
48  # compiler_builtins depends on libm on windows crbug.com/1472681
49  '../libm',
50]
51extra_build_script_src_roots = [
52  '../configure.rs',
53]
54
55[crate.core]
56# Dependencies of profiler_builtins must have instrumentation disabled
57extra_kv = { include_coverage = false, immediate_abort = true }
58extra_src_roots = ['../../portable-simd/crates/core_simd', '../../stdarch/crates/core_arch']
59
60[crate.hashbrown]
61# Workaround for Cargo issue: hashbrown's Cargo.toml uses an unstable Cargo
62# feature that leads to incorrect `cargo metadata` output.
63#
64# TODO(https://github.com/rust-lang/cargo/issues/10801): remove workaround once
65# issue is fixed.
66remove_deps = ['allocator-api2']
67
68[crate.libc]
69# This target is #[no_core] when included by std, which is incompatible with
70# profiling.
71extra_kv = { include_coverage = false }
72
73[crate.profiler_builtins]
74# The build script is used to compile a profiler-rt library, but we get
75# the profiler rt library from clang, so we skip this.
76#
77# profiler_builtins cannot depend on itself, which it would if build with
78# instrumentation.
79extra_kv = { include_coverage = false, skip_build_rs = true }
80
81[crate.rustc-std-workspace-alloc]
82# This target is #[no_core] which is incompatible with profiling.
83extra_kv = { include_coverage = false }
84
85[crate.rustc-std-workspace-core]
86# Dependencies of profiler_builtins must have instrumentation disabled
87extra_kv = { include_coverage = false }
88
89[crate.std]
90extra_src_roots = ['../../backtrace/src', '../../portable-simd/crates/std_float/src', '../../core/src/primitive_docs.rs']
91extra_input_roots = [ '../../portable-simd/crates/core_simd/src', '../../stdarch/crates/core_arch/src', '../../core/src']
92
93# Remove this from std. It will be depended on directly when needed.
94exclude_deps_in_gn = ['profiler_builtins']
95
96extra_kv = { immediate_abort = true }
97
98[crate.test]
99# test only depends on proc_macro as an internal detail of the Rust build, so
100# it's implicitly included with std/test. However, we list the std crates and
101# construct the sysroot explicitly. We don't need this, and we don't even want
102# it during cross-compiles (since we will only build host proc_macro crates).
103exclude_deps_in_gn = ['proc_macro']
104
105[crate.unwind]
106# The build script is used to set up the link directives which we skip below.
107# It uses `cc` to run a compiler to do so, which we don't support in build
108# scripts.
109#
110# Suppress link directives since we specify the deps in GN configs.
111extra_kv = { skip_build_rs = true, no_link_directives = true }
112
113[crate.windows-targets]
114# This target is #[no_core] which is incompatible with profiling.
115extra_kv = { include_coverage = false }
116