Skip to content

Commit

Permalink
fix: remove need for rules_go when depending on a bzl_library target (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kormide authored Nov 16, 2023
1 parent 2b38ad5 commit c3a8cb0
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion e2e/coreutils/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
41 changes: 1 addition & 40 deletions tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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"],
Expand Down
40 changes: 40 additions & 0 deletions tools/release/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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"],
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions tools/release.bzl → tools/release/release.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def release(name, targets, **kwargs):
"@aspect_bazel_lib//lib:bzlmod": ["@platforms//:incompatible"],
"//conditions:default": [],
})),
visibility = ["//tools:__pkg__"],
**kwargs
)

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

0 comments on commit c3a8cb0

Please sign in to comment.