fork of https://github.com/sourcegraph/zoekt
1load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
2
3# gazelle:prefix github.com/sourcegraph/zoekt
4# gazelle:build_file_name BUILD.bazel
5load("@bazel_gazelle//:def.bzl", "gazelle")
6
7gazelle(name = "gazelle")
8
9gazelle(
10 name = "gazelle-update-repos",
11 args = [
12 "-from_file=go.mod",
13 "-to_macro=deps.bzl%go_dependencies",
14 "-prune",
15 "-build_file_proto_mode=disable_global",
16 ],
17 command = "update-repos",
18)
19
20go_library(
21 name = "zoekt",
22 srcs = [
23 "api.go",
24 "api_proto.go",
25 "bits.go",
26 "btree.go",
27 "contentprovider.go",
28 "eval.go",
29 "hititer.go",
30 "indexbuilder.go",
31 "indexdata.go",
32 "indexfile.go",
33 "marshal.go",
34 "matchiter.go",
35 "matchtree.go",
36 "merge.go",
37 "ngramoffset.go",
38 "read.go",
39 "section.go",
40 "toc.go",
41 "tombstones.go",
42 "tombstones_unix.go",
43 "tombstones_windows.go",
44 "write.go",
45 ],
46 importpath = "github.com/sourcegraph/zoekt",
47 visibility = ["//visibility:public"],
48 deps = [
49 "//grpc/v1:grpc",
50 "//query",
51 "@com_github_edsrzf_mmap_go//:mmap-go",
52 "@com_github_go_enry_go_enry_v2//:go-enry",
53 "@com_github_go_enry_go_enry_v2//data",
54 "@com_github_grafana_regexp//:regexp",
55 "@com_github_rs_xid//:xid",
56 "@org_golang_google_protobuf//types/known/durationpb",
57 "@org_golang_google_protobuf//types/known/timestamppb",
58 "@org_golang_x_exp//slices",
59 ] + select({
60 "@io_bazel_rules_go//go/platform:aix": [
61 "@org_golang_x_sys//unix",
62 ],
63 "@io_bazel_rules_go//go/platform:android": [
64 "@org_golang_x_sys//unix",
65 ],
66 "@io_bazel_rules_go//go/platform:darwin": [
67 "@org_golang_x_sys//unix",
68 ],
69 "@io_bazel_rules_go//go/platform:dragonfly": [
70 "@org_golang_x_sys//unix",
71 ],
72 "@io_bazel_rules_go//go/platform:freebsd": [
73 "@org_golang_x_sys//unix",
74 ],
75 "@io_bazel_rules_go//go/platform:illumos": [
76 "@org_golang_x_sys//unix",
77 ],
78 "@io_bazel_rules_go//go/platform:ios": [
79 "@org_golang_x_sys//unix",
80 ],
81 "@io_bazel_rules_go//go/platform:js": [
82 "@org_golang_x_sys//unix",
83 ],
84 "@io_bazel_rules_go//go/platform:linux": [
85 "@org_golang_x_sys//unix",
86 ],
87 "@io_bazel_rules_go//go/platform:netbsd": [
88 "@org_golang_x_sys//unix",
89 ],
90 "@io_bazel_rules_go//go/platform:openbsd": [
91 "@org_golang_x_sys//unix",
92 ],
93 "@io_bazel_rules_go//go/platform:plan9": [
94 "@org_golang_x_sys//unix",
95 ],
96 "@io_bazel_rules_go//go/platform:solaris": [
97 "@org_golang_x_sys//unix",
98 ],
99 "//conditions:default": [],
100 }),
101)
102
103go_test(
104 name = "zoekt_test",
105 srcs = [
106 "api_proto_test.go",
107 "api_test.go",
108 "bits_test.go",
109 "btree_test.go",
110 "contentprovider_test.go",
111 "eval_test.go",
112 "hititer_test.go",
113 "index_test.go",
114 "marshal_test.go",
115 "matchtree_test.go",
116 "merge_test.go",
117 "ngramoffset_test.go",
118 "read_test.go",
119 "tombstones_test.go",
120 ],
121 data = ["//testdata"],
122 embed = [":zoekt"],
123 embedsrcs = ["//testdata:testdata"], #keep
124 deps = [
125 "//grpc/v1:grpc",
126 "//query",
127 "@com_github_google_go_cmp//cmp",
128 "@com_github_google_go_cmp//cmp/cmpopts",
129 "@com_github_grafana_regexp//:regexp",
130 "@com_github_roaringbitmap_roaring//:roaring",
131 "@org_golang_google_protobuf//proto",
132 ],
133)