xref: /aosp_15_r20/external/cronet/third_party/rust/chromium_crates_io/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 third_party/rust/chromium_crates_io/BUILD.gn.hbs by
6# tools/crates/gnrt.
7# Do not edit!
8
9import("//build/rust/cargo_crate.gni")
10
11{{#each rules}}
12cargo_crate("{{this.name}}") {
13  {{#with this.detail}}
14  {{#if crate_name}}
15  crate_name = "{{crate_name}}"
16  {{/if}}
17  {{#if epoch}}
18  epoch = "{{epoch}}"
19  {{/if}}
20  crate_type = "{{crate_type}}"
21  crate_root = "{{crate_root}}"
22  sources = [
23    {{#each sources}}
24    "{{this}}",
25    {{/each}}
26  ]
27  inputs = [
28    {{#each inputs}}
29    "{{this}}",
30    {{/each}}
31  ]
32
33  build_native_rust_unit_tests = false
34  edition = "{{edition}}"
35  cargo_pkg_version = "{{cargo_pkg_version}}"
36  {{#with cargo_pkg_authors}}
37  cargo_pkg_authors = "{{gn_escape this}}"
38  {{/with}}
39  cargo_pkg_name = "{{cargo_pkg_name}}"
40  {{#with cargo_pkg_description}}
41  cargo_pkg_description = "{{gn_escape this}}"
42  {{/with}}
43  library_configs -= [ "//build/config/compiler:chromium_code" ]
44  library_configs += [ "//build/config/compiler:no_chromium_code" ]
45  executable_configs -= [ "//build/config/compiler:chromium_code" ]
46  executable_configs += [ "//build/config/compiler:no_chromium_code" ]
47  proc_macro_configs -= [ "//build/config/compiler:chromium_code" ]
48  proc_macro_configs += [ "//build/config/compiler:no_chromium_code" ]
49  {{#each deps}}
50  {{#if @first}}
51  deps = [
52    {{#if ../dep_on_lib}}
53    ":lib",
54    {{/if}}
55    {{#each this.packages}}
56      "//third_party/rust/{{this.name}}/{{this.epoch}}:lib",
57    {{/each}}
58  ]
59  {{else}}
60  if ({{this.cond}}) {
61    deps += [
62      {{#each this.packages}}
63      "//third_party/rust/{{this.name}}/{{this.epoch}}:lib",
64      {{/each}}
65    ]
66  }
67  {{/if}}
68  {{/each}}
69  {{#if aliased_deps}}
70  aliased_deps = {
71    {{#each aliased_deps}}
72    {{this.0}} = "{{this.1}}"
73    {{/each}}
74  }
75  {{/if}}
76  {{#each build_deps}}
77  {{#if @first}}
78  build_deps = [
79    {{#each this.packages}}
80      "//third_party/rust/{{this.name}}/{{this.epoch}}:buildrs_support",
81    {{/each}}
82  ]
83  {{else}}
84  if ({{this.cond}}) {
85    build_deps += [
86    {{#each this.packages}}
87      "//third_party/rust/{{this.name}}/{{this.epoch}}:buildrs_support",
88    {{/each}}
89    ]
90  }
91  {{/if}}
92  {{/each}}
93  {{#if features}}
94  features = [
95    {{#each features}}
96    "{{this}}",
97    {{/each}}
98  ]
99  {{/if}}
100  {{#if build_root}}
101  build_root = "{{build_root}}"
102  build_sources = [
103    {{#each build_script_sources}}
104    "{{this}}",
105    {{/each}}
106  ]
107  {{#with build_script_inputs}}
108  build_script_inputs = [
109    {{#each this}}
110    "{{this}}",
111    {{/each}}
112  ]
113  {{/with}}
114  {{#with build_script_outputs}}
115  build_script_outputs = [
116    {{#each this}}
117    "{{this}}",
118    {{/each}}
119  ]
120  {{/with}}
121  {{/if}}
122  {{#if rustenv}}
123  rustenv = [
124    {{#each rustenv}}
125    "{{this}}",
126    {{/each}}
127  ]
128  {{/if}}
129  {{#if rustflags}}
130  rustflags = [
131    {{#each rustflags}}
132    "{{this}}",
133    {{/each}}
134  ]
135  {{/if}}
136  {{#if output_dir}}
137  output_dir = "{{output_dir}}"
138  {{/if}}
139  {{/with}}
140  {{#unless this.gn_visibility.public}}
141
142  # Only for usage from third-party crates. Add the crate to
143  # //third_party/rust/chromium_crates_io/Cargo.toml to use
144  # it from first-party code.
145  visibility = [ "//third_party/rust/*" ]
146  {{/unless}}
147  {{#if this.gn_visibility.testonly}}
148  testonly = true
149  {{/if}}
150}
151{{/each}}
152