| # 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/package.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/test/test_package.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" ] |
| } |
| |
| # [END rustc_tests] |
| |
| package("hello_world_rust") { |
| deps = [ ":bin" ] |
| |
| binaries = [ |
| { |
| name = "hello_world_rust" |
| }, |
| ] |
| |
| meta = [ |
| { |
| path = rebase_path("meta/hello_world_rust.cmx") |
| dest = "hello_world_rust.cmx" |
| }, |
| { |
| path = rebase_path("meta/hello_world_rust.cml") |
| dest = "hello_world_rust.cm" |
| }, |
| ] |
| } |
| |
| test_package("hello_world_rust_tests") { |
| # The bin_test target is generated by rustc_binary |
| # when the with_unit_tests attribute is true. |
| deps = [ ":bin_test" ] |
| |
| meta = [ |
| { |
| path = "meta/hello_world_rust_bin_test.cml" |
| dest = "hello_world_rust_bin_test.cm" |
| }, |
| ] |
| |
| tests = [ |
| { |
| # The hello_world_rust_bin_test target is generated by rustc_binary |
| # when the with_unit_tests attribute is true. |
| name = "hello_world_rust_bin_test" |
| }, |
| ] |
| } |