• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  {{#with extra_kv.allow_unstable_features}}
123  {{#if this}}
124    library_configs -= [ "//build/config/compiler:disallow_unstable_features" ]
125    executable_configs -= [
126      "//build/config/compiler:disallow_unstable_features"
127    ]
128    proc_macro_configs -= [
129      "//build/config/compiler:disallow_unstable_features"
130    ]
131    rustflags = [ "-Zallow-features={{this}}" ]
132  {{/if}}
133  {{/with}}
134  {{#if output_dir}}
135  output_dir = "{{output_dir}}"
136  {{/if}}
137  {{#if native_libs}}
138  native_libs = [
139  {{#each native_libs}}
140    "{{this}}",
141  {{/each}}
142  ]
143  {{/if}}
144  {{/with}}
145
146  {{#if gn_visibility.public}}
147  {{#if detail.extra_kv.visibility}}
148  visibility = []
149  {{/if}}
150  {{else}}
151  # Only for usage from third-party crates. Add the crate to
152  # //third_party/rust/chromium_crates_io/Cargo.toml to use
153  # it from first-party code.
154  visibility = [ "//third_party/rust/*" ]
155  {{/if}}
156  {{#each detail.extra_kv.visibility}}
157  visibility += [ "{{this}}" ]
158  {{/each}}
159  {{#if gn_visibility.testonly}}
160  testonly = true
161  {{/if}}
162}
163{{/each}}
164