fix: remove need for rules_go when depending on a bzl_library target (#663) (#664)

This commit is contained in:
Derek Cormier 2023-11-16 14:26:40 -08:00 committed by GitHub
parent 2b38ad5d29
commit c3a8cb0c72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 46 additions and 44 deletions

View File

@ -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

View File

@ -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",

View File

@ -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"],

40
tools/release/BUILD.bazel Normal file
View File

@ -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"],
)

View File

@ -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
)