| # Copyright 2019 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_macro.gni") |
| import("//build/rust/rustc_test.gni") |
| |
| template("rustc_macro_with_test") { |
| rustc_macro(target_name) { |
| configs -= [ "//build/config/rust:allow_unused_results" ] |
| forward_variables_from(invoker, |
| [ |
| "version", |
| "edition", |
| "deps", |
| "sources", |
| ]) |
| } |
| |
| # proc-macro dependencies are only available on host. |
| if (is_host) { |
| rustc_test("${target_name}_test") { |
| configs -= [ "//build/config/rust:allow_unused_results" ] |
| forward_variables_from(invoker, |
| [ |
| "version", |
| "edition", |
| "deps", |
| "sources", |
| ]) |
| } |
| } |
| } |
| |
| rustc_macro_with_test("zerocopy-derive") { |
| version = "0.1.0" |
| edition = "2018" |
| |
| deps = [ |
| "//third_party/rust_crates:proc-macro2", |
| "//third_party/rust_crates:syn", |
| "//third_party/rust_crates:synstructure", |
| ] |
| |
| sources = [ |
| "src/ext.rs", |
| "src/lib.rs", |
| "src/repr.rs", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| public_deps = [ ":zerocopy-derive_test($host_toolchain)" ] |
| } |