aboutsummaryrefslogtreecommitdiff
path: root/distribution/BUILD
blob: 1aa737c5a41afd27be1aed380a43fb32c3c446da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
load("distribution.bzl", "remove_internal_only")
load("@bazel_skylib//:version.bzl", "version")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")

package(
    default_visibility = ["//visibility:private"],
)

remove_internal_only(
    name = "distro_workspace",
    src = "//:WORKSPACE",
    out = "WORKSPACE",
)

remove_internal_only(
    name = "distro_module_bazel",
    src = "//:MODULE.bazel",
    out = "MODULE.bazel",
)

# remove "distribution/" path prefix
pkg_files(
    name = "distro-files-without-prefix",
    srcs = [
        "distro_module_bazel",
        "distro_workspace",
    ],
    strip_prefix = strip_prefix.from_pkg(),
)

pkg_tar(
    name = "bazel-skylib",
    srcs = [
        "distro-files-without-prefix",
        "//:distribution",
    ],
    out = "bazel-skylib-%s.tar.gz" % version,
    extension = "tar.gz",
    mode = "0644",
    # Make it owned by root so it does not have the uid of the CI robot.
    owner = "0.0",
    strip_prefix = strip_prefix.from_root(),
)

# @bazel_skylib_gazelle_plugin//:WORKSPACE refers to bazel-skylib in the parent
# directory. For distribution, use the minimal WORSKPACE.bzlmod instead.
pkg_files(
    name = "bazel-skylib-gazelle-plugin-distro_workspace",
    srcs = ["@bazel_skylib_gazelle_plugin//:WORKSPACE.bzlmod"],
    renames = {"@bazel_skylib_gazelle_plugin//:WORKSPACE.bzlmod": "WORKSPACE"},
)

pkg_files(
    name = "bazel-skylib-gazelle-plugin-without-external-prefix",
    srcs = [
        "@bazel_skylib_gazelle_plugin//:distribution",
        "@bazel_skylib_gazelle_plugin//bzl:distribution",
    ],
    strip_prefix = strip_prefix.from_root(),
)

pkg_tar(
    name = "bazel-skylib-gazelle-plugin",
    srcs = [
        "bazel-skylib-gazelle-plugin-distro_workspace",
        "bazel-skylib-gazelle-plugin-without-external-prefix",
        "//:LICENSE",
    ],
    out = "bazel-skylib-gazelle-plugin-%s.tar.gz" % version,
    extension = "tar.gz",
    mode = "0644",
    # Make it owned by root so it does not have the uid of the CI robot.
    owner = "0.0",
)

# Build the artifacts to put on the github release page.
filegroup(
    name = "distribution",
    srcs = [
        "bazel-skylib",
        "bazel-skylib-gazelle-plugin",
    ],
)