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