github.com/bazelbuild/bazel-gazelle@v0.36.1-0.20240520142334-61b277ba6fed/tests/BUILD.bazel (about)

     1  load(
     2      "//:def.bzl",
     3      "gazelle_binary",
     4      "gazelle_generation_test",
     5  )
     6  load("//tests:tools.bzl", "get_binary")
     7  
     8  # Exclude this entire directly from having anything gnerated by Gazelle. That
     9  # way the test cases won't be fixed by `bazel run //:gazelle` when run in this
    10  # repository.
    11  # gazelle:exclude **
    12  
    13  # This test Gazelle binary only has the "test_filegroup" plugin installed.
    14  gazelle_binary(
    15      name = "gazelle",
    16      languages = [
    17          "//internal/language/test_filegroup",
    18      ],
    19      visibility = ["//visibility:private"],
    20  )
    21  
    22  gazelle_binary(
    23      name = "gazelle_with_language_loads_from_flag",
    24      languages = [
    25          "//internal/language/test_loads_from_flag",
    26      ],
    27      visibility = ["//visibility:private"],
    28  )
    29  
    30  gazelle_binary(
    31      name = "gazelle_with_language_load_for_packed_rules",
    32      languages = [
    33          "//internal/language/test_load_for_packed_rules",
    34      ],
    35      visibility = ["//visibility:private"],
    36  )
    37  
    38  [gazelle_generation_test(
    39      # Name the test the path to the directory containing the WORKSPACE file.
    40      name = file[0:-len("/WORKSPACE")],
    41      gazelle_binary = get_binary(file),
    42      # This is a noop as the default is False. However, it does confirm that
    43      # gazelle_generation_test accepts setting common test attributes.
    44      local = False,
    45      test_data = glob(
    46          include = [file[0:-len("/WORKSPACE")] + "/**"],
    47      ),
    48  ) for file in glob(
    49      include = ["**/WORKSPACE"],
    50  )]