Skip to content

Commit e1304d1

Browse files
update cppjsonnet and depend on a specific commit of jsonnet
This changes the bazel module dependencies so that the C++ jsonnet repo dependency (which is actually used as the source for the standard library and nothing else in the Bazel build) comes from a specific commit of the jsonnet repo, rather than depending on the 'published' jsonnet 0.20.0. The two repos are tightly coupled anyway so I think this more accurately reflects the situation. Particularly since the C++ repo is also linked (at a specific commit) as a git submodule, which is used for non-Bazel build and testing.
1 parent 64c3804 commit e1304d1

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

Diff for: MODULE.bazel

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
module(name = "jsonnet_go", version = "0.0.0")
22

3+
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4+
5+
# NB: update_cpp_jsonnet.sh looks for these.
6+
CPP_JSONNET_SHA256 = "e7d14d8ad65dc334b9a9f3bd1c542a82b3b80029860a8d78fd829b23d0e9845b"
7+
CPP_JSONNET_GITHASH = "5a4e8e34cc1fe841bdebb983646b9b9ae8fa8ca4"
8+
9+
# We don't use a normal bazel_dep reference for the cpp_jsonnet module,
10+
# because we want to pin to the specific jsonnet commit (which might not
11+
# even exactly match a released version).
12+
http_archive(
13+
name = "cpp_jsonnet",
14+
sha256 = CPP_JSONNET_SHA256,
15+
strip_prefix = "jsonnet-%s" % CPP_JSONNET_GITHASH,
16+
urls = ["https://github.com/google/jsonnet/archive/%s.tar.gz" % CPP_JSONNET_GITHASH],
17+
)
18+
319
bazel_dep(name = "gazelle", version = "0.41.0", repo_name = "bazel_gazelle")
4-
bazel_dep(name = "jsonnet", version = "0.20.0", repo_name = "cpp_jsonnet")
520
bazel_dep(name = "rules_go", version = "0.48.0", repo_name = "io_bazel_rules_go")
621

722
go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")

Diff for: bazel/repositories.bzl

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ load(
44
)
55

66
# NB: update_cpp_jsonnet.sh looks for these.
7-
CPP_JSONNET_SHA256 = "9e545f17b614c89d40d1f58d7f8fceded4cc93d1d29edfd8a93833b61201fd20"
8-
CPP_JSONNET_GITHASH = "4487bfb8ba7ed7a3d91d79d4a1aa2205e7839558"
7+
CPP_JSONNET_SHA256 = "e7d14d8ad65dc334b9a9f3bd1c542a82b3b80029860a8d78fd829b23d0e9845b"
8+
CPP_JSONNET_GITHASH = "5a4e8e34cc1fe841bdebb983646b9b9ae8fa8ca4"
99

1010
def jsonnet_go_repositories():
1111
http_archive(

Diff for: update_cpp_jsonnet.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ sha256=$(curl -fL https://github.com/google/jsonnet/archive/$hash.tar.gz | shasu
1717
sed -i.bak \
1818
-e "s/CPP_JSONNET_SHA256 = .*/CPP_JSONNET_SHA256 = \"$sha256\"/;" \
1919
-e "s/CPP_JSONNET_GITHASH = .*/CPP_JSONNET_GITHASH = \"$hash\"/;" \
20-
bazel/repositories.bzl
20+
bazel/repositories.bzl MODULE.bazel
2121

2222
# NB: macOS sed doesn't support -i without arg. This is the easy workaround.
2323
rm bazel/repositories.bzl.bak
24+
rm MODULE.bazel.bak
2425

2526
set +x
2627
echo

0 commit comments

Comments
 (0)