github.com/bazelbuild/rules_go@v0.47.2-0.20240515105122-e7ddb9ea474e/go/private/BUILD.bazel (about)

     1  load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
     2  load("@bazel_skylib//rules:common_settings.bzl", "bool_setting")
     3  
     4  filegroup(
     5      name = "all_rules",
     6      srcs = [
     7          "//go/private/actions:all_rules",
     8          "//go/private/rules:all_rules",
     9          "//go/private/skylib/lib:all_rules",
    10          "//go/private/tools:all_rules",
    11      ] + glob(["**/*.bzl"]),
    12      visibility = ["//visibility:public"],
    13  )
    14  
    15  filegroup(
    16      name = "all_files",
    17      testonly = True,
    18      srcs = [
    19          "//go/private/actions:all_files",
    20          "//go/private/rules:all_files",
    21          "//go/private/skylib/lib:all_files",
    22          "//go/private/tools:all_files",
    23      ] + glob(["**"]),
    24      visibility = ["//visibility:public"],
    25  )
    26  
    27  config_setting(
    28      name = "stamp",
    29      values = {"stamp": "true"},
    30      visibility = ["//:__pkg__"],
    31  )
    32  
    33  config_setting(
    34      name = "is_strip_always",
    35      values = {"strip": "always"},
    36      visibility = ["//:__pkg__"],
    37  )
    38  
    39  config_setting(
    40      name = "is_strip_sometimes_fastbuild",
    41      values = {
    42          "strip": "sometimes",
    43          "compilation_mode": "fastbuild",
    44      },
    45      visibility = ["//:__pkg__"],
    46  )
    47  
    48  bzl_library(
    49      name = "context",
    50      srcs = ["context.bzl"],
    51      visibility = [
    52          "//docs:__subpackages__",
    53          "//extras:__pkg__",  # Manually added
    54          "//go:__subpackages__",
    55      ],
    56      deps = [
    57          ":common",
    58          ":mode",
    59          ":providers",
    60          "//go/platform:apple",
    61          "//go/private:go_toolchain",
    62          "//go/private/rules:transition",
    63          "@bazel_skylib//lib:paths",
    64          "@bazel_skylib//rules:common_settings",
    65          "@bazel_tools//tools/build_defs/cc:action_names.bzl",
    66          "@bazel_tools//tools/cpp:toolchain_utils.bzl",
    67          "@io_bazel_rules_go_bazel_features//:features",
    68          "@io_bazel_rules_nogo//:scope.bzl",
    69      ],
    70  )
    71  
    72  bzl_library(
    73      name = "go_toolchain",
    74      srcs = ["go_toolchain.bzl"],
    75      visibility = [
    76          "//extras:__pkg__",  # Manually added
    77          "//go:__subpackages__",
    78      ],
    79      deps = [
    80          "//go/private:platforms",
    81          "//go/private:providers",
    82          "//go/private/actions:archive",
    83          "//go/private/actions:binary",
    84          "//go/private/actions:link",
    85          "//go/private/actions:stdlib",
    86          "@bazel_skylib//lib:selects",
    87      ],
    88  )
    89  
    90  bzl_library(
    91      name = "repositories",
    92      srcs = [
    93          "polyfill_bazel_features.bzl",
    94          "repositories.bzl",
    95      ],
    96      visibility = ["//go:__subpackages__"],
    97      # Don't list dependency on @bazel_tools//tools/build_defs/repo:http.bzl
    98      deps = [
    99          ":common",
   100          ":nogo",
   101          "//go/private/skylib/lib:versions",
   102          "//proto:gogo",
   103      ],  # keep
   104  )
   105  
   106  bzl_library(
   107      name = "sdk",
   108      srcs = ["sdk.bzl"],
   109      visibility = ["//go:__subpackages__"],
   110      deps = [
   111          "//go/private:common",
   112          "//go/private:nogo",
   113          "//go/private:platforms",
   114          "//go/private/skylib/lib:versions",
   115          "@bazel_tools//tools/build_defs/repo:utils.bzl",
   116      ],
   117  )
   118  
   119  bzl_library(
   120      name = "common",
   121      srcs = ["common.bzl"],
   122      visibility = ["//go:__subpackages__"],
   123  )
   124  
   125  bzl_library(
   126      name = "mode",
   127      srcs = ["mode.bzl"],
   128      visibility = ["//go:__subpackages__"],
   129  )
   130  
   131  bzl_library(
   132      name = "nogo",
   133      srcs = ["nogo.bzl"],
   134      visibility = ["//go:__subpackages__"],
   135  )
   136  
   137  bzl_library(
   138      name = "platforms",
   139      srcs = ["platforms.bzl"],
   140      visibility = ["//go:__subpackages__"],
   141  )
   142  
   143  bzl_library(
   144      name = "providers",
   145      srcs = ["providers.bzl"],
   146      visibility = [
   147          "//extras:__pkg__",
   148          "//go:__subpackages__",
   149          "//proto:__pkg__",  # keep
   150      ],
   151  )
   152  
   153  bzl_library(
   154      name = "rpath",
   155      srcs = ["rpath.bzl"],
   156      visibility = [
   157          "//docs:__subpackages__",
   158          "//go:__subpackages__",
   159      ],
   160  )
   161  
   162  # Usually false. This is only true when we are building nogo itself in which
   163  # because that rule uses an incoming transition to switch this to true.
   164  bool_setting(
   165      name = "bootstrap_nogo",
   166      build_setting_default = False,
   167      visibility = ["//visibility:public"],
   168  )
   169  
   170  # Usually true. The entire toolchain gets nogo to use in builds via the
   171  # go_context_data rule, which has an incoming transition that flips this flag
   172  # to true. This will only be false in host mode (which disallows any
   173  # transitions) or accessing nogo without going through go_context_data (which
   174  # does not happen in rules_go and does not seem to be useful).
   175  bool_setting(
   176      name = "request_nogo",
   177      build_setting_default = False,
   178      visibility = ["//visibility:public"],
   179  )
   180  
   181  # Controls whether nogo alias will reference a noop or the configured nogo.
   182  # This *MUST* default to the noop to allow for tools to be built in the
   183  # deprecated "host" mode. Host mode cannot perform configuration transitions
   184  # so it cannot avoid circular dependencies. Therefore the default must work
   185  # without performing any transitions. The tradeoff is that nogo analysis is not
   186  # performed for any target built in host mode - this is not as bad as it seems
   187  # as most tools can (and should) use "exec" configuration instead of host which
   188  # does support transitions.
   189  config_setting(
   190      name = "nogo_active",
   191      flag_values = {
   192          ":bootstrap_nogo": "False",
   193          ":request_nogo": "True",
   194      },
   195      visibility = ["//visibility:public"],
   196  )
   197  
   198  bool_setting(
   199      name = "always_true",
   200      build_setting_default = True,
   201      visibility = ["//visibility:public"],
   202  )
   203  
   204  # Only used by //:go_config.
   205  config_setting(
   206      name = "is_compilation_mode_dbg",
   207      values = {
   208          "compilation_mode": "dbg",
   209      },
   210      visibility = ["//:__pkg__"],
   211  )