blob: 9f2384e58fd96959b1d44973a5d8c56921425e2c [file] [log] [blame]
# Copyright 2022 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/components.gni")
import("//build/rust/rustc_binary.gni")
# [START args_declare]
declare_args() {
# Set this in args.gn to override the greeting emitted by this example.
config_example_rust_greeting = "World"
}
# [END args_declare]
# [START binary]
rustc_binary("bin") {
edition = "2021"
# [START_EXCLUDE]
output_name = "config_example_rust"
sources = [ "src/main.rs" ]
# [END_EXCLUDE]
deps = [
":example_config",
# [START_EXCLUDE]
"//src/lib/diagnostics/inspect/runtime/rust",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/fuchsia",
"//third_party/rust_crates:tracing",
# [END_EXCLUDE]
]
}
# [END binary]
# [START component]
fuchsia_component_manifest("manifest") {
component_name = "config_example"
manifest = "meta/config_example.cml"
}
fuchsia_component("component") {
cm_label = ":manifest"
deps = [ ":bin" ]
}
# [END component]
# [START library]
fuchsia_structured_config_rust_lib("example_config") {
cm_label = ":manifest"
}
# [END library]
# [START config_values_gn]
fuchsia_structured_config_values("values_from_gn") {
cm_label = ":manifest"
values = {
greeting = config_example_rust_greeting
delay_ms = 100
}
}
# [END config_values_gn]
# [START config_values_json]
fuchsia_structured_config_values("values_from_json_file") {
cm_label = ":manifest"
values_source = "../config_example_default_values.json5"
}
# [END config_values_json]
# [START package]
fuchsia_package("rust_config_example") {
deps = [
":component",
":values_from_gn",
]
}
# [END package]
fuchsia_package("rust_config_example_with_json_values") {
deps = [
":component",
":values_from_json_file",
]
}
group("rust") {
deps = [
":rust_config_example",
":rust_config_example_with_json_values",
]
}