| # Copyright 2024 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. |
| |
| load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") |
| load("@platforms//host:constraints.bzl", "HOST_CONSTRAINTS") |
| load("//build/bazel/rules/host:defs.bzl", "go_binary_host_tool") |
| |
| go_library( |
| name = "bazel2gn_lib", |
| srcs = [ |
| "bazel2gn.go", |
| "constants.go", |
| "genrule.go", |
| "select.go", |
| "transformers.go", |
| ], |
| importpath = "go.fuchsia.dev/fuchsia/build/tools/bazel2gn", |
| target_compatible_with = HOST_CONSTRAINTS, |
| deps = [ |
| "//third_party/golibs:go.starlark.net/syntax", |
| ], |
| ) |
| |
| # @bazel2gn:skip |
| go_binary_host_tool( |
| name = "bazel2gn", |
| srcs = [ |
| "cmd/main.go", |
| ], |
| target_compatible_with = HOST_CONSTRAINTS, |
| deps = [ |
| ":bazel2gn_lib", |
| "//third_party/golibs:github.com/google/go-cmp/cmp", |
| "//tools/lib/color", |
| "//tools/lib/logger", |
| ], |
| ) |
| |
| go_test( |
| name = "bazel2gn_tests", |
| srcs = [ |
| "bazel2gn_test.go", |
| "constants_test.go", |
| "genrule_test.go", |
| "select_test.go", |
| "transformers_test.go", |
| ], |
| embed = [ |
| ":bazel2gn_lib", |
| ], |
| target_compatible_with = HOST_CONSTRAINTS, |
| deps = [ |
| "//third_party/golibs:github.com/google/go-cmp/cmp", |
| "//third_party/golibs:go.starlark.net/syntax", |
| ], |
| ) |