| load( |
| "//go/private/tools:lines_sorted_test.bzl", |
| "lines_sorted_test", |
| ) |
| load( |
| "//go/private/rules:nogo.bzl", |
| "nogo", |
| ) |
| load( |
| "//go/private/rules:info.bzl", |
| "go_info", |
| ) |
| load( |
| "//go:def.bzl", |
| "TOOLS_NOGO", |
| ) |
| load( |
| "//go/private:context.bzl", |
| "cgo_context_data", |
| "cgo_context_data_proxy", |
| "go_config", |
| "go_context_data", |
| ) |
| load( |
| "//go/private/rules:stdlib.bzl", |
| "stdlib", |
| ) |
| |
| # gazelle:prefix github.com/bazelbuild/rules_go |
| # gazelle:exclude tests |
| # gazelle:exclude third_party |
| # gazelle:exclude go/tools/builders |
| # gazelle:exclude go/tools/coverdata |
| # gazelle:exclude go/tools/fetch_repo |
| # gazelle:exclude go/tools/windows-testrunner |
| # gazelle:go_naming_convention import_alias |
| |
| # TODO(jayconrod): add a gazelle rule so gazelle can be run automatically. |
| # It can't go here though, because it would break anything that depends on |
| # rules_go but not Gazelle, including our own go_bazel_tests. |
| |
| stdlib( |
| name = "stdlib", |
| cgo_context_data = select({ |
| "//go/platform:internal_cgo_off": None, |
| "//conditions:default": ":cgo_context_data", |
| }), |
| visibility = ["//visibility:public"], |
| ) |
| |
| # default_nogo is the nogo target that nogo references by default. It |
| # does not analyze anything, which means no binary is built or run |
| # at compile time. |
| filegroup( |
| name = "default_nogo", |
| visibility = ["//visibility:public"], |
| ) |
| |
| # tools_nogo includes all of the analysis passes in |
| # golang.org/x/tools/go/analysis/passes. |
| # This is not backward compatible, so use caution when depending on this -- |
| # new analyses may discover issues in existing builds. |
| nogo( |
| name = "tools_nogo", |
| visibility = ["//visibility:public"], |
| deps = TOOLS_NOGO, |
| ) |
| |
| # go_context_data collects build options and is depended on by all Go targets. |
| # It may depend on cgo_context_data if CGo isn't disabled. |
| go_context_data( |
| name = "go_context_data", |
| cgo_context_data = select({ |
| "//go/platform:internal_cgo_off": None, |
| "//conditions:default": ":cgo_context_data", |
| }), |
| coverdata = "//go/tools/coverdata", |
| go_config = ":go_config", |
| nogo = "@io_bazel_rules_nogo//:nogo", |
| stdlib = ":stdlib", |
| visibility = ["//visibility:public"], |
| ) |
| |
| # cgo_context_data collects information about the C/C++ toolchain. |
| # go_context_data depends if cgo is enabled in the target configuration. |
| cgo_context_data( |
| name = "cgo_context_data", |
| visibility = ["//visibility:private"], |
| ) |
| |
| # cgo_context_data_proxy depends on cgo_context_data if cgo is enabled and |
| # forwards its provider. Rule attributes may depend on this, since they cannot |
| # use select. |
| cgo_context_data_proxy( |
| name = "cgo_context_data_proxy", |
| actual = select({ |
| "//go/platform:internal_cgo_off": None, |
| "//conditions:default": ":cgo_context_data", |
| }), |
| visibility = ["//visibility:public"], |
| ) |
| |
| # go_config collects information about build settings in the current |
| # configuration. go_context_data depends on this so that rules don't need |
| # to depend on all build settings directly. |
| go_config( |
| name = "go_config", |
| cover_format = "//go/config:cover_format", |
| # Always include debug symbols with -c dbg. |
| debug = select({ |
| "//go/private:is_compilation_mode_dbg": "//go/private:always_true", |
| "//conditions:default": "//go/config:debug", |
| }), |
| gotags = "//go/config:tags", |
| linkmode = "//go/config:linkmode", |
| msan = "//go/config:msan", |
| pure = "//go/config:pure", |
| race = "//go/config:race", |
| stamp = select({ |
| "//go/private:stamp": True, |
| "//conditions:default": False, |
| }), |
| static = "//go/config:static", |
| strip = "//go/config:strip", |
| visibility = ["//visibility:public"], |
| ) |
| |
| lines_sorted_test( |
| name = "contributors_sorted_test", |
| size = "small", |
| cmd = "grep -v '^#' $< | grep -v '^$$' >$@", |
| error_message = "Contributors must be sorted by first name", |
| file = "CONTRIBUTORS", |
| ) |
| |
| lines_sorted_test( |
| name = "authors_sorted_test", |
| size = "small", |
| cmd = "grep -v '^#' $< | grep -v '^$$' >$@", |
| error_message = "Authors must be sorted by first name", |
| file = "AUTHORS", |
| ) |
| |
| # AUTHORS is used as an anchor point for the directory in tests and the |
| # license can be consumed by depending projects. |
| exports_files([ |
| "AUTHORS", |
| "LICENSE.txt", |
| ]) |
| |
| go_info() |
| |
| filegroup( |
| name = "all_files", |
| testonly = True, |
| srcs = [ |
| "BUILD.bazel", |
| "WORKSPACE", |
| "//extras:all_files", |
| "//go:all_files", |
| "//proto:all_files", |
| "//third_party:all_files", |
| ], |
| visibility = ["//visibility:public"], |
| ) |