1load("@bazel_skylib//:version.bzl", "version") 2load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") 3load("@rules_pkg//:pkg.bzl", "pkg_tar") 4load("distribution.bzl", "remove_internal_only") 5 6package( 7 default_applicable_licenses = ["//:license"], 8 default_visibility = ["//visibility:private"], 9) 10 11licenses(["notice"]) 12 13remove_internal_only( 14 name = "distro_workspace", 15 src = "//:WORKSPACE", 16 out = "WORKSPACE", 17) 18 19remove_internal_only( 20 name = "distro_module_bazel", 21 src = "//:MODULE.bazel", 22 out = "MODULE.bazel", 23) 24 25# remove "distribution/" path prefix 26pkg_files( 27 name = "distro-files-without-prefix", 28 srcs = [ 29 "distro_module_bazel", 30 "distro_workspace", 31 ], 32 strip_prefix = strip_prefix.from_pkg(), 33) 34 35pkg_tar( 36 name = "bazel-skylib", 37 srcs = [ 38 "distro-files-without-prefix", 39 "//:distribution", 40 ], 41 out = "bazel-skylib-%s.tar.gz" % version, 42 extension = "tar.gz", 43 mode = "0644", 44 # Make it owned by root so it does not have the uid of the CI robot. 45 owner = "0.0", 46 strip_prefix = strip_prefix.from_root(), 47) 48 49# @bazel_skylib_gazelle_plugin//:WORKSPACE refers to bazel-skylib in the parent 50# directory. For distribution, use the minimal WORSKPACE.bzlmod instead. 51pkg_files( 52 name = "bazel-skylib-gazelle-plugin-distro_workspace", 53 srcs = ["@bazel_skylib_gazelle_plugin//:WORKSPACE.bzlmod"], 54 renames = {"@bazel_skylib_gazelle_plugin//:WORKSPACE.bzlmod": "WORKSPACE"}, 55) 56 57pkg_files( 58 name = "bazel-skylib-gazelle-plugin-without-external-prefix", 59 srcs = [ 60 "@bazel_skylib_gazelle_plugin//:distribution", 61 "@bazel_skylib_gazelle_plugin//bzl:distribution", 62 ], 63 strip_prefix = strip_prefix.from_root(), 64) 65 66pkg_tar( 67 name = "bazel-skylib-gazelle-plugin", 68 srcs = [ 69 "bazel-skylib-gazelle-plugin-distro_workspace", 70 "bazel-skylib-gazelle-plugin-without-external-prefix", 71 "//:LICENSE", 72 ], 73 out = "bazel-skylib-gazelle-plugin-%s.tar.gz" % version, 74 extension = "tar.gz", 75 mode = "0644", 76 # Make it owned by root so it does not have the uid of the CI robot. 77 owner = "0.0", 78) 79 80# Build the artifacts to put on the github release page. 81filegroup( 82 name = "distribution", 83 srcs = [ 84 "bazel-skylib", 85 "bazel-skylib-gazelle-plugin", 86 ], 87) 88