File: BUILD.gn.hbs

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (164 lines) | stat: -rw-r--r-- 3,792 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# Copyright 2023 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# @generated from build/rust/std/BUILD.gn.hbs by tools/crates/gnrt. Do not edit!

import("//build/rust/cargo_crate.gni")

{{#each rules}}
{{#with this.detail}}
cargo_crate("{{../name}}") {
  crate_type = "{{crate_type}}"
  crate_root = "{{crate_root}}"
  {{#if cond}}
  enabled = {{cond}}
  {{/if}}
  sources = [
    {{#each sources}}
    "{{this}}",
    {{/each}}
  ]
  inputs = [
    {{#each inputs}}
    "{{this}}",
    {{/each}}
  ]
  no_std = true

  # Unit tests skipped. Generate with --with-tests to include them.
  build_native_rust_unit_tests = false
  edition = "{{edition}}"
  cargo_pkg_version = "{{cargo_pkg_version}}"
  {{#if cargo_pkg_authors}}
    {{#with cargo_pkg_authors}}
      cargo_pkg_authors = "{{this}}"
    {{/with}}
  {{/if}}
  cargo_pkg_name = "{{cargo_pkg_name}}"
  {{#if cargo_pkg_description}}
    {{#with cargo_pkg_description}}
      cargo_pkg_description = "{{gn_escape this}}"
    {{/with}}
  {{/if}}
  library_configs -= [
    "//build/config/compiler:chromium_code",
    "//build/config/compiler:disallow_unstable_features",
    {{#unless extra_kv.include_coverage}}
    "//build/config/coverage:default_coverage",
    {{/unless}}
  ]
  library_configs += [
    "//build/config/compiler:no_chromium_code",
    {{#if extra_kv.immediate_abort}}
    "//build/rust:panic_immediate_abort",
    {{/if}}
  ]
  executable_configs -= [
    "//build/config/compiler:chromium_code",
    "//build/config/compiler:disallow_unstable_features",
  ]
  executable_configs += [
    "//build/config/compiler:no_chromium_code",
  ]
  deps = [
    "//build/rust/std:std_build_deps",
    {{#if extra_kv.include_coverage}}
    "//build/rust/std:profiler_builtins_group",
    {{/if}}
  {{#unless deps}}
  ]
  {{/unless}}
  {{#each deps}}
  {{#if @first}}
    {{#each this.packages}}
    ":{{this.name}}",
    {{/each}}
  ]
  {{else}}
  if ({{this.cond}}) {
    deps += [
      {{#each this.packages}}
      ":{{this.name}}",
      {{/each}}
    ]
  }
  {{/if}}
  {{/each}}
  {{#if aliased_deps}}
  aliased_deps = {
    {{#each aliased_deps}}
    {{this.0}} = "{{this.1}}"
    {{/each}}
  }
  {{/if}}
  {{#if features}}
  features = [
    {{#each features}}
    "{{this}}",
    {{/each}}
  ]
  {{/if}}
  {{#unless extra_kv.skip_build_rs}}
  {{#if build_root}}
    build_root = "{{build_root}}"
    build_sources = [
      {{#each build_script_sources}}
        "{{this}}",
      {{/each}}
    ]
    {{#if build_script_inputs}}
      build_script_inputs = [
        {{#each build_script_inputs}}
          "{{this}}",
        {{/each}}
      ]
    {{/if}}
    {{#if build_script_outputs}}
      build_script_outputs = [
        {{#each build_script_outputs}}
          "{{this}}",
        {{/each}}
      ]
    {{/if}}
    {{#each build_deps}}
      {{#if @first}}
        build_deps = [
          {{#each this.packages}}
            ":{{this.name}}",
          {{/each}}
        ]
      {{else}}
        if ({{this.cond}}) {
          build_deps += [
          {{#each this.packages}}
            ":{{this.name}}",
          {{/each}}
          ]
        }
      {{/if}}
    {{/each}}
  {{/if}}
  {{/unless}}
  rustenv = [
    "CFG_DISABLE_UNSTABLE_FEATURES=0",
    "STD_ENV_ARCH=$rust_target_arch",
  ]
  rustflags = [
    "--cfg=backtrace_in_libstd",
    "-Zforce-unstable-if-unmarked",
    "--cap-lints=allow",  # Suppress all warnings in stdlib crates
    {{#if extra_kv.no_link_directives}}
    "-Zlink-directives=false",
    {{/if}}
  ]
  output_dir = "$root_out_dir/local_rustc_sysroot/lib/rustlib/$rust_abi_target/lib/"

  {{#if extra_kv.raw_gn}}
  {{#with extra_kv.raw_gn}}
  {{this}}
  {{/with}}
  {{/if}}
}
{{/with}}
{{/each}}