Skip to content

Commit

Permalink
Collect rust-related bazel constants under rust directory
Browse files Browse the repository at this point in the history
Change-Id: Ie0e03da9cfb9c6726216232074772c2e71675a1b
  • Loading branch information
jblebrun committed Jul 26, 2024
1 parent e8bd4b6 commit 7ae67c7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion bazel/crates/oak_crates_index.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"""

load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository")
load("//bazel:defs.bzl", "RUST_NIGHTLY_VERSION")
load("//bazel/crates:jemalloc.bzl", "jemalloc_repository")
load("//bazel/rust:defs.bzl", "RUST_NIGHTLY_VERSION")

def oak_crates_index(cargo_lockfile, lockfile):
jemalloc_repository()
Expand Down
2 changes: 2 additions & 0 deletions bazel/crates/oak_no_std_crates_index.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"""

load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository")
load("//bazel/rust:defs.bzl", "RUST_NIGHTLY_VERSION")

def oak_no_std_crates_index(cargo_lockfile, lockfile):
# All creates in this repository must support no_std.
Expand Down Expand Up @@ -193,6 +194,7 @@ def oak_no_std_crates_index(cargo_lockfile, lockfile):
version = "0.31.2",
),
},
rust_version = RUST_NIGHTLY_VERSION,
supported_platform_triples = [
# Linux for dependencies of build scripts (they run on host):
"x86_64-unknown-linux-gnu",
Expand Down
9 changes: 0 additions & 9 deletions bazel/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ load("//bazel/private:oci_runtime_bundle.bzl", _oci_runtime_bundle = "oci_runtim

oci_runtime_bundle = _oci_runtime_bundle

RUST_NIGHTLY_VERSION = "nightly/2024-02-01"

RUST_VERSIONS = [
"1.76.0",
RUST_NIGHTLY_VERSION,
]

RUST_EDITION = "2021"

def either_platform(platform_list):
"""Helper to mark either platform from platform_list as compatible.
Expand Down
22 changes: 16 additions & 6 deletions bazel/rust/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@

load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains", "rust_repository_set")
load("@rules_rust//tools/rust_analyzer:deps.bzl", "rust_analyzer_dependencies")
load("//bazel:defs.bzl", "RUST_EDITION", "RUST_VERSIONS")

RUST_NIGHTLY_DATE = "2024-02-01"

RUST_NIGHTLY_VERSION = "nightly/" + RUST_NIGHTLY_DATE

RUST_VERSIONS = [
"1.76.0",
RUST_NIGHTLY_VERSION,
]

RUST_EDITION = "2021"

def setup_rust_dependencies():
"""Set up the various rust-related dependencies. Call this after load_rust_repositories()."""
Expand All @@ -12,11 +22,11 @@ def setup_rust_dependencies():
edition = RUST_EDITION,
versions = RUST_VERSIONS,
sha256s = {
"2024-02-01/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz": "7247ca497c7d9194c9e7bb9b6a51f8ccddc452bbce2977d608cabdbc1a0f332f",
"2024-02-01/clippy-nightly-x86_64-unknown-linux-gnu.tar.xz": "1271eaa89d50bd7f63b338616c36f41fe1e733b5d6c4cc2c95eaa6b3c8faba62",
"2024-02-01/cargo-nightly-x86_64-unknown-linux-gnu.tar.xz": "1d859549b5f3d2dd146b84aa13dfec24a05913653af2116b39a919cab69de850",
"2024-02-01/llvm-tools-nightly-x86_64-unknown-linux-gnu.tar.xz": "b227753189981d9a115527ba0e95b365388fb0fe7f1a1ff93116c4448c854197",
"2024-02-01/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz": "b1a444f8e8f33d813c4d532c12717743edd9b34f685ff5293b6375fc75c2421e",
RUST_NIGHTLY_DATE + "/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz": "7247ca497c7d9194c9e7bb9b6a51f8ccddc452bbce2977d608cabdbc1a0f332f",
RUST_NIGHTLY_DATE + "/clippy-nightly-x86_64-unknown-linux-gnu.tar.xz": "1271eaa89d50bd7f63b338616c36f41fe1e733b5d6c4cc2c95eaa6b3c8faba62",
RUST_NIGHTLY_DATE + "/cargo-nightly-x86_64-unknown-linux-gnu.tar.xz": "1d859549b5f3d2dd146b84aa13dfec24a05913653af2116b39a919cab69de850",
RUST_NIGHTLY_DATE + "/llvm-tools-nightly-x86_64-unknown-linux-gnu.tar.xz": "b227753189981d9a115527ba0e95b365388fb0fe7f1a1ff93116c4448c854197",
RUST_NIGHTLY_DATE + "/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz": "b1a444f8e8f33d813c4d532c12717743edd9b34f685ff5293b6375fc75c2421e",
},
)

Expand Down
2 changes: 1 addition & 1 deletion cargo-no-std-bazel-lock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "af5facf001414feb7cd2361c4101a941109450232da10c39c9f8e91e393fba37",
"checksum": "64ca4f8be8f06fefcc39e40bc8b3bf5d2bc411a12b9eb9bd88461805ceb2e14a",
"crates": {
"acpi 5.0.0": {
"name": "acpi",
Expand Down

0 comments on commit 7ae67c7

Please sign in to comment.