blob: 1c56c7dca7471e7c5980ab4c2a81273ac1159180 [file] [log] [blame] [edit]
{{>copyright comment="#"}}
{{>generated comment="#"}}
import("//build/rust/rustc_binary.gni")
import("//src/sys/build/components.gni")
group("{{PROJECT_NAME}}") {
testonly = true
deps = [
":package",
":tests",
]
}
group("tests") {
testonly = true
deps = [ ":{{PROJECT_NAME}}-unittests" ]
}
rustc_binary("bin") {
name = "{{PROJECT_NAME}}"
# Generates a GN target for unit-tests with the label `bin_test`, and
# a binary named `{{snake_case PROJECT_NAME}}_bin_test`.
with_unit_tests = true
deps = [
"//src/lib/diagnostics/inspect/rust",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:tracing",
]
sources = [ "src/main.rs" ]
}
fuchsia_component("component") {
component_name = "{{PROJECT_NAME}}"
manifest = "meta/{{PROJECT_NAME}}.cmx"
deps = [ ":bin" ]
}
fuchsia_package("package") {
package_name = "{{PROJECT_NAME}}"
deps = [ ":component" ]
}
# Run with `fx test {{PROJECT_NAME}}-unittests`.
fuchsia_unittest_package("{{PROJECT_NAME}}-unittests") {
executable_path = "bin/{{snake_case PROJECT_NAME}}_bin_test"
deps = [ ":bin_test" ]
}