代码拉取完成,页面将自动刷新
//cmd/\{frontend,server\}
targets that don't include clien…
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "bool_setting")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "nogo")
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
load("@aspect_rules_ts//ts:defs.bzl", "ts_config")
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary")
load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler")
load("@io_bazel_rules_go//proto/wkt:well_known_types.bzl", "WELL_KNOWN_TYPES_APIV2")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("//dev/linters/staticcheck:analyzers.bzl", "STATIC_CHECK_ANALYZERS")
load("@npm//:eslint/package_json.bzl", eslint_bin = "bin")
load("//dev:eslint.bzl", "eslint_test_with_types")
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
# Gazelle config
#
# Tell gazelle what is our main module
# gazelle:prefix github.com/sourcegraph/sourcegraph
# gazelle:build_file_name BUILD.bazel
# Disable some by default, only include configured BUILDs
#
# gazelle:js disabled
# gazelle:js_npm_package_target_name {dirname}_pkg
# Enable: Aspect javascript, standard go
# gazelle:lang js,go,proto,gomockgen
# Enable race detection for all go_test rules.
# gazelle:map_kind go_test go_test //dev:go_defs.bzl
package(default_visibility = ["//visibility:public"])
npm_link_all_packages(name = "node_modules")
eslint_bin.eslint_binary(
name = "eslint",
testonly = True,
visibility = ["//visibility:public"],
)
js_library(
name = "prettier_config_js",
srcs = ["prettier.config.js"],
data = [
"//:node_modules/@sourcegraph/prettierrc",
],
)
ts_config(
name = "tsconfig",
src = "tsconfig.base.json",
visibility = ["//visibility:public"],
deps = [
"//:node_modules/@sourcegraph/tsconfig",
],
)
ts_config(
name = "tsconfig-all",
src = "tsconfig.json",
visibility = ["//visibility:public"],
deps = [
":tsconfig",
],
)
js_library(
name = "postcss_config_js",
srcs = ["postcss.config.js"],
visibility = ["//visibility:public"],
deps = [
"//:node_modules/autoprefixer",
"//:node_modules/postcss-custom-media",
"//:node_modules/postcss-focus-visible",
"//:node_modules/postcss-inset",
],
)
copy_to_bin(
name = "package_json",
srcs = ["package.json"],
visibility = ["//visibility:public"],
)
js_library(
name = "vitest_config",
testonly = True,
srcs = [
"vitest.shared.ts",
],
visibility = ["//visibility:public"],
deps = [
"//:node_modules/@testing-library/jest-dom",
"//:node_modules/abort-controller",
"//:node_modules/core-js",
"//:node_modules/identity-obj-proxy",
"//:node_modules/message-port-polyfill",
"//:node_modules/regenerator-runtime",
"//client/testing:testing_lib",
],
)
js_library(
name = "mocha_config",
testonly = True,
srcs = [
".mocharc.js",
],
deps = [
"//:node_modules/abort-controller",
"//client/shared/dev:mocha-reporter",
"//client/shared/dev:suppress-polly-errors",
"//client/testing:fetch-mock",
],
)
js_library(
name = "graphql_schema_config",
srcs = [
".graphqlrc.yml",
"graphql-schema-linter.config.js",
],
visibility = ["//visibility:public"],
)
js_library(
name = "eslint-relative-formatter",
srcs = [
"eslint-relative-formatter.js",
],
deps = [
":node_modules/chalk",
":node_modules/strip-ansi",
":node_modules/text-table",
],
)
js_library(
name = "eslint_config",
testonly = True,
srcs = [
".eslintrc.js",
],
data = [
"package.json",
":eslint-relative-formatter",
],
deps = [
":node_modules/@sourcegraph/eslint-config",
":node_modules/@sourcegraph/eslint-plugin-sourcegraph",
":node_modules/@sourcegraph/eslint-plugin-wildcard",
":node_modules/@typescript-eslint/eslint-plugin",
":node_modules/eslint-config-prettier",
":node_modules/eslint-import-resolver-node",
":node_modules/eslint-plugin-ban",
":node_modules/eslint-plugin-etc",
":node_modules/eslint-plugin-import",
":node_modules/eslint-plugin-jest-dom",
":node_modules/eslint-plugin-jsdoc",
":node_modules/eslint-plugin-jsx-a11y",
":node_modules/eslint-plugin-monorepo",
":node_modules/eslint-plugin-react",
":node_modules/eslint-plugin-react-hooks",
":node_modules/eslint-plugin-rxjs",
":node_modules/eslint-plugin-storybook",
":node_modules/eslint-plugin-unicorn",
":node_modules/eslint-plugin-unused-imports",
":node_modules/react", # required to resolve the react version for eslint-plugin-react
":tsconfig-all",
"//:node_modules/tslib",
],
)
eslint_test_with_types(
name = "eslint_test",
srcs = glob(["*.js"]),
config = ":eslint_config",
deps = [
":node_modules/@types/node",
],
)
buildifier(
name = "buildifier",
exclude_patterns = [
"./.git/*",
"cmd/symbols/squirrel/test_repos/starlark/**/*",
],
# TODO: enable these lint checks
# lint_mode = "fix",
mode = "fix",
)
buildifier(
name = "buildifier.check",
exclude_patterns = [
"./.git/*",
"cmd/symbols/squirrel/test_repos/starlark/**/*",
],
# TODO: enable these lint checks
# lint_mode = "warn",
mode = "diff",
)
# Go
gazelle_binary(
name = "gazelle-bin",
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",
"//dev/go-mockgen-gazelle:go-mockgen-gazelle",
# Bundled with aspect-cli, but we're missing out on buf that way
"@aspect_cli//gazelle/js:js",
# Loads the Buf extension
# NOTE: This needs to be loaded after the proto language
"@rules_buf//gazelle/buf:buf",
],
)
gazelle(
name = "gazelle",
gazelle = ":gazelle-bin",
)
sh_binary(
name = "configure",
srcs = ["//dev/ci:bazel-configure.sh"],
)
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",
)
# 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
# gazelle:go_grpc_compilers //:gen-go-grpc,@io_bazel_rules_go//proto:go_proto
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",
],
)
# Settings for automatic building of frontend/single-server without client bundle included
bool_setting(
name = "integration_testing",
build_setting_default = False,
)
config_setting(
name = "integration_testing_enabled",
flag_values = {":integration_testing": "true"},
)
# nogo config
#
# For nogo to be able to run a linter, it needs to have `var Analyzer analysis.Analyzer` defined in the main package.
# some of the linters do not have that, so we need to define that ourselves. The linters where we have defined can
# be found at dev/linters. Finally, the nogo configuration can be found at the root of the repository in `nogo_config.json`
bool_flag(
name = "disable_nogo",
build_setting_default = False,
)
config_setting(
name = "nogo_disabled",
flag_values = {":disable_nogo": "true"},
)
nogo(
name = "sg_nogo",
config = ":nogo_config.json",
vet = True,
visibility = ["//visibility:public"], # must have public visibility
deps = select({
"//:nogo_disabled": [],
"//conditions:default": [
"//dev/linters/bodyclose",
"//dev/linters/depguard",
"//dev/linters/forbidigo",
"//dev/linters/gocheckcompilerdirectives",
"//dev/linters/gocritic",
"//dev/linters/ineffassign",
"//dev/linters/logging",
"//dev/linters/unparam",
"//dev/linters/tracinglibraries",
"//dev/linters/dbconn",
"//dev/linters/nolocalhost",
# Disabled because we currently have a lot of unused code
# "//dev/linters/unused",
] + STATIC_CHECK_ANALYZERS,
}),
)
exports_files([
"go.mod",
"sg.config.yaml",
# Used for when copy_to_directory might reference an empty filegroup
# under certain conditions. See //ui/assets/...
"CONTRIBUTING.md",
".swcrc",
] + glob(["mockgen*.yaml"]))
# sg msp settings
bool_flag(
name = "sg_msp",
build_setting_default = False,
visibility = ["//visibility:public"],
)
config_setting(
name = "sg_msp_flag",
flag_values = {
"//:sg_msp": "True",
},
)
load("@rules_apko//apko:defs.bzl", "apko_bazelrc")
load("@rules_apko//apko:repositories.bzl", "apko_register_toolchains", "rules_apko_dependencies")
load("@rules_apko//apko:toolchain.bzl", "apko_toolchain")
apko_bazelrc(
name = "apko_bazelrc",
repositories = [
"dl-cdn.alpinelinux.org",
"packages.wolfi.dev",
"packages.sgdev.org",
"storage.googleapis.com",
],
)
# All the below toolchain creation can be removed (and their registration in WORKSPACE)
# on the following PR is merged and released https://github.com/chainguard-dev/go-apk/pull/216
apko_toolchain(
name = "apko",
apko = "@dev_chainguard_apko//:apko",
version = "0.13.2",
)
toolchain(
name = "apko_linux_toolchain",
exec_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
toolchain = "//:apko",
toolchain_type = "@rules_apko//apko:toolchain_type",
)
toolchain(
name = "apko_darwin_arm64_toolchain",
exec_compatible_with = [
"@platforms//os:macos",
"@platforms//cpu:aarch64",
],
toolchain = "//:apko",
toolchain_type = "@rules_apko//apko:toolchain_type",
)
toolchain(
name = "apko_darwin_amd64_toolchain",
exec_compatible_with = [
"@platforms//os:macos",
"@platforms//cpu:x86_64",
],
toolchain = "//:apko",
toolchain_type = "@rules_apko//apko:toolchain_type",
)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。