1load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
2load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
3load("//test/snapshot:snapshot.bzl", "generate_snapshots")
4
5go_library(
6 name = "graph",
7 srcs = [
8 "d2.go",
9 "dot.go",
10 "dot_style.go",
11 "graph.go",
12 "tree.go",
13 ],
14 embedsrcs = ["style.d2"],
15 importpath = "edge-infra.dev/pkg/f8n/warehouse/lift/cmd/graph",
16 visibility = ["//visibility:public"],
17 deps = [
18 "//pkg/f8n/warehouse",
19 "//pkg/f8n/warehouse/lift",
20 "//pkg/f8n/warehouse/lift/cmd/internal",
21 "//pkg/f8n/warehouse/oci",
22 "//pkg/f8n/warehouse/oci/layer",
23 "//pkg/f8n/warehouse/oci/name",
24 "//pkg/f8n/warehouse/oci/walk",
25 "//pkg/lib/cli/rags",
26 "//pkg/lib/cli/sink",
27 "//pkg/lib/text/drawing",
28 "@com_github_google_go_containerregistry//pkg/v1:pkg",
29 "@com_github_google_go_containerregistry//pkg/v1/types",
30 "@com_terrastruct_oss_d2//d2format",
31 "@com_terrastruct_oss_d2//d2graph",
32 "@com_terrastruct_oss_d2//d2layouts/d2elklayout",
33 "@com_terrastruct_oss_d2//d2lib",
34 "@com_terrastruct_oss_d2//d2oracle",
35 "@com_terrastruct_oss_d2//d2target",
36 "@com_terrastruct_oss_d2//lib/textmeasure",
37 "@io_k8s_sigs_kustomize_api//resource",
38 ],
39)
40
41go_test(
42 name = "graph_test",
43 srcs = [
44 "d2_test.go",
45 "dot_test.go",
46 "graph_test.go",
47 "tree_test.go",
48 ],
49 data = glob(["testdata/**"]),
50 embed = [":graph"],
51 deps = [
52 "//pkg/f8n/warehouse/oci",
53 "//test/fixtures",
54 "//test/snapshot",
55 "@com_github_google_go_containerregistry//pkg/name",
56 "@com_github_stretchr_testify//assert",
57 "@com_github_stretchr_testify//require",
58 "@com_terrastruct_oss_d2//d2format",
59 "@com_terrastruct_oss_d2//d2renderers/d2svg",
60 "@com_terrastruct_oss_d2//lib/log",
61 "@com_terrastruct_oss_util_go//go2",
62 ],
63)
64
65generate_snapshots(
66 name = "graph_snapshots",
67 testonly = True,
68 srcs = glob(["testdata/**"]),
69 snapshot_path = "pkg/f8n/warehouse/lift/cmd/graph/testdata/snapshots",
70 snapshot_test = ":graph_test",
71)
72
73write_source_files(
74 name = "update_snapshots_graph",
75 testonly = True,
76 files = {
77 "testdata/snapshots": ":graph_snapshots",
78 },
79)
View as plain text