diff --git a/MODULE.bazel b/MODULE.bazel index 94d3a53..9e83281 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -11,7 +11,7 @@ bazel_dep(name = "bazel_features", version = "1.11.0") bazel_dep(name = "bazel_skylib", version = "1.5.0") bazel_dep(name = "platforms", version = "0.0.10") -bazel_dep(name = "buildifier_prebuilt", version = "7.3.1", dev_dependency = True) +bazel_dep(name = "buildifier_prebuilt", version = "8.2.1.1", dev_dependency = True) # ensure toolchains get registered multitool = use_extension("//multitool:extension.bzl", "multitool") diff --git a/examples/workspace/BUILD.bazel b/examples/workspace/BUILD.bazel index 1a50d29..5377d30 100644 --- a/examples/workspace/BUILD.bazel +++ b/examples/workspace/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_shell//shell:sh_test.bzl", "sh_test") + sh_test( name = "integration_test", srcs = ["integration_test.sh"], diff --git a/lockfile.schema.json b/lockfile.schema.json index ab32789..6b4df83 100644 --- a/lockfile.schema.json +++ b/lockfile.schema.json @@ -7,7 +7,7 @@ "enum": ["macos", "linux", "windows"] }, "supported_cpu": { - "enum": ["x86_64", "arm64"] + "enum": ["x86_64", "arm64", "riscv64"] }, "file_type": { "type": "object", diff --git a/multitool/private/hub_repo_template/toolchain_info.bzl.template b/multitool/private/hub_repo_template/toolchain_info.bzl.template index f5dd020..376e7fe 100644 --- a/multitool/private/hub_repo_template/toolchain_info.bzl.template +++ b/multitool/private/hub_repo_template/toolchain_info.bzl.template @@ -13,7 +13,7 @@ def _toolchain_info_impl(ctx): toolchain_info = rule( attrs = dict( executable = attr.label(allow_single_file = True), - cpu = attr.string(mandatory = True, values = ["arm64", "x86_64"]), + cpu = attr.string(mandatory = True, values = ["arm64", "x86_64", "riscv64"]), os = attr.string(mandatory = True, values = ["linux", "macos", "windows"]), ext = attr.string(mandatory = True, values = ["", ".exe"]), ), diff --git a/multitool/private/lockfile.bzl b/multitool/private/lockfile.bzl index 2bc0425..cbfd783 100644 --- a/multitool/private/lockfile.bzl +++ b/multitool/private/lockfile.bzl @@ -38,7 +38,7 @@ def _load(ctx, lockfiles): ), ) _check( - binary["cpu"] in ["x86_64", "arm64"], + binary["cpu"] in ["x86_64", "arm64", "riscv64"], "{tool_name}: Unknown cpu '{cpu}'".format( tool_name = tool_name, cpu = binary["cpu"], diff --git a/multitool/private/templates.bzl b/multitool/private/templates.bzl index 558e0e7..49b92ac 100644 --- a/multitool/private/templates.bzl +++ b/multitool/private/templates.bzl @@ -11,6 +11,7 @@ _TOOL_TOOL_TEMPLATE = "//multitool/private:tool_repo_tool_template/{filename}.te # map from HOST_CONSTRAINTS to supported_os and supported_cpu from lockfile.schema.json _HOST_CONSTRAINTS_MAPPING = { "@platforms//cpu:aarch64": "arm64", + "@platforms//cpu:riscv64": "riscv64", "@platforms//cpu:x86_64": "x86_64", "@platforms//os:osx": "macos", "@platforms//os:linux": "linux", diff --git a/readme.md b/readme.md index d8df92d..34bc3dc 100644 --- a/readme.md +++ b/readme.md @@ -18,7 +18,7 @@ Define a [lockfile](lockfile.schema.json) that references the tools to load: "url": "https://...", "sha256": "sha256 of the file", "os": "linux|macos|windows", - "cpu": "x86_64|arm64" + "cpu": "x86_64|arm64|riscv64" } ] }