| # 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/dart/dart_library.gni") |
| import("//build/go/go_binary.gni") |
| import("//build/go/go_library.gni") |
| import("//build/go/go_test.gni") |
| import("//build/go/toolchain.gni") |
| import("//build/host.gni") |
| import("//build/sdk/sdk_host_tool.gni") |
| import("//zircon/tools/fidl/testdata/targets.gni") |
| |
| go_library("fidlgen_dart_lib") { |
| name = "go.fuchsia.dev/fuchsia/tools/fidl/fidlgen_dart/..." |
| |
| deps = [ "//tools/fidl/lib/fidlgen" ] |
| sources = [ |
| "backend/generator.go", |
| "backend/ir/ir.go", |
| "backend/templates/bits.tmpl.go", |
| "backend/templates/const.tmpl.go", |
| "backend/templates/enum.tmpl.go", |
| "backend/templates/interface.tmpl.go", |
| "backend/templates/library.tmpl.go", |
| "backend/templates/struct.tmpl.go", |
| "backend/templates/table.tmpl.go", |
| "backend/templates/union.tmpl.go", |
| "fidlgen_dart.go", |
| ] |
| } |
| |
| go_library("fidlgen_dart_test_lib") { |
| name = "go.fuchsia.dev/fuchsia/tools/fidl/fidlgen_dart/..." |
| testonly = true |
| |
| deps = [ |
| ":fidlgen_dart_lib", |
| "//garnet/go/src/fidl/compiler/backend/typestest", |
| ] |
| if (is_linux || is_mac) { |
| non_go_deps = [ "goldens" ] |
| } |
| sources = [ "backend/codegen_test.go" ] |
| } |
| |
| go_binary("fidlgen_dart") { |
| gopackage = "go.fuchsia.dev/fuchsia/tools/fidl/fidlgen_dart/" |
| deps = [ ":fidlgen_dart_lib" ] |
| } |
| |
| sdk_host_tool("fidlgen_dart_sdk") { |
| category = "partner" |
| output_name = "fidlgen_dart" |
| deps = [ ":fidlgen_dart" ] |
| } |
| |
| if (is_host) { |
| go_test("fidlgen_dart_backend_test") { |
| gopackages = [ "go.fuchsia.dev/fuchsia/tools/fidl/fidlgen_dart/backend" ] |
| |
| deps = [ ":fidlgen_dart_test_lib" ] |
| non_go_deps = [ ":copies" ] |
| } |
| } |
| |
| group("copies") { |
| deps = [ |
| ":copy_dart", |
| ":copy_dartfmt", |
| ":copy_dartsnapshot", |
| ] |
| metadata = { |
| test_runtime_deps = [ |
| "$root_out_dir/test_data/fidlgen_dart/dart", |
| "$root_out_dir/test_data/fidlgen_dart/dartfmt", |
| "$root_out_dir/test_data/fidlgen_dart/snapshots/dartfmt.dart.snapshot", |
| ] |
| } |
| } |
| |
| copy("copy_dartsnapshot") { |
| deps = dart_sdk_deps |
| sources = [ "$dart_sdk/bin/snapshots/dartfmt.dart.snapshot" ] |
| outputs = |
| [ "$root_out_dir/test_data/fidlgen_dart/snapshots/dartfmt.dart.snapshot" ] |
| } |
| |
| copy("copy_dart") { |
| deps = dart_sdk_deps |
| sources = [ "$dart_sdk/bin/dart" ] |
| outputs = [ "$root_out_dir/test_data/fidlgen_dart/dart" ] |
| } |
| |
| copy("copy_dartfmt") { |
| deps = dart_sdk_deps |
| sources = [ "$dart_sdk/bin/dartfmt" ] |
| outputs = [ "$root_out_dir/test_data/fidlgen_dart/dartfmt" ] |
| } |
| |
| install_host_tools("host") { |
| deps = [ ":fidlgen_dart" ] |
| outputs = [ "fidlgen_dart" ] |
| } |
| |
| group("goldens") { |
| testonly = true |
| |
| denylist = [ |
| # TODO(fxbug.dev/62763): Fix undefined_identifier errors. |
| "//zircon/tools/fidl/testdata:fidl.test.consts", |
| |
| # TODO(fxbug.dev/62761): Fix error about default value not being constant. |
| "//zircon/tools/fidl/testdata/struct_default_value_enum_library_reference:example", |
| ] |
| |
| deps = [] |
| foreach(target, fidl_testdata_targets - denylist) { |
| deps += [ "$target($dart_toolchain)" ] |
| } |
| } |
| |
| group("tests") { |
| # TODO(ianloic): put fidlgen_dart non-host test targets here |
| testonly = true |
| deps = [ |
| ":fidlgen_dart_backend_test($host_toolchain)", |
| ":goldens", |
| ] |
| } |