Skip to content

Commit fb5b14d

Browse files
chickenandporknicowilliams
authored andcommitted
feat: confirm 1.6 and 1.7 artifacts naming scheme co-exist
1 parent e3cbb5b commit fb5b14d

File tree

7 files changed

+65
-4
lines changed

7 files changed

+65
-4
lines changed

WORKSPACE

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ load("//jq:repositories.bzl", "jq_register_toolchains", "rules_jq_dependencies")
1515
rules_jq_dependencies()
1616

1717
jq_register_toolchains(
18-
name = "jq1_6",
19-
jq_version = "1.6",
18+
name = "jq",
19+
jq_version = "1.7",
2020
)
2121

2222
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")

example/genrule/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ genrule(
55
name = "actual",
66
outs = ["actual.yaml"],
77
cmd = "$(JQ_BIN) '.one = 1' --null-input --compact-output > $@",
8-
toolchains = ["@jq1_6_toolchains//:resolved_toolchain"],
8+
toolchains = ["@jq_toolchains//:resolved_toolchain"],
99
)
1010

1111
write_file(

full-examples/basic-1.6/BUILD.bazel

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
2+
load("@bazel_skylib//rules:write_file.bzl", "write_file")
3+
load("@rules_jq//jq:defs.bzl", "jq_eval")
4+
5+
jq_eval(
6+
name = "actual",
7+
srcs = ["sample.yaml"],
8+
filter = ".a.b",
9+
raw_output = True,
10+
)
11+
12+
write_file(
13+
name = "expected",
14+
out = "out.yaml",
15+
content = [
16+
"123",
17+
"",
18+
],
19+
)
20+
21+
diff_test(
22+
name = "check_eval",
23+
file1 = ":expected",
24+
file2 = ":actual",
25+
)

full-examples/basic-1.6/WORKSPACE

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
workspace(name = "basic-1.6")
2+
3+
# When using in your project, this can be a direct cut-n-paste, however you should replace the
4+
# local_repository with a http_archive() block similar to the following, using the version and
5+
# sha256 matching your desired release
6+
#
7+
# load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
8+
#
9+
# http_archive(
10+
# name = "rules_jq",
11+
# sha256 = "52771b5f7fb5017b0f5a3816b46624d2b9a336ddc178b261de988d969cd329d8",
12+
# url = "https://github.com/jqlang/bazel_rules_jq/releases/download/0.0.1/bazel_rules_jq-v0.0.1.tar.gz",
13+
#)
14+
15+
local_repository(
16+
name = "rules_jq",
17+
path = "../..",
18+
)
19+
20+
load("@rules_jq//jq:repositories.bzl", "jq_register_toolchains", "rules_jq_dependencies")
21+
22+
rules_jq_dependencies()
23+
24+
jq_register_toolchains(
25+
name = "jq",
26+
jq_version = "1.6",
27+
)

full-examples/basic-1.6/sample.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "a": { "b": "123" } }

full-examples/basic/WORKSPACE

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ rules_jq_dependencies()
2323

2424
jq_register_toolchains(
2525
name = "jq",
26-
jq_version = "1.6",
26+
jq_version = "1.7",
2727
)

jq/private/toolchains_repo.bzl

+8
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,20 @@ with only the toolchain attribute pointing into the platform-specific repositori
2020
# Add more platforms as needed to mirror all the binaries
2121
# published by the upstream project.
2222
PLATFORMS = {
23+
# This artifact exists in pre-1.7 and post-1.6; JQ may drop the osx- moniker but until then, we
24+
# don't need to do any tricky logic
2325
"osx-amd64": struct(
2426
compatible_with = [
2527
"@platforms//os:macos",
2628
"@platforms//cpu:x86_64",
2729
],
2830
),
31+
"macos-arm64": struct(
32+
compatible_with = [
33+
"@platforms//os:macos",
34+
"@platforms//cpu:aarch64",
35+
],
36+
),
2937
"linux64": struct(
3038
compatible_with = [
3139
"@platforms//os:linux",

0 commit comments

Comments
 (0)