load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files") load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") load("//test/snapshot:snapshot.bzl", "generate_snapshots") go_library( name = "graph", srcs = [ "d2.go", "dot.go", "dot_style.go", "graph.go", "tree.go", ], embedsrcs = ["style.d2"], importpath = "edge-infra.dev/pkg/f8n/warehouse/lift/cmd/graph", visibility = ["//visibility:public"], deps = [ "//pkg/f8n/warehouse", "//pkg/f8n/warehouse/lift", "//pkg/f8n/warehouse/lift/cmd/internal", "//pkg/f8n/warehouse/oci", "//pkg/f8n/warehouse/oci/layer", "//pkg/f8n/warehouse/oci/name", "//pkg/f8n/warehouse/oci/walk", "//pkg/lib/cli/rags", "//pkg/lib/cli/sink", "//pkg/lib/text/drawing", "@com_github_google_go_containerregistry//pkg/v1:pkg", "@com_github_google_go_containerregistry//pkg/v1/types", "@com_terrastruct_oss_d2//d2format", "@com_terrastruct_oss_d2//d2graph", "@com_terrastruct_oss_d2//d2layouts/d2elklayout", "@com_terrastruct_oss_d2//d2lib", "@com_terrastruct_oss_d2//d2oracle", "@com_terrastruct_oss_d2//d2target", "@com_terrastruct_oss_d2//lib/textmeasure", "@io_k8s_sigs_kustomize_api//resource", ], ) go_test( name = "graph_test", srcs = [ "d2_test.go", "dot_test.go", "graph_test.go", "tree_test.go", ], data = glob(["testdata/**"]), embed = [":graph"], deps = [ "//pkg/f8n/warehouse/oci", "//test/fixtures", "//test/snapshot", "@com_github_google_go_containerregistry//pkg/name", "@com_github_stretchr_testify//assert", "@com_github_stretchr_testify//require", "@com_terrastruct_oss_d2//d2format", "@com_terrastruct_oss_d2//d2renderers/d2svg", "@com_terrastruct_oss_d2//lib/log", "@com_terrastruct_oss_util_go//go2", ], ) generate_snapshots( name = "graph_snapshots", testonly = True, srcs = glob(["testdata/**"]), snapshot_path = "pkg/f8n/warehouse/lift/cmd/graph/testdata/snapshots", snapshot_test = ":graph_test", ) write_source_files( name = "update_snapshots_graph", testonly = True, files = { "testdata/snapshots": ":graph_snapshots", }, )