| # Copyright 2018 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. |
| |
| # NOTE: The comments that have [START/END ...] in them are used to identify code snippets that |
| # appear in the documentation. Please be aware that changes in these blocks will affect the |
| # documentation on fuchsia.dev. |
| |
| import("//build/rust/rustc_binary.gni") |
| import("//src/sys/build/components.gni") |
| |
| group("rust") { |
| deps = [ ":hello-world-rust" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ ":hello-world-rust-tests" ] |
| } |
| |
| # [START rustc_tests] |
| rustc_binary("bin") { |
| name = "hello_world_rust" |
| with_unit_tests = true |
| edition = "2018" |
| |
| deps = [] |
| test_deps = [ "//src/lib/fuchsia-async" ] |
| |
| sources = [ "src/main.rs" ] |
| } |
| |
| # [END rustc_tests] |
| |
| fuchsia_component("hello-world-rust-component-v1") { |
| deps = [ ":bin" ] |
| component_name = "hello-world-rust" |
| manifest = "meta/hello_world_rust.cmx" |
| } |
| |
| fuchsia_component("hello-world-rust-component-v2") { |
| deps = [ ":bin" ] |
| component_name = "hello-world-rust" |
| manifest = "meta/hello_world_rust.cml" |
| } |
| |
| fuchsia_package("hello-world-rust") { |
| deps = [ |
| # component-url: fuchsia-pkg://fuchsia.com/hello-world-rust#meta/hello-world-rust.cmx |
| ":hello-world-rust-component-v1", |
| |
| # component-url: fuchsia-pkg://fuchsia.com/hello-world-rust#meta/hello-world-rust.cm |
| ":hello-world-rust-component-v2", |
| ] |
| } |
| |
| fuchsia_component("hello-world-rust-tests-component") { |
| testonly = true |
| |
| # The bin_test target is generated by rustc_binary |
| # when the with_unit_tests attribute is true. |
| deps = [ ":bin_test" ] |
| manifest = "meta/hello_world_rust_bin_test.cml" |
| component_name = "hello-world-rust-tests" |
| } |
| |
| fuchsia_test_package("hello-world-rust-tests") { |
| # component-url: fuchsia-pkg://fuchsia.com/hello-world-rust-tests#meta/hello-world-rust-tests.cm |
| test_components = [ ":hello-world-rust-tests-component" ] |
| } |