blob: 784010e87692c79d745bf41fe9d6de74e6e580d2 [file] [log] [blame]
# Copyright {{COPYRIGHT_YEAR}} 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.
# This file was generated by the `fx create component-v2` command. The template
# is located at `//tools/create/templates/component-v2/BUILD.gn.tmpl-rust`.
# If something is broken, consider authoring a fix.
import("//build/package.gni")
import("//build/rust/rustc_binary.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.gni")
group("{{PROJECT_NAME}}") {
testonly = true
public_deps = [
":pkg",
":tests",
]
}
group("tests") {
testonly = true
public_deps = [ ":{{PROJECT_NAME}}-tests" ]
}
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/fuchsia-async",
"//src/lib/fuchsia-component",
]
}
package("pkg") {
package_name = "{{PROJECT_NAME}}"
deps = [ ":bin" ]
binaries = [
{
name = "{{snake_case PROJECT_NAME}}"
dest = "{{PROJECT_NAME}}"
},
]
meta = [
# Compile the package's CML manifest.
# The resulting component manifest can be referenced through the URL
# fuchsia-pkg://fuchsia.com/{{PROJECT_NAME}}#meta/{{PROJECT_NAME}}.cm.
{
path = rebase_path("meta/{{PROJECT_NAME}}.cml")
dest = "{{PROJECT_NAME}}.cm"
},
]
}
# Run with `fx test {{PROJECT_NAME}}-tests`.
test_package("{{PROJECT_NAME}}-tests") {
deps = [
":bin_test",
"//src/sys/test_adapters/rust",
]
binaries = [
{
name = "rust_test_adapter"
},
]
v2_tests = [
{
name = "{{snake_case PROJECT_NAME}}_bin_test"
dest = "{{PROJECT_NAME}}_test"
environments = basic_envs
},
]
}