Skip to content

Commit

Permalink
Update bazel cpp_jsonnet reference from update_cpp_jsonnet.sh
Browse files Browse the repository at this point in the history
Teach `update_cpp_jsonnet.sh` to update the cpp_jsonnet reference in
`bazel/repositories.bzl` too.
  • Loading branch information
anguslees authored and sparkprime committed Oct 26, 2022
1 parent 3aab052 commit 69137c9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ load(
"http_archive",
)

# NB: update_cpp_jsonnet.sh looks for these.
CPP_JSONNET_SHA256 = "82d3cd35de8ef230d094b60a30e7659f415c350b0aa2bd62162cf2afdf163959"
CPP_JSONNET_GITHASH = "90cad75dcc2eafdcf059c901169d36539dc8a699"

def jsonnet_go_repositories():
http_archive(
name = "io_bazel_rules_go",
Expand All @@ -23,7 +27,7 @@ def jsonnet_go_repositories():
)
http_archive(
name = "cpp_jsonnet",
sha256 = "82d3cd35de8ef230d094b60a30e7659f415c350b0aa2bd62162cf2afdf163959",
strip_prefix = "jsonnet-90cad75dcc2eafdcf059c901169d36539dc8a699",
urls = ["https://github.com/google/jsonnet/archive/90cad75dcc2eafdcf059c901169d36539dc8a699.tar.gz"],
sha256 = CPP_JSONNET_SHA256,
strip_prefix = "jsonnet-%s" % CPP_JSONNET_GITHASH,
urls = ["https://github.com/google/jsonnet/archive/%s.tar.gz" % CPP_JSONNET_GITHASH],
)
11 changes: 11 additions & 0 deletions update_cpp_jsonnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,20 @@ set -x
cd cpp-jsonnet
git checkout master
git pull
hash=$(git rev-parse HEAD)
cd ..
go run cmd/dumpstdlibast/dumpstdlibast.go cpp-jsonnet/stdlib/std.jsonnet > astgen/stdast.go

sha256=$(curl -fL https://github.com/google/jsonnet/archive/$hash.tar.gz | shasum -a 256 | awk '{print $1}')

sed -i.bak \
-e "s/CPP_JSONNET_SHA256 = .*/CPP_JSONNET_SHA256 = \"$sha256\"/;" \
-e "s/CPP_JSONNET_GITHASH = .*/CPP_JSONNET_GITHASH = \"$hash\"/;" \
bazel/repositories.bzl

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

set +x
echo
echo -e "\033[1mUpdate completed. Please check if any tests are broken and fix any encountered issues.\033[0m"

0 comments on commit 69137c9

Please sign in to comment.