Skip to content

Commit 9b1eb3b

Browse files
authored
chore: update release rules & target to match silo (#470)
1 parent c5f37b5 commit 9b1eb3b

File tree

7 files changed

+79
-88
lines changed

7 files changed

+79
-88
lines changed

bazel/hash/BUILD.bazel

Lines changed: 0 additions & 48 deletions
This file was deleted.

bazel/hash/sha256.bzl

Lines changed: 0 additions & 23 deletions
This file was deleted.

release/BUILD.bazel

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ version_file(
1717

1818
bazelisk_artifacts(
1919
name = "aspect_bazelisk_artifacts",
20-
darwin_arm64 = ":aspect-darwin-arm64",
21-
darwin_x86_64 = ":aspect-darwin-amd64",
22-
linux_arm64 = ":aspect-linux-arm64",
23-
linux_x86_64 = ":aspect-linux-amd64",
20+
darwin_arm64 = ":aspect-macos-aarch64",
21+
darwin_x86_64 = ":aspect-macos-x86_64",
22+
linux_arm64 = ":aspect-linux-aarch64",
23+
linux_x86_64 = ":aspect-linux-x86_64",
2424
tags = ["manual"],
2525
version_file = ":aspect_version",
26-
windows_x86_64 = ":aspect-windows-amd64",
2726
)
2827

2928
cli_brew_artifacts(

release/bazelisk_artifacts.bzl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ _ATTRS = {
3030
mandatory = True,
3131
allow_single_file = True,
3232
),
33-
"windows_x86_64": attr.label(
34-
doc = "The artifact for the linux-arm64 platform.",
35-
mandatory = True,
36-
allow_single_file = True,
33+
"_sha256sum": attr.label(
34+
executable = True,
35+
cfg = "exec",
36+
default = "//release/sha256sum",
3737
),
3838
}
3939

@@ -46,10 +46,10 @@ def _impl(ctx):
4646
ctx.file.darwin_x86_64,
4747
ctx.file.linux_arm64,
4848
ctx.file.linux_x86_64,
49-
ctx.file.windows_x86_64,
5049
]
5150

5251
args = ctx.actions.args()
52+
args.add(ctx.executable._sha256sum.path)
5353
args.add(outdir.path)
5454
args.add(ctx.file.version_file)
5555
args.add(ctx.file.darwin_arm64)
@@ -60,17 +60,16 @@ def _impl(ctx):
6060
args.add("linux-arm64")
6161
args.add(ctx.file.linux_x86_64)
6262
args.add("linux-x86_64")
63-
args.add(ctx.file.windows_x86_64)
64-
args.add("windows-x86_64.exe")
6563

6664
ctx.actions.run_shell(
6765
outputs = [outdir],
6866
inputs = inputs,
6967
arguments = [args],
7068
command = """\
71-
output_dir="$1"
72-
version_file="$2"
73-
shift 2
69+
sha256sum="${PWD}/$1"
70+
output_dir="$2"
71+
version_file="$3"
72+
shift 3
7473
7574
version="$(< "${version_file}")"
7675
@@ -87,10 +86,11 @@ while (("$#")); do
8786
cp "${artifact_path}" "${output_dir}/bazel-${version}-${platform_suffix}"
8887
(
8988
cd "${output_dir}"
90-
sha256sum "bazel-${version}-${platform_suffix}" > "bazel-${version}-${platform_suffix}.sha256"
89+
"${sha256sum}" "bazel-${version}-${platform_suffix}" > "bazel-${version}-${platform_suffix}.sha256"
9190
)
9291
done
9392
""",
93+
tools = [ctx.executable._sha256sum],
9494
)
9595

9696
return [

release/brew/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ bzl_library(
99
srcs = ["brew_bottle.bzl"],
1010
visibility = ["//visibility:public"],
1111
deps = [
12-
"//bazel/hash:sha256",
1312
"@bazel_skylib//lib:paths",
1413
"@rules_pkg//pkg:mappings.bzl",
1514
"@rules_pkg//pkg:tar.bzl",

release/sha256sum/BUILD.bazel

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
2+
3+
go_library(
4+
name = "sha256sum_lib",
5+
srcs = ["main.go"],
6+
importpath = "aspect.build/cli/release/sha256sum",
7+
visibility = ["//visibility:private"],
8+
)
9+
10+
go_binary(
11+
name = "sha256sum",
12+
embed = [":sha256sum_lib"],
13+
visibility = [
14+
"//release:__pkg__",
15+
],
16+
)

release/sha256sum/main.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright 2022 Aspect Build Systems, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package main
18+
19+
import (
20+
"crypto/sha256"
21+
"fmt"
22+
"io"
23+
"log"
24+
"os"
25+
)
26+
27+
func main() {
28+
var input io.Reader
29+
var filename string
30+
if len(os.Args) == 1 {
31+
input = os.Stdin
32+
filename = "-"
33+
} else {
34+
f, err := os.Open(os.Args[1])
35+
if err != nil {
36+
log.Fatal(err)
37+
}
38+
defer f.Close()
39+
input = f
40+
filename = os.Args[1]
41+
}
42+
43+
hash := sha256.New()
44+
if _, err := io.Copy(hash, input); err != nil {
45+
log.Fatal(err)
46+
}
47+
fmt.Printf("%x %s\n", hash.Sum(nil), filename)
48+
}

0 commit comments

Comments
 (0)