diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5ee4dcf..e7d9ec4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: exit 1 fi rm -rf /tmp/aspect/release - bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc run //tools:release -- /tmp/aspect/release + bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc run //tools/release -- /tmp/aspect/release - name: Prepare workspace snippet run: .github/workflows/release_prep.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt - name: Release diff --git a/e2e/coreutils/BUILD.bazel b/e2e/coreutils/BUILD.bazel index 086a2db..9daf588 100644 --- a/e2e/coreutils/BUILD.bazel +++ b/e2e/coreutils/BUILD.bazel @@ -1,5 +1,5 @@ load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files") -load("@aspect_bazel_lib//tools:hashes.bzl", "hashes") +load("@aspect_bazel_lib//tools/release:hashes.bzl", "hashes") genrule( name = "ls", diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel index e67cc10..dce562a 100644 --- a/tools/BUILD.bazel +++ b/tools/BUILD.bazel @@ -1,59 +1,20 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("//lib:utils.bzl", "is_bazel_6_or_greater") load("//lib:write_source_files.bzl", "write_source_files") -load(":release.bzl", "multi_platform_go_binaries", "release") exports_files([ "create_release.sh", "create_version.sh", ]) -multi_platform_go_binaries( - name = "copy_to_directory", - embed = ["//tools/copy_to_directory:copy_to_directory_lib"], - tags = ["manual"], -) - -multi_platform_go_binaries( - name = "copy_directory", - embed = ["//tools/copy_directory:copy_directory_lib"], - tags = ["manual"], -) - -multi_platform_go_binaries( - name = "expand_template", - embed = ["//tools/expand_template:expand_template_lib"], - tags = ["manual"], -) - -release( - name = "release", - tags = [ - "local", - "manual", - "no-remote", - ], - targets = [ - ":copy_directory", - ":copy_to_directory", - ":expand_template", - ], -) - write_source_files( name = "releases_versions_check_in", files = { - "integrity.bzl": ":release_versions", + "integrity.bzl": "//tools/release:release_versions", }, tags = (["manual"] if not is_bazel_6_or_greater() else []), ) -bzl_library( - name = "hashes", - srcs = ["hashes.bzl"], - visibility = ["//visibility:public"], -) - bzl_library( name = "integrity", srcs = ["integrity.bzl"], diff --git a/tools/release/BUILD.bazel b/tools/release/BUILD.bazel new file mode 100644 index 0000000..5b4e00b --- /dev/null +++ b/tools/release/BUILD.bazel @@ -0,0 +1,40 @@ +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") +load(":release.bzl", "multi_platform_go_binaries", "release") + +multi_platform_go_binaries( + name = "copy_to_directory", + embed = ["//tools/copy_to_directory:copy_to_directory_lib"], + tags = ["manual"], +) + +multi_platform_go_binaries( + name = "copy_directory", + embed = ["//tools/copy_directory:copy_directory_lib"], + tags = ["manual"], +) + +multi_platform_go_binaries( + name = "expand_template", + embed = ["//tools/expand_template:expand_template_lib"], + tags = ["manual"], +) + +release( + name = "release", + tags = [ + "local", + "manual", + "no-remote", + ], + targets = [ + ":copy_directory", + ":copy_to_directory", + ":expand_template", + ], +) + +bzl_library( + name = "hashes", + srcs = ["hashes.bzl"], + visibility = ["//visibility:public"], +) diff --git a/tools/create_release.sh b/tools/release/create_release.sh similarity index 100% rename from tools/create_release.sh rename to tools/release/create_release.sh diff --git a/tools/create_versions.sh b/tools/release/create_versions.sh similarity index 100% rename from tools/create_versions.sh rename to tools/release/create_versions.sh diff --git a/tools/hashes.bzl b/tools/release/hashes.bzl similarity index 100% rename from tools/hashes.bzl rename to tools/release/hashes.bzl diff --git a/tools/release.bzl b/tools/release/release.bzl similarity index 94% rename from tools/release.bzl rename to tools/release/release.bzl index 0e2e0f3..40dc44c 100644 --- a/tools/release.bzl +++ b/tools/release/release.bzl @@ -84,6 +84,7 @@ def release(name, targets, **kwargs): "@aspect_bazel_lib//lib:bzlmod": ["@platforms//:incompatible"], "//conditions:default": [], })), + visibility = ["//tools:__pkg__"], **kwargs ) @@ -92,9 +93,9 @@ def release(name, targets, **kwargs): srcs = targets, outs = ["release.sh"], executable = True, - cmd = "./$(location //tools:create_release.sh) {locations} > \"$@\"".format( + cmd = "./$(location //tools/release:create_release.sh) {locations} > \"$@\"".format( locations = " ".join(["$(locations {})".format(target) for target in targets]), ), - tools = ["//tools:create_release.sh"], + tools = ["//tools/release:create_release.sh"], **kwargs )