1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 09:39:08 -05:00

Add "features" argument to rust components

This commit is contained in:
Bert Belder 2018-07-28 11:07:54 +02:00 committed by Ryan Dahl
parent 4d386e9e1c
commit 37a4606d29
2 changed files with 25 additions and 13 deletions

View file

@ -11,7 +11,7 @@ crates = "//third_party/rust_crates"
rust_component("libc") {
source_root =
"$crates/registry/src/github.com-1ecc6299db9ec823/libc-0.2.42/src/lib.rs"
cfg = [ "feature=\"use_std\"" ]
features = [ "use_std" ]
}
rust_component("url") {
@ -91,9 +91,9 @@ rust_component("rand") {
":libc",
":rand_core",
]
cfg = [
"feature=\"std\"",
"feature=\"alloc\"",
features = [
"std",
"alloc",
]
if (is_mac) {
libs = [ "Security.framework" ]

View file

@ -43,10 +43,11 @@ template("run_rustc") {
"cfg",
"crate_name",
"crate_type",
"source_root",
"deps",
"extern",
"features",
"is_test",
"source_root",
"testonly",
])
if (!defined(crate_name)) {
@ -119,6 +120,15 @@ template("run_rustc") {
}
}
if (defined(features)) {
foreach(f, features) {
args += [
"--cfg",
"feature=\"" + f + "\"",
]
}
}
if (defined(invoker.args)) {
args += invoker.args
}
@ -155,15 +165,16 @@ template("rust_component") {
run_rustc(rustc_name) {
forward_variables_from(invoker,
[
"args",
"cfg",
"crate_name",
"crate_type",
"extern",
"cfg",
"source_root",
"is_test",
"testonly",
"args",
"deps",
"extern",
"features",
"is_test",
"source_root",
"testonly",
])
if (!defined(invoker.crate_type)) {
crate_type = "rlib"
@ -176,8 +187,8 @@ template("rust_component") {
component(target_name) {
forward_variables_from(invoker,
[
"libs",
"deps",
"libs",
"testonly",
])
if (!defined(deps)) {
@ -195,9 +206,10 @@ template("rust_staticlib") {
rust_component(target_name) {
forward_variables_from(invoker,
[
"cfg",
"crate_name",
"extern",
"cfg",
"features",
"source_root",
"testonly",
])