| # 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. | |
| import("//build/package.gni") | |
| import("//build/rust/rustc_binary.gni") | |
| import("//build/rust/rustc_library.gni") | |
| import("//build/rust/rustc_test.gni") | |
| import("//garnet/bin/wayland/protocol.gni") | |
| rustc_library("lib") { | |
| edition = "2018" | |
| name = "wayland_scanner_lib" | |
| deps = [ | |
| "//third_party/rust_crates:num", | |
| "//third_party/rust_crates:xml-rs", | |
| ] | |
| sources = [ | |
| "src/ast.rs", | |
| "src/codegen.rs", | |
| "src/lib.rs", | |
| "src/parser.rs", | |
| ] | |
| } | |
| if (host_toolchain == current_toolchain) { | |
| rustc_binary("scanner") { | |
| edition = "2018" | |
| deps = [ | |
| ":lib", | |
| "//third_party/rust_crates:structopt", | |
| ] | |
| sources = [ "src/main.rs" ] | |
| } | |
| } | |
| rustc_test("wayland_scanner_front_end_test") { | |
| edition = "2018" | |
| deps = [ ":lib" ] | |
| source_root = "tests/front_end_test.rs" | |
| sources = [ "tests/front_end_test.rs" ] | |
| } | |
| wayland_protocol("test_protocol") { | |
| protocol = "tests/test_protocol.xml" | |
| } | |
| rustc_test("wayland_scanner_back_end_test") { | |
| edition = "2018" | |
| deps = [ | |
| ":lib", | |
| ":test_protocol", | |
| "//garnet/bin/wayland/core", | |
| "//src/lib/zerocopy", | |
| "//src/lib/zircon/rust:fuchsia-zircon", | |
| ] | |
| source_root = "tests/back_end_test.rs" | |
| sources = [ "tests/back_end_test.rs" ] | |
| } | |
| group("tests") { | |
| testonly = true | |
| public_deps = [ | |
| ":wayland_scanner_back_end_test", | |
| ":wayland_scanner_front_end_test", | |
| ] | |
| } |