Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[experiment] Migrate to bzlmod #24216

Closed
wants to merge 56 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
691cd39
[bazel] Update rules_cc to version 0.9.0
jwnrt Jul 15, 2024
8ae7fb9
[bazel] Explicitly import `platforms` dependency
jwnrt Aug 12, 2024
5fe1c93
[bazel] Separate `rules_fuzzing` from Google deps
jwnrt Aug 12, 2024
6fcdc93
[bazel] Move Python and Google deps to top of WORKSPACE
jwnrt Aug 12, 2024
5a5e039
[bazel] Update tockloader to 1.13
jwnrt Jul 18, 2024
0a46ec3
[bazel] Freeze tockloader pip dependencies
jwnrt Jul 18, 2024
e310ee6
[bazel] Remove `jsonschema` from bitstream cache script
jwnrt Aug 20, 2024
08d1bd1
[bazel] Update rules_python to upstream 0.34.0
jwnrt Jul 18, 2024
f6a904e
[bazel] Update rules_fuzzing to 0.5.2
jwnrt Jul 17, 2024
89a2864
[bazel] Update buildifier to 6.4.0
jwnrt Jul 17, 2024
b530e83
[bazel] Apply new buildifier fixes
jwnrt Jul 17, 2024
57ebea5
[bazel] Rename abseil-cpp repo to match bzlmod
jwnrt Jul 31, 2024
c1ff4f7
[bazel] Update bazel to 7.3.1
jwnrt Jul 15, 2024
c2e6436
[bazel] Update how airgap downloads Bazel's own dependencies
jwnrt Aug 12, 2024
fe6fca1
[DELETEME] Create PR "Update Bazel to v7.3.1"
jwnrt Jul 23, 2024
3f4cdab
[bazel] Update to upstream rules_rust
jwnrt Jul 15, 2024
d976db3
[bazel] Add static lib patch to rules_rust
jwnrt Jul 16, 2024
c77d792
[bazel] Repin Rust dependencies
jwnrt Jul 17, 2024
4dae584
[bazel] Remove support for local repositories in Tock
jwnrt Jul 18, 2024
786e94f
[DELETEME] Create PR "Update `rules_rust` to upstream"
jwnrt Jul 23, 2024
20fbf9a
[bazel] Enable bzlmod in hybrid mode
jwnrt Jul 16, 2024
c168cbd
[bazel] Switch airgap to using vendor_dir
jwnrt Jul 17, 2024
d2ab050
[DELETEME] Create PR "Enable bzlmod in hybrid mode`
jwnrt Aug 12, 2024
cdb4e9e
[bazel] Move buildifier to bzlmod
jwnrt Jan 26, 2024
d34dcb4
[bazel] Move skylib to bzlmod
jwnrt Jul 17, 2024
ffe1913
[bazel] Move lowrisc linters to bzlmod
jwnrt Jul 17, 2024
6524ab3
[bazel] Move Google dependencies to bzlmod
jwnrt Jul 17, 2024
527ce99
[bazel] Remove Bazel repository for vendored files
jwnrt Jul 17, 2024
3c666d7
[bazel] Move shellcheck to bzlmod
jwnrt Jul 17, 2024
556c7ee
[bazel] Move bindgen's LLVM toolchain to bzlmod
jwnrt Jul 17, 2024
aa45bb2
[bazel] Remove special-casing for serde-annotate dependency
jwnrt Jul 16, 2024
6f7ca5d
[bazel] Fix paths to Cargo dependencies
jwnrt Jul 18, 2024
9f38f68
[bazel] Move Tock dependencies to main Cargo.toml
jwnrt Jul 18, 2024
5427f87
[bazel] Move rules_rust to bzlmod
jwnrt Jul 16, 2024
3374c25
[bazel] Remove old crates
jwnrt Jul 17, 2024
e2b4db7
[bazel] Separate tock repos from deps
jwnrt Jul 18, 2024
6178c31
[bazel] Move Tock repository to bzlmod
jwnrt Jul 18, 2024
737d88d
[bazel] Add bzlmod extension for rules repos
jwnrt Jul 18, 2024
610ad86
[bazel] Move rules_python to bzlmod
jwnrt Jul 18, 2024
e47852c
[bazel] Move bitstreams repo to bzlmod
jwnrt Aug 13, 2024
f5558cc
[bazel] Move nonhermetic rule to bzlmod
jwnrt Aug 13, 2024
19c2397
[bazel] Update bzlmod dependencies
jwnrt Jul 18, 2024
e71d747
[bazel] Move release rule to bzlmod
jwnrt Jul 22, 2024
3ddb22a
[bazel] Move lychee to bzlmod
jwnrt Jul 23, 2024
29d68f6
[bazel] Move OpenOCD to bzlmod
jwnrt Jul 23, 2024
a1c4edd
[bazel] Move FreeRTOS to bzlmod
jwnrt Jul 23, 2024
2997d67
[bazel] Move llvm_compiler_rt to bzlmod
jwnrt Jul 23, 2024
457dc10
[bazel] Move riscv-compliance to bzlmod
jwnrt Jul 23, 2024
c874f15
[bazel] Move coremark to bzlmod
jwnrt Jul 23, 2024
6c0a4a9
[bazel] Move xkcp to bzlmod
jwnrt Jul 23, 2024
1a47e56
[bazel] Move hsm extras to bzlmod
jwnrt Jul 23, 2024
6c78b28
[bazel] Move nist cavp testvectors to bzlmod
jwnrt Jul 23, 2024
2afbb45
[bazel] Move wycheproof to bzlmod
jwnrt Jul 23, 2024
4bafa9c
[bazel] Move sphincsplus to bzlmod
jwnrt Jul 23, 2024
f9528fb
[bazel] Move HyperDebug firmware to bzlmod
jwnrt Jul 23, 2024
00a8158
[bazel] Move localtools registration to bzlmod
jwnrt Jul 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build
hw/ip/prim/util/vendor/google_verible_verilog_syntax_py
sw/vendor/google_googletest
util/lowrisc_misc-linters
bazel-airgapped
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

# Enable bzlmod using both `MODULE.bazel` and `WORKSPACE.bzlmod`.
common --enable_bzlmod

# https://docs.opentitan.org/doc/rm/c_cpp_coding_style/#cxx-version specifies
build --action_env=BAZEL_CXXOPTS="-std=gnu++14"
build --cxxopt='-std=gnu++14'
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.2.1
7.3.1
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package(default_visibility = ["//visibility:public"])

exports_files([
"WORKSPACE",
"WORKSPACE.bzlmod",
"python-requirements.txt",
"tool_requirements.py",
])
Expand Down
210 changes: 210 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

module(name = "lowrisc_opentitan")

bazel_dep(name = "abseil-cpp", version = "20240116.2")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0")
bazel_dep(name = "googletest", version = "1.14.0")
bazel_dep(name = "lowrisc_bazel_release", version = "0.1.0")
bazel_dep(name = "lowrisc_misc_linters")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_foreign_cc", version = "0.9.0")
bazel_dep(name = "rules_fuzzing", version = "0.5.2")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_python", version = "0.34.0")
bazel_dep(name = "rules_rust", version = "0.47.1")
bazel_dep(name = "rules_shellcheck", version = "0.3.3")
bazel_dep(name = "toolchains_llvm", version = "1.0.0")

git_override(
module_name = "lowrisc_bazel_release",
commit = "89f1f10ccc2eb61127e0a57718b1137688d46109",
remote = "https://github.com/lowRISC/bazel-release",
)

git_override(
module_name = "lowrisc_misc_linters",
commit = "aed701007ebc25df45e50f161eca73d37739df45",
remote = "https://github.com/lowRISC/misc-linters",
)

git_override(
module_name = "rules_rust",
commit = "5b4111da6393a7639a182c011a9fad92c451891a",
remote = "https://github.com/bazelbuild/rules_rust",
)

rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2021",
extra_target_triples = [
"riscv32imc-unknown-none-elf",
],
versions = [
"1.71.1",
"nightly/2023-07-30",
],
)
use_repo(rust, "rust_toolchains")

register_toolchains("@rust_toolchains//:all")

crate = use_extension("@rules_rust//crate_universe:docs_bzlmod.bzl", "crate")
crate.from_cargo(
name = "crate_index",
cargo_lockfile = "//third_party/rust:Cargo.lock",
manifests = [
"//third_party/rust:Cargo.toml",
],
)
crate.annotation(
crate = "libudev-sys",
patch_args = ["-p1"],
patches = ["@//third_party/rust/patches:libudev-sys-0.1.4.patch"],
)
crate.annotation(
crate = "mdbook",
gen_binaries = ["mdbook"],
patch_args = ["-p1"],
patches = ["@//third_party/rust/patches:mdbook-landing-page-links.patch"],
)
crate.annotation(
crate = "cryptoki",
patch_args = ["-p2"],
patches = [
"@//third_party/rust/patches:cryptoki-vendor-defined-mechanism-type.patch",
],
)
crate.annotation(
additive_build_file_content = """
filegroup(
name = "binding_srcs",
srcs = [
"src/lib.rs",
"src/bindings/x86_64-unknown-linux-gnu.rs",
],
)
""",
crate = "cryptoki-sys",
extra_aliased_targets = {
"cryptoki-sys-binding-srcs": "binding_srcs",
},
)
crate.annotation(
build_script_env = {
"PKG_CONFIG_PATH": "$(OPENSSL_PKG_CONFIG_PATH)",
"OPENSSL_STATIC": "1",
},
build_script_toolchains = ["@//third_party/rust:openssl_pkg_config_path"],
crate = "openssl-sys",
)
use_repo(crate, "crate_index")

register_toolchains("//third_party/rust:bindgen_toolchain")

# LLVM toolchain used by bindgen (not for device software).
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(
name = "llvm_toolchain",
llvm_versions = {
"": "10.0.0",
},
)
use_repo(llvm, "llvm_toolchain_llvm")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
is_default = True,
python_version = "3.9",
# Required because CI containers currently run as the `root` user.
# We lose caching of `.pyc` files.
# See <https://github.com/bazelbuild/rules_python/pull/713>.
ignore_root_user_error = True,
)
use_repo(python, "pythons_hub")

register_toolchains("@pythons_hub//:all")

use_repo(python, python3 = "python_3_9", python3_host = "python_3_9_host")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "ot_python_deps",
python_version = "3.9",
requirements_lock = "//:python-requirements.txt",
)
use_repo(pip, "ot_python_deps")
pip.parse(
hub_name = "tockloader_deps",
python_version = "3.9",
requirements_lock = "//:third_party/tock/tockloader_requirements.txt",
)
use_repo(pip, "tockloader_deps")

tock = use_extension("//third_party/tock:extension.bzl", "tock")
use_repo(tock, "elf2tab", "libtock", "tock")

bitstreams = use_extension("//rules:extensions.bzl", "bitstreams")
use_repo(bitstreams, "bitstreams")

nonhermetic = use_extension("//rules:extensions.bzl", "nonhermetic")
use_repo(nonhermetic, "nonhermetic")

lychee = use_extension("//third_party/lychee:extension.bzl", "lychee")
use_repo(lychee, "lychee")

openocd = use_extension("//third_party/openocd:extension.bzl", "openocd")
use_repo(openocd, "openocd")

freertos = use_extension("//third_party/freertos:extension.bzl", "freertos")
use_repo(freertos, "freertos")

llvm_compiler_rt = use_extension("//third_party/llvm_compiler_rt:extension.bzl", "llvm_compiler_rt")
use_repo(llvm_compiler_rt, "llvm_compiler_rt")

riscv_compliance = use_extension("//third_party/riscv-compliance:extension.bzl", "riscv_compliance")
use_repo(riscv_compliance, "riscv-compliance")

coremark = use_extension("//third_party/coremark:extension.bzl", "coremark")
use_repo(coremark, "coremark")

xkcp = use_extension("//third_party/xkcp:extension.bzl", "xkcp")
use_repo(xkcp, "xkcp")

hsm = use_extension("//third_party/hsm:extension.bzl", "hsm")
use_repo(hsm, "cloud_kms_hsm", "sc_hsm", "softhsm2")

nist_cavp_testvectors = use_extension("//third_party/nist_cavp_testvectors:extension.bzl", "nist_cavp_testvectors")
use_repo(
nist_cavp_testvectors,
"nist_cavp_aes_gcm",
"nist_cavp_aes_kw_sp_800_38f",
"nist_cavp_drbg_sp_800_90a_root",
"nist_cavp_ecdh_sp_800_56a",
"nist_cavp_ecdsa_fips_186_4",
"nist_cavp_hmac_fips_198_1",
"nist_cavp_rsa_fips_186_3",
"nist_cavp_sha2_fips_180_4",
"nist_cavp_sha3_fips_202",
"nist_cavp_shake_fips_202",
)

wycheproof = use_extension("//third_party/wycheproof:extension.bzl", "wycheproof")
use_repo(wycheproof, "wycheproof")

sphincsplus = use_extension("//third_party/sphincsplus:extension.bzl", "sphincsplus")
use_repo(
sphincsplus,
"sphincsplus_fips205_ipd",
"sphincsplus_sha256_kat",
"sphincsplus_shake256_kat",
)

hyperdebug = use_extension("//third_party/hyperdebug:extension.bzl", "hyperdebug")
use_repo(hyperdebug, "hyperdebug_firmware")

register_toolchains("//rules/opentitan:localtools")
Loading
Loading