forked from sourcegraph/sourcegraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
112 lines (96 loc) · 3.17 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@aspect_rules_ts//ts:defs.bzl", "ts_config")
# Gazelle config
#
# gazelle:prefix github.com/sourcegraph/sourcegraph
# gazelle:build_file_name BUILD.bazel
# Disable some by default, only include configured BUILDs
#
# gazelle:aspect_js disabled
package(default_visibility = ["//visibility:public"])
npm_link_all_packages(name = "node_modules")
js_library(
name = "prettier_config_js",
srcs = ["prettier.config.js"],
data = [
"//:node_modules/@sourcegraph/prettierrc",
],
)
ts_config(
name = "tsconfig",
src = "tsconfig.bazel.json",
visibility = ["//visibility:public"],
deps = [
"//:node_modules/@sourcegraph/tsconfig",
"//:tsconfig.base.json",
],
)
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary")
gazelle_binary(
name = "gazelle-buf",
languages = [
# Loads the native proto extension
"@bazel_gazelle//language/proto:go_default_library",
# Gazelle-buf does not include the Go plugin by default, so we have to add it
# ourselves.
"@bazel_gazelle//language/go:go_default_library",
# Loads the Buf extension
"@rules_buf//gazelle/buf:buf",
# NOTE: This needs to be loaded after the proto language
],
)
# Tell gazelle what is our main module
# gazelle:prefix github.com/sourcegraph/sourcegraph
# Specify which protoc compilers we want when we detect GRPC service definitions.
# gazelle:go_grpc_compilers //:gen-go-grpc,@io_bazel_rules_go//proto:go_proto
gazelle(
name = "gazelle",
gazelle = ":gazelle-buf",
)
go_library(
name = "sourcegraph",
srcs = [
"doc.go",
"gen.go",
],
importpath = "github.com/sourcegraph/sourcegraph",
)
gazelle(
name = "gazelle-update-repos",
args = [
"-from_file=go.mod",
"-to_macro=deps.bzl%go_dependencies",
"-prune",
"-build_file_proto_mode=disable_global",
],
command = "update-repos",
)
load("@io_bazel_rules_go//proto/wkt:well_known_types.bzl", "WELL_KNOWN_TYPES_APIV2")
load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler")
# Because the current implementation of rules_go uses the old protoc grpc compiler, we have to declare our own, and declare it manually in the build files.
# See https://github.com/bazelbuild/rules_go/issues/3022
go_proto_compiler(
name = "gen-go-grpc",
plugin = "@org_golang_google_grpc_cmd_protoc_gen_go_grpc//:protoc-gen-go-grpc",
suffix = "_grpc.pb.go",
valid_archive = False,
visibility = ["//visibility:public"],
deps = WELL_KNOWN_TYPES_APIV2 + [
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
],
)
js_library(
name = "postcss_config_js",
srcs = ["postcss.config.js"],
deps = [
"//:node_modules/autoprefixer",
"//:node_modules/postcss-custom-media",
"//:node_modules/postcss-focus-visible",
"//:node_modules/postcss-inset",
],
)
exports_files(["go.mod"])