xref: /aosp_15_r20/external/cronet/build/rust/std/BUILD.gn.hbs (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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# @generated from build/rust/std/BUILD.gn.hbs by tools/crates/gnrt. Do not edit!
6
7import("//build/rust/cargo_crate.gni")
8
9{{#each rules}}
10{{#with this.detail}}
11cargo_crate("{{../name}}") {
12  crate_type = "{{crate_type}}"
13  crate_root = "{{crate_root}}"
14  sources = [
15    {{#each sources}}
16    "{{this}}",
17    {{/each}}
18  ]
19  inputs = [
20    {{#each inputs}}
21    "{{this}}",
22    {{/each}}
23  ]
24  no_std = true
25
26  # Unit tests skipped. Generate with --with-tests to include them.
27  build_native_rust_unit_tests = false
28  edition = "{{edition}}"
29  cargo_pkg_version = "{{cargo_pkg_version}}"
30  {{#with cargo_pkg_authors}}
31  cargo_pkg_authors = "{{this}}"
32  {{/with}}
33  cargo_pkg_name = "{{cargo_pkg_name}}"
34  {{#with cargo_pkg_description}}
35  cargo_pkg_description = "{{gn_escape this}}"
36  {{/with}}
37  library_configs -= [
38    "//build/config/compiler:chromium_code",
39    {{#each remove_library_configs}}
40    "{{this}}",
41    {{/each}}
42    {{#unless extra_kv.include_coverage}}
43    "//build/config/coverage:default_coverage",
44    {{/unless}}
45  ]
46  library_configs += [
47    "//build/config/compiler:no_chromium_code",
48    {{#if extra_kv.immediate_abort}}
49    "//build/rust:panic_immediate_abort",
50    {{/if}}
51  ]
52  executable_configs -= [
53    "//build/config/compiler:chromium_code",
54    {{#each remove_executable_configs}}
55    "{{this}}",
56    {{/each}}
57  ]
58  executable_configs += [
59    "//build/config/compiler:no_chromium_code",
60    {{#each add_executable_configs}}
61    "{{this}}",
62    {{/each}}
63  ]
64  deps = [
65    "//build/rust/std:std_build_deps",
66    {{#if extra_kv.include_coverage}}
67    "//build/rust/std:profiler_builtins_group",
68    {{/if}}
69  {{#unless deps}}
70  ]
71  {{/unless}}
72  {{#each deps}}
73  {{#if @first}}
74    {{#each this.packages}}
75    ":{{this.name}}",
76    {{/each}}
77  ]
78  {{else}}
79  if ({{this.cond}}) {
80    deps += [
81      {{#each this.packages}}
82      ":{{this.name}}",
83      {{/each}}
84    ]
85  }
86  {{/if}}
87  {{/each}}
88  {{#if aliased_deps}}
89  aliased_deps = {
90    {{#each aliased_deps}}
91    {{this.0}} = "{{this.1}}"
92    {{/each}}
93  }
94  {{/if}}
95  {{#if features}}
96  features = [
97    {{#each features}}
98    "{{this}}",
99    {{/each}}
100  ]
101  {{/if}}
102  {{#unless extra_kv.skip_build_rs}}
103  {{#if build_root}}
104  build_root = "{{build_root}}"
105  build_sources = [
106    {{#each build_script_sources}}
107    "{{this}}",
108    {{/each}}
109  ]
110  {{#with build_script_inputs}}
111  build_script_inputs = [
112    {{#each this}}
113    "{{this}}",
114    {{/each}}
115  ]
116  {{/with}}
117  {{#with build_script_outputs}}
118  build_script_outputs = [
119    {{#each this}}
120    "{{this}}",
121    {{/each}}
122  ]
123  {{/with}}
124  {{#each build_deps}}
125  {{#if @first}}
126  build_deps = [
127    {{#each this.packages}}
128      ":{{this.name}}",
129    {{/each}}
130  ]
131  {{else}}
132  if ({{this.cond}}) {
133    build_deps += [
134    {{#each this.packages}}
135      ":{{this.name}}",
136    {{/each}}
137    ]
138  }
139  {{/if}}
140  {{/each}}
141  {{/if}}
142  {{/unless}}
143  rustenv = [
144    "CFG_DISABLE_UNSTABLE_FEATURES=0",
145    "STD_ENV_ARCH=$rust_target_arch",
146  ]
147  rustflags = [
148    "--cfg=backtrace_in_libstd",
149    "-Zforce-unstable-if-unmarked",
150    {{#if extra_kv.no_link_directives}}
151    "-Zlink-directives=false",
152    {{/if}}
153  ]
154  output_dir = "$root_out_dir/local_rustc_sysroot/lib/rustlib/$rust_abi_target/lib/"
155
156  {{#with extra_kv.raw_gn}}
157  {{this}}
158  {{/with}}
159  {{/with}}
160}
161{{/each}}
162