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 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598
|
# 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.
# This file configures how `gnrt` vendors and generates `BUILD.gn` files for
# third-party Rust crates. After modifying this file you probably want to run
# either `tools/crates/run_gnrt.py vendor` or `tools/crates/run_gnrt.py gen` to
# regenerate `gnrt`-managed files with the new `gnrt_config.toml` contents.
#
# `[crate.foo]` sections below can configure generation of `BUILD.gn` and/or
# `README.chromium` by specifying the following options:
#
# allow_first_party_usage: If false, the crate should not be visible to first
# party code even though it is present in the Cargo.toml file. It defaults to
# true. Use this if you need to control features for a crate that is only
# meant for use as a transitive dependency of third-party crates.
# e.g. allow_first_party_usage = false
#
# ban_features: A list of crate features that are disallowed in Chromium.
# Typically `ban_features` is used when a crate-feature-gated code failed or
# hasn't gone through a security audit.
#
# bin_targets: A list of binary target names to cover. This list is empty by
# default, which means that the default generated `BUILD.gn` will only cover
# the library target (if any) of the package.
#
# build_script_outputs: A list of file paths, rooted from where the BUILD.gn
# file is located, of files generated by the crate's build script.
# e.g. build_script_outputs = [ "crate/src/gen/gen_stuff.rs" ]
#
# extra_input_roots: A list of additional arbitrary files and/or directories
# that are part of the crate (these need to be listed as `inputs` in the
# generated `BUILD.gn`). An example scenario that needs `extra_input_roots`
# is when a crate uses `include_str!` to include `README.md` as a doc
# comment.
#
# extra_src_roots: A list of additional Rust sources that come from outside of
# the crate's `src` directory (these need to be added to `sources` in the
# generated `BUILD.gn`). An example scenario that needs `extra_src_roots` is
# when a crate uses generated code via `include!("../generated/foo.rs")`.
#
# group: One of 'safe', 'sandbox', or 'test. This indicates where the library
# is allowed to be used and where its GN rules will be written.
#
# The group of least privilege is inherited by a crate C from all crates that
# depend on C transitively. For crates listed in Cargo.toml, and not depended
# on by other crates, the default is 'safe'.
# TODO(danakj): The default should probably be 'sandbox'?
#
# 'safe': The library satisfies the rule-of-2 and can be used in any process.
# 'sandbox': The library does not satisfy the rule-of-2 and must be used in
# a sandboxed process such as the renderer or a utility process.
# 'test': The library is only used in tests.
#
# license: The name of the license. This should normally be populated from the
# crate's Cargo.toml, but it can be specified to override it.
#
# license_files: A list of license files, relative to the crate's root.
# This is normally found automatically based on convention, but it can be
# specified to override it. A license file is expected for all shipped
# libraries.
#
# security_critical: A boolean that overrides if the crate is marked security-
# critical in the README.chromium. It defaults to true if the crate is not in
# the 'test' group/.
#
# shipped: A boolean that overrides if the crate is marked shipped in the
# README.chromium. It defaults to true if the crate is not in the 'test'
# group.
#
# extra_kv: A dictionary with arbitrary data (i.e. that doesn't come from
# `gnrt`). The following enries are currently supported/used by
# `BUILD.gn.hbs`:
#
# allow_unsafe: If true, then the crate is allowed to use `unsafe` Rust.
#
# allow_unstable_features: A list of unstable feature names to allow
# in a given crate. (This should be used sparingly - please see
# tools/rust/unstable_rust_feature_usage.md for more details.)
#
# configs_to_remove / configs_to_add: A list of GN config labels.
#
# visibility: A list of targets that the crate should be visible to.
#
# Additional, less commonly needed options can also be discovered by reading
# the doc comments in `//tools/crates/gnrt/lib/config.rs` (e.g. `CrateConfig`'s
# fields correspond to per-crate options like `extra_input_roots`).
[gn]
build_file_template = "BUILD.gn.hbs"
readme_file_template = "README.chromium.hbs"
removed_cargo_template = "removed_Cargo.toml.hbs"
removed_librs_template = "removed_lib.rs.hbs"
[vet]
config_template = "vet_config.toml.hbs"
[resolve]
root = "chromium"
remove_crates = []
[crate.adler2.extra_kv]
allow_unsafe = false
[crate.anstyle.extra_kv]
allow_unsafe = true
[crate.anyhow.extra_kv]
allow_unsafe = true
[crate.autocfg.extra_kv]
allow_unsafe = false
[crate.base64.extra_kv]
allow_unsafe = false
[crate.bitflags.extra_kv]
allow_unsafe = false
[crate.bytemuck.extra_kv]
allow_unsafe = true
# This allows using `std::simd` helpers, which are needed by first-party code.
allow_unstable_features = ["portable_simd"]
[crate.bytemuck_derive.extra_kv]
allow_unsafe = false
[crate.bytes]
extra_kv = { allow_unsafe = true }
[crate.calendrical_calculations.extra_kv]
allow_unsafe = false
[crate.cfg-if.extra_kv]
allow_unsafe = false
[crate.clap]
# These files are included from source files and are thus required as part of
# building the crate.
extra_input_roots = ['../README.md']
extra_src_roots = ['../examples']
extra_kv = { allow_unsafe = false }
[crate.clap_builder]
extra_input_roots = ['../README.md']
extra_kv = { allow_unsafe = false }
[crate.clap_lex.extra_kv]
allow_unsafe = true
[crate.codespan-reporting]
extra_kv = { allow_unsafe = false }
[crate.combine.extra_kv]
allow_unsafe = true
[crate.core_maths.extra_kv]
allow_unsafe = false
[crate.crc32fast.extra_kv]
allow_unsafe = true
[crate.cxx]
extra_kv = { allow_unsafe = true }
remove_deps = ['cc', 'link-cplusplus']
# This removes the use of cc, and disables the `build_with_cargo` cfg which
# also removes the use of link-cplusplus.
remove_build_rs = true
[crate.cxxbridge-cmd]
shipped = false
bin_targets = ["cxxbridge"]
extra_kv = { allow_unsafe = false }
[crate.cxxbridge-flags.extra_kv]
allow_unsafe = false
[crate.cxxbridge-macro.extra_kv]
allow_unsafe = false
[crate.derivre.extra_kv]
allow_unsafe = false
[crate.diplomat.extra_kv]
allow_unsafe = false
[crate.diplomat-runtime.extra_kv]
allow_unsafe = true
[crate.diplomat_core.extra_kv]
allow_unsafe = false
[crate.displaydoc.extra_kv]
allow_unsafe = false
[crate.either.extra_kv]
allow_unsafe = true
[crate.equivalent.extra_kv]
allow_unsafe = false
[crate.fdeflate.extra_kv]
allow_unsafe = false
# Web tests (aka WPT tests, also formerly known as Layout Tests) require fast
# PNG encoding and decoding even in Debug builds. See
# https://crbug.com/396419181.
configs_to_remove = ['//build/config/compiler:default_optimization']
configs_to_add = ['//build/config/compiler:optimize']
[crate.fend-core.extra_kv]
allow_unsafe = false
[crate.fixed_decimal.extra_kv]
allow_unsafe = false
[crate.flate2]
ban_features = [
# `any_zlib` feature is banned because Chromium does not use the `zlib`
# backend (and because this backend's extensive `unsafe` usage hasn't been
# audited).
'any_zlib',
]
[crate.flate2.extra_kv]
# Web tests (aka WPT tests, also formerly known as Layout Tests) require fast
# PNG encoding and decoding even in Debug builds. See
# https://crbug.com/396419181.
configs_to_remove = ['//build/config/compiler:default_optimization']
configs_to_add = ['//build/config/compiler:optimize']
allow_unsafe = false
[crate.foldhash.extra_kv]
allow_unsafe = true
[crate.font-types.extra_kv]
allow_unsafe = true
[crate.hashbrown.extra_kv]
# `hashbrown` crate is implicitly trusted because it comes from
# https://github.com/rust-lang/ (and we already implicitly trust maintainers of
# `rustc`).
allow_unsafe = true
[crate.heck.extra_kv]
allow_unsafe = false
[crate.hex]
group = 'test'
extra_kv = { allow_unsafe = false }
[crate.icu_calendar.extra_kv]
allow_unsafe = false
[crate.icu_calendar_data]
extra_input_roots = ['../data']
extra_src_roots = ['../data']
extra_kv = { allow_unsafe = false }
[crate.icu_casemap.extra_kv]
allow_unsafe = false
[crate.icu_casemap_data]
extra_input_roots = ['../data']
extra_src_roots = ['../data']
extra_kv = { allow_unsafe = false }
[crate.icu_collections]
extra_kv = { allow_unsafe = true }
[crate.icu_decimal.extra_kv]
allow_unsafe = false
[crate.icu_decimal_data]
extra_input_roots = ['../data']
extra_src_roots = ['../data']
extra_kv = { allow_unsafe = false }
[crate.icu_experimental.extra_kv]
allow_unsafe = false
[crate.icu_experimental_data.extra_kv]
allow_unsafe = false
[crate.icu_list.extra_kv]
allow_unsafe = false
[crate.icu_list_data.extra_kv]
allow_unsafe = false
[crate.icu_experimental_data]
extra_input_roots = ['../data']
extra_src_roots = ['../data']
[crate.icu_list_data]
extra_input_roots = ['../data']
extra_src_roots = ['../data']
[crate.icu_locale]
extra_kv = { allow_unsafe = true }
[crate.icu_locale_core]
extra_kv = { allow_unsafe = true }
[crate.icu_locale_data]
extra_input_roots = ['../data']
extra_src_roots = ['../data']
extra_kv = { allow_unsafe = false }
[crate.icu_normalizer.extra_kv]
allow_unsafe = true
[crate.icu_normalizer_data]
extra_input_roots = ['../data']
extra_src_roots = ['../data']
extra_kv = { allow_unsafe = false }
[crate.icu_pattern.extra_kv]
allow_unsafe = true
[crate.icu_plurals.extra_kv]
allow_unsafe = false
[crate.icu_plurals_data]
extra_input_roots = ['../data']
extra_src_roots = ['../data']
extra_kv = { allow_unsafe = false }
[crate.icu_properties.extra_kv]
allow_unsafe = false
[crate.icu_properties_data]
extra_input_roots = ['../data']
extra_src_roots = ['../data']
extra_kv = { allow_unsafe = false }
[crate.icu_provider]
extra_kv = { allow_unsafe = true }
[crate.indexmap.extra_kv]
allow_unsafe = true
[crate.itertools]
extra_kv = { allow_unsafe = true }
group = 'test'
[crate.itoa.extra_kv]
allow_unsafe = true
[crate.ixdtf.extra_kv]
allow_unsafe = false
[crate.jiff-tzdb]
extra_kv = { allow_unsafe = false }
[crate.lazy_static.extra_kv]
allow_unsafe = true
[crate.libc]
ban_features = [
# `extra_traits` feature is banned because of
# https://github.com/rust-lang/libc/issues/3560
'extra_traits',
]
# `libc` crate is implicitly trusted because it comes from
# https://github.com/rust-lang/ (and we already implicitly trust maintainers of
# `rustc`).
extra_kv = { allow_unsafe = true }
[crate.libm]
license_files= ["LICENSE.txt"]
extra_build_script_src_roots = ['../configure.rs']
# `libm` crate is implicitly trusted because it comes from
# https://github.com/rust-lang/ (and we already implicitly trust maintainers of
# `rustc`).
extra_kv = { allow_unsafe = true }
[crate.litemap.extra_kv]
allow_unsafe = false
[crate.llguidance.extra_kv]
allow_unsafe = true
[crate.log.extra_kv]
allow_unsafe = true
[crate.memchr.extra_kv]
allow_unsafe = true
[crate.miniz_oxide.extra_kv]
# Web tests (aka WPT tests, also formerly known as Layout Tests) require fast
# PNG encoding and decoding even in Debug builds. See
# https://crbug.com/396419181.
allow_unsafe = false
configs_to_remove = ['//build/config/compiler:default_optimization']
configs_to_add = ['//build/config/compiler:optimize']
[crate.num-bigint.extra_kv]
allow_unsafe = false
[crate.num-integer.extra_kv]
allow_unsafe = false
[crate.num-rational.extra_kv]
allow_unsafe = false
[crate.num-traits]
# Configures the has_total_cmp feature, not necessary
remove_build_rs = true
extra_kv = { allow_unsafe = true }
[crate.png.extra_kv]
allow_unsafe = false
# Web tests (aka WPT tests, also formerly known as Layout Tests) require fast
# PNG encoding and decoding even in Debug builds. See
# https://crbug.com/396419181.
configs_to_remove = ['//build/config/compiler:default_optimization']
configs_to_add = ['//build/config/compiler:optimize']
[crate.potential_utf.extra_kv]
allow_unsafe = true
[crate.proc-macro2.extra_kv]
allow_unsafe = true
[crate.prost]
extra_input_roots = ['../README.md']
extra_kv = { allow_unsafe = true }
group = 'test'
[crate.prost-derive]
extra_kv = { allow_unsafe = false }
group = 'test'
[crate.qr_code.extra_kv]
allow_unsafe = false
[crate.quote.extra_kv]
allow_unsafe = false
[crate.read-fonts]
extra_src_roots = ['../generated']
extra_kv = { allow_unsafe = false }
[crate.regex-automata.extra_kv]
allow_unsafe = false
[crate.regex-syntax.extra_kv]
allow_unsafe = false
[crate.rustc-demangle.extra_kv]
allow_unsafe = false
[crate.rustc-demangle-capi]
extra_kv = { allow_unsafe = true }
shipped = false
[crate.rustversion]
allow_first_party_usage = false
build_script_outputs = [ "version.expr" ]
extra_build_script_src_roots = ['../build/rustc.rs']
extra_kv = { allow_unsafe = false }
[crate.ryu.extra_kv]
allow_unsafe = true
[crate.serde.extra_kv]
allow_unsafe = true
[crate.serde_derive.extra_kv]
allow_unsafe = false
[crate.serde_json.extra_kv]
allow_unsafe = true
[crate.serde_json_lenient.extra_kv]
allow_unsafe = true
[crate.simd-adler32.extra_kv]
allow_unsafe = true
[crate.skrifa]
extra_src_roots = ['../generated']
extra_kv = { allow_unsafe = false }
[crate.small_ctor]
group = 'test'
extra_kv = { allow_unsafe = false }
[crate.smallvec]
ban_features = ['malloc_size_of']
extra_kv = { allow_unsafe = true }
[crate.stable_deref_trait.extra_kv]
allow_unsafe = true
[crate.static_assertions.extra_kv]
allow_unsafe = false
[crate.strck.extra_kv]
allow_unsafe = true
[crate.strsim.extra_kv]
allow_unsafe = false
[crate.strum.extra_kv]
allow_unsafe = false
[crate.strum_macros.extra_kv]
allow_unsafe = false
[crate.subtle.extra_kv]
allow_unsafe = false
[crate.syn.extra_kv]
allow_unsafe = true
[crate.synstructure.extra_kv]
allow_unsafe = false
[crate.temporal_capi]
extra_kv = { allow_unsafe = false }
license_files = ["LICENSE-MIT", "LICENSE-APACHE"]
[crate.temporal_rs]
extra_kv = { allow_unsafe = true }
license_files = ["LICENSE-MIT", "LICENSE-APACHE"]
[crate.termcolor.extra_kv]
allow_unsafe = false
[crate.timezone_provider]
license_files = ["LICENSE-MIT", "LICENSE-APACHE"]
[crate.timezone_provider.extra_kv]
allow_unsafe = true
[crate.tinystr.extra_kv]
allow_unsafe = true
[crate.toktrie.extra_kv]
allow_unsafe = false
[crate.tzif.extra_kv]
allow_unsafe = false
[crate.unicode-ident.extra_kv]
allow_unsafe = true
[crate.unicode-width.extra_kv]
allow_unsafe = false
[crate.winapi-util.extra_kv]
allow_unsafe = true
[crate.windows-sys.extra_kv]
allow_unsafe = false
visibility = [ '//build/rust/tests/windows_sys_test' ]
[crate.windows-targets.extra_kv]
allow_unsafe = false
[crate.windows_aarch64_msvc]
native_libs_roots = [ '../lib' ]
extra_kv = { allow_unsafe = false }
[crate.windows_i686_msvc]
native_libs_roots = [ '../lib' ]
extra_kv = { allow_unsafe = false }
[crate.windows_x86_64_msvc]
native_libs_roots = [ '../lib' ]
extra_kv = { allow_unsafe = false }
[crate.writeable.extra_kv]
allow_unsafe = true
[crate.yoke.extra_kv]
allow_unsafe = true
[crate.yoke-derive.extra_kv]
allow_unsafe = false
[crate.zerofrom.extra_kv]
allow_unsafe = false
[crate.zerofrom-derive.extra_kv]
allow_unsafe = false
[crate.zerotrie.extra_kv]
allow_unsafe = true
[crate.zerovec.extra_kv]
allow_unsafe = true
[crate.zerovec-derive.extra_kv]
allow_unsafe = false
[crate.zip.extra_kv]
allow_unsafe = true
|