Skip to content

Commit

Permalink
CI finds crates to build for bare metal using a Bazel tag.
Browse files Browse the repository at this point in the history
Also add a just bazel-fmt command to format Bazel files.

BUG: 343228114
Change-Id: I9be8719959d10988161074816bd50c0d07d91d77
  • Loading branch information
ernoc committed Jun 18, 2024
1 parent c54dd78 commit 540ae1d
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 3 deletions.
10 changes: 7 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,9 @@ kokoro_run_tests: all_ensure_no_std
clang-tidy:
bazel build $BAZEL_CONFIG_FLAG --config=clang-tidy //cc/...

# TODO: b/343228114 - Use a Bazel tag instead of listing packages here.
bare_metal_crates := "//oak_linux_boot_params //oak_channel //oak_core //oak_virtio //third_party/rust-hypervisor-firmware-virtio //micro_rpc //oak_proto_rust //oak_sev_snp_attestation_report //oak_sev_guest //sev_serial //oak_crypto //oak_dice //oak_restricted_kernel_dice"
# Query crates that needs to be built for bare metal. Bazel query outputs one target in each line, so we
# use `tr` to bring them into a single line.
bare_metal_crates := `bazel query 'attr("tags", "ci-build-for-x86_64-unknown-none", //...)' | tr '\n' ' '`

bazel-ci:
# Test Oak as a dependency in the test workspace
Expand All @@ -224,14 +225,17 @@ bazel-repin:
env CARGO_BAZEL_REPIN=true bazel sync --only=oak_crates_index,oak_no_std_crates_index
env CARGO_BAZEL_REPIN=true --chdir=bazel/test_workspace bazel sync --only=oak2

bazel-fmt:
buildifier -r ${PWD} # Lints Bazel files - BUILD, WORKSPACE, *.bzl, etc.

bazel-rustfmt:
bazel build --config=rustfmt --config=unsafe-fast-presubmit //...:all -- -third_party/...

xtask job:
./scripts/xtask {{job}}

clippy-ci: (xtask "run-cargo-clippy") bazel-clippy
check-format-ci: (xtask "check-format") bazel-rustfmt
check-format-ci: (xtask "check-format") bazel-fmt

# Temporary target to help debugging Bazel remote cache with more detailed logs.
# It should be deleted when debugging is completed.
Expand Down
1 change: 1 addition & 0 deletions micro_rpc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ rust_library(
"@oak_crates_index//:async-trait",
"@oak_crates_index//:prost-derive",
],
tags = ["ci-build-for-x86_64-unknown-none"],
deps = [
":build",
] + select({
Expand Down
1 change: 1 addition & 0 deletions oak_channel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package(
rust_library(
name = "oak_channel",
srcs = glob(["src/**"]),
tags = ["ci-build-for-x86_64-unknown-none"],
deps = [
"//oak_core",
"@oak_crates_index//:static_assertions",
Expand Down
1 change: 1 addition & 0 deletions oak_core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package(
rust_library(
name = "oak_core",
srcs = glob(["src/**"]),
tags = ["ci-build-for-x86_64-unknown-none"],
deps = [
"@oak_crates_index//:lock_api",
"@oak_crates_index//:spinning_top",
Expand Down
1 change: 1 addition & 0 deletions oak_crypto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ rust_library(
proc_macro_deps = [
"@oak_crates_index//:async-trait",
],
tags = ["ci-build-for-x86_64-unknown-none"],
deps = [
"//oak_proto_rust",
"@oak_crates_index//:static_assertions",
Expand Down
1 change: 1 addition & 0 deletions oak_dice/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ rust_library(
crate_features = [
"no_std",
],
tags = ["ci-build-for-x86_64-unknown-none"],
deps = [
"@oak_crates_index//:static_assertions",
"@oak_crates_index//:strum",
Expand Down
1 change: 1 addition & 0 deletions oak_linux_boot_params/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package(
rust_library(
name = "oak_linux_boot_params",
srcs = glob(["src/**"]),
tags = ["ci-build-for-x86_64-unknown-none"],
deps = [
"@oak_crates_index//:static_assertions",
"@oak_crates_index//:strum",
Expand Down
1 change: 1 addition & 0 deletions oak_proto_rust/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ rust_library(
proc_macro_deps = [
"@oak_crates_index//:prost-derive",
],
tags = ["ci-build-for-x86_64-unknown-none"],
deps = [
":build",
"//micro_rpc",
Expand Down
1 change: 1 addition & 0 deletions oak_restricted_kernel_dice/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package(
rust_library(
name = "oak_restricted_kernel_dice",
srcs = glob(["src/**"]),
tags = ["ci-build-for-x86_64-unknown-none"],
deps = [
"//oak_crypto",
"//oak_dice",
Expand Down
1 change: 1 addition & 0 deletions oak_sev_guest/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ rust_library(
crate_features = [
"rust-crypto",
],
tags = ["ci-build-for-x86_64-unknown-none"],
deps = [
"//oak_sev_snp_attestation_report",
"@oak_crates_index//:lock_api",
Expand Down
1 change: 1 addition & 0 deletions oak_sev_snp_attestation_report/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package(
rust_library(
name = "oak_sev_snp_attestation_report",
srcs = glob(["src/**"]),
tags = ["ci-build-for-x86_64-unknown-none"],
deps = [
"@oak_crates_index//:static_assertions",
"@oak_crates_index//:strum",
Expand Down
1 change: 1 addition & 0 deletions oak_virtio/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package(
rust_library(
name = "oak_virtio",
srcs = glob(["src/**"]),
tags = ["ci-build-for-x86_64-unknown-none"],
deps = [
"//third_party/rust-hypervisor-firmware-virtio",
"@oak_crates_index//:strum",
Expand Down
1 change: 1 addition & 0 deletions sev_serial/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package(
rust_library(
name = "sev_serial",
srcs = glob(["src/**"]),
tags = ["ci-build-for-x86_64-unknown-none"],
deps = [
"//oak_sev_guest",
] + select({
Expand Down
1 change: 1 addition & 0 deletions third_party/rust-hypervisor-firmware-virtio/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ package(
rust_library(
name = "rust-hypervisor-firmware-virtio",
srcs = glob(["src/**"]),
tags = ["ci-build-for-x86_64-unknown-none"],
deps = [
"@oak_crates_index//:atomic_refcell",
"@oak_no_std_crates_index//:bitflags",
Expand Down

0 comments on commit 540ae1d

Please sign in to comment.