Skip to content

Commit

Permalink
Remove support for non-bzlmod builds
Browse files Browse the repository at this point in the history
Anyone still using WORKSPACE can continue to use the last release.
  • Loading branch information
EdSchouten committed Sep 19, 2024
1 parent e9a113b commit ce7d459
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 70 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/create_archive_and_notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ TAG=${GITHUB_REF_NAME}
PREFIX="rules_jsonnet-${TAG}"
ARCHIVE="rules_jsonnet-$TAG.tar.gz"
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')

cat > release_notes.txt << EOF
## Setup
Expand All @@ -32,33 +31,4 @@ To use the Jsonnet rules, add the following to your \`MODULE.bazel\` file:
\`\`\`starlark
bazel_dep(name = "rules_jsonnet", version = "${TAG}")
\`\`\`
If you are using an older version of Bazel that does not support Bzlmod,
add the following to your \`WORKSPACE\` file to add the external
repositories for Jsonnet:
\`\`\`starlark
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_jsonnet",
sha256 = "${SHA}",
strip_prefix = "${PREFIX}",
urls = ["https://github.com/bazelbuild/rules_jsonnet/releases/download/${TAG}/rules_jsonnet-${TAG}.tar.gz",
)
load("@io_bazel_rules_jsonnet//jsonnet:jsonnet.bzl", "jsonnet_repositories")
jsonnet_repositories()
load("@google_jsonnet_go//bazel:repositories.bzl", "jsonnet_go_repositories")
jsonnet_go_repositories()
load("@google_jsonnet_go//bazel:deps.bzl", "jsonnet_go_dependencies")
jsonnet_go_dependencies()
register_toolchains("@io_bazel_rules_jsonnet//jsonnet:go_jsonnet_toolchain")
\`\`\`
EOF
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@ C++](https://github.com/google/jsonnet) or
[Rust](https://github.com/CertainLach/jrsonnet) compiler of Jsonnet instead,
register a different compiler:

| Jsonnet compiler | MODULE.bazel directive | WORKSPACE directive |
| ---------------- | --------------------------------- | -------------------------------------------------------------------------------- |
| Go | `jsonnet.compiler(name = "go")` | `register_toolchains("@io_bazel_rules_jsonnet//jsonnet:go_jsonnet_toolchain")` |
| cpp | `jsonnet.compiler(name = "cpp")` | `register_toolchains("@io_bazel_rules_jsonnet//jsonnet:cpp_jsonnet_toolchain")` |
| Rust | `jsonnet.compiler(name = "rust")` | `register_toolchains("@io_bazel_rules_jsonnet//jsonnet:rust_jsonnet_toolchain")` |

Note that `WORKSPACE` users must register a toolchain manually, using the table
above as reference.
| Jsonnet compiler | MODULE.bazel directive |
| ---------------- | --------------------------------- |
| Go | `jsonnet.compiler(name = "go")` |
| cpp | `jsonnet.compiler(name = "cpp")` |
| Rust | `jsonnet.compiler(name = "rust")` |

### Rust Jsonnet Compiler

Expand Down
13 changes: 0 additions & 13 deletions WORKSPACE

This file was deleted.

19 changes: 0 additions & 19 deletions jsonnet/jsonnet.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_skylib//lib:shell.bzl", "shell")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

_JSONNET_FILETYPE = [
".jsonnet",
Expand Down Expand Up @@ -873,21 +872,3 @@ Example:
To run the test: `bazel test //config:invalid_config_test`
""",
)

def jsonnet_repositories():
"""Adds the external dependencies needed for the Jsonnet rules."""
http_archive(
name = "jsonnet",
sha256 = "85c240c4740f0c788c4d49f9c9c0942f5a2d1c2ae58b2c71068107bc80a3ced4",
strip_prefix = "jsonnet-0.18.0",
urls = [
"https://github.com/google/jsonnet/archive/v0.18.0.tar.gz",
],
)

http_archive(
name = "google_jsonnet_go",
sha256 = "20fdb3599c2325fb11a63860e7580705590faf732abf47ed144203715bd03a70",
strip_prefix = "go-jsonnet-0d78479d37eabd9451892dd02be2470145b4d4fa",
urls = ["https://github.com/google/go-jsonnet/archive/0d78479d37eabd9451892dd02be2470145b4d4fa.tar.gz"],
)

0 comments on commit ce7d459

Please sign in to comment.