From b47c6d4af26b8eea50a091834a417dccb3d57704 Mon Sep 17 00:00:00 2001 From: James Wainwright Date: Thu, 19 Dec 2024 16:10:08 +0000 Subject: [PATCH] [bazel] Migrate HyperDebug firmware repo to bzlmod Signed-off-by: James Wainwright --- MODULE.bazel | 3 ++ MODULE.bazel.lock | 29 +++++++++++++++++++ WORKSPACE.bzlmod | 4 --- .../hyperdebug/{repos.bzl => extensions.bzl} | 6 +++- 4 files changed, 37 insertions(+), 5 deletions(-) rename third_party/hyperdebug/{repos.bzl => extensions.bzl} (83%) diff --git a/MODULE.bazel b/MODULE.bazel index cd386d2719432..2c71e18e4a58e 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -106,3 +106,6 @@ use_repo( open_dice = use_extension("//third_party/open-dice:extensions.bzl", "open_dice") use_repo(open_dice, "open-dice") + +hyperdebug = use_extension("//third_party/hyperdebug:extensions.bzl", "hyperdebug") +use_repo(hyperdebug, "hyperdebug_firmware") diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index e651adb88a33e..12bc03bfe4473 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -330,6 +330,35 @@ ] } }, + "//third_party/hyperdebug:extensions.bzl%hyperdebug": { + "general": { + "bzlTransitiveDigest": "ABjO2A70WKR3z0KkdQVnISg7mVlBobInLLmguUJ+X0U=", + "usagesDigest": "+xaTNiIUmt259C28+/dwRL7bIsT9gLAa9h816ue9aqc=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "hyperdebug_firmware": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/lowRISC/hyperdebug-firmware/releases/download/20241211_02/hyperdebug-firmware.tar.gz" + ], + "sha256": "8b72dfe4ecb6a2258228e62c2246c5beffe8339d440a592c483534fa3f54d679", + "build_file": "@@//third_party/hyperdebug:BUILD" + } + } + }, + "recordedRepoMappingEntries": [ + [ + "", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, "//third_party/llvm_compiler_rt:extensions.bzl%llvm_compiler_rt": { "general": { "bzlTransitiveDigest": "fjl5zQ4kB7DmikP9ty9kgUykJKxg0y1gbKbrNP5fUGU=", diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod index bd8bba51bb46f..50cb50b09dcee 100644 --- a/WORKSPACE.bzlmod +++ b/WORKSPACE.bzlmod @@ -48,10 +48,6 @@ provisioning_exts_repo(name = "provisioning_exts") load("//rules:nonhermetic.bzl", "nonhermetic_repo") nonhermetic_repo(name = "nonhermetic") -# Binary firmware image for HyperDebug -load("//third_party/hyperdebug:repos.bzl", "hyperdebug_repos") -hyperdebug_repos() - register_toolchains( "//rules/opentitan:localtools", ) diff --git a/third_party/hyperdebug/repos.bzl b/third_party/hyperdebug/extensions.bzl similarity index 83% rename from third_party/hyperdebug/repos.bzl rename to third_party/hyperdebug/extensions.bzl index e9290b5e90965..a859868306c23 100644 --- a/third_party/hyperdebug/repos.bzl +++ b/third_party/hyperdebug/extensions.bzl @@ -4,7 +4,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -def hyperdebug_repos(): +hyperdebug = module_extension( + implementation = lambda _: _hyperdebug_repos(), +) + +def _hyperdebug_repos(): http_archive( name = "hyperdebug_firmware", urls = ["https://github.com/lowRISC/hyperdebug-firmware/releases/download/20241211_02/hyperdebug-firmware.tar.gz"],