From b905b065c2bd548e7f74037c2022f29e8915e840 Mon Sep 17 00:00:00 2001 From: Ernesto Ocampo Date: Thu, 4 Jul 2024 15:06:26 +0000 Subject: [PATCH] Add CI support for building wasm targets by declaring target_compatible_with. - More precise settings to specify one of our 3 target platforms: x86_64 on linux, x86_64 on bare metal, wasm32 on bare metal. - Added wasm query and building to `just bazel-ci` command BUG: 349778041 Change-Id: I1b97e40f81d6a9c09fa29b76e2874ae840fa6f11 --- BUILD | 31 + bazel/defs.bzl | 8 +- bazel/test_workspace/Cargo-test.bazel.lock | 118 +++- .../test_workspace/cargo-bazel-test-lock.json | 592 +++++++++++++----- justfile | 6 +- micro_rpc/BUILD | 5 +- oak_channel/BUILD | 2 +- oak_containers_syslogd/BUILD | 1 + oak_core/BUILD | 2 +- oak_crypto/BUILD | 2 +- oak_dice/BUILD | 2 +- oak_functions/examples/echo/BUILD | 1 + oak_linux_boot_params/BUILD | 2 +- oak_proto_rust/BUILD | 5 +- oak_restricted_kernel/BUILD | 8 +- oak_restricted_kernel_dice/BUILD | 2 +- oak_sev_guest/BUILD | 2 +- oak_sev_snp_attestation_report/BUILD | 2 +- oak_virtio/BUILD | 2 +- sev_serial/BUILD | 2 +- stage0/BUILD | 2 +- stage0_dice/BUILD | 2 +- .../rust-hypervisor-firmware-virtio/BUILD | 2 +- 23 files changed, 578 insertions(+), 223 deletions(-) diff --git a/BUILD b/BUILD index 110c8e1464..fad7694f52 100644 --- a/BUILD +++ b/BUILD @@ -18,6 +18,8 @@ # loaded by `rules_docker`: # https://github.com/bazelbuild/bazel-gazelle/issues/609 +load("@bazel_skylib//lib:selects.bzl", "selects") + package( default_visibility = ["//visibility:public"], licenses = ["notice"], @@ -66,6 +68,35 @@ platform( ], ) +# To mark targets to build for x86_64 on bare metal, use this setting. +# This way you can exclude your target from being built for +# wasm on bare metal or for x86_64 on Linux. +selects.config_setting_group( + name = "x86_64-none-setting", + match_all = [ + "@platforms//cpu:x86_64", + "@platforms//os:none", + ], +) + +# Same as previous setting, but for wasm on bare metal. +selects.config_setting_group( + name = "wasm32-none-setting", + match_all = [ + "@platforms//cpu:wasm32", + "@platforms//os:none", + ], +) + +# Same as previous setting, but for x86_64 on Linux. +selects.config_setting_group( + name = "x86_64-linux-setting", + match_all = [ + "@platforms//cpu:x86_64", + "@platforms//os:linux", + ], +) + filegroup( name = "clang_tidy_config", srcs = [".clang-tidy"], diff --git a/bazel/defs.bzl b/bazel/defs.bzl index ea7746df00..fed84e9580 100644 --- a/bazel/defs.bzl +++ b/bazel/defs.bzl @@ -37,15 +37,15 @@ def either_platform(platform_list): Example: ``` target_compatible_with = either_platform([ - "@platforms//os:linux", - "@platforms//os:none" + "//:x86_64-linux-setting", + "//:x86_64-none-setting" ]), ``` is equivalent to: ``` target_compatible_with = select({ - "@platforms//os:linux": ["@platforms//os:linux"], - "@platforms//os:none": ["@platforms//os:none"], + "//:x86_64-linux-setting": ["//:x86_64-linux-setting"], + "//:x86_64-none-setting": ["//:x86_64-none-setting"], "//conditions:default": ["@platforms//:incompatible"], }), ``` diff --git a/bazel/test_workspace/Cargo-test.bazel.lock b/bazel/test_workspace/Cargo-test.bazel.lock index 68424ea537..6d5cda7f12 100644 --- a/bazel/test_workspace/Cargo-test.bazel.lock +++ b/bazel/test_workspace/Cargo-test.bazel.lock @@ -451,12 +451,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chacha20" version = "0.9.1" @@ -826,6 +820,15 @@ dependencies = [ "itertools 0.10.5", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -1093,13 +1096,13 @@ dependencies = [ "lock_api", "log", "maplit", - "nix 0.29.0", + "nix 0.27.1", "oci-spec", "once_cell", - "opentelemetry", + "opentelemetry 0.22.0", "opentelemetry-otlp", - "opentelemetry-proto", - "opentelemetry_sdk", + "opentelemetry-proto 0.6.0", + "opentelemetry_sdk 0.22.1", "ouroboros", "p256", "p384", @@ -2311,23 +2314,11 @@ checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" dependencies = [ "bitflags 2.5.0", "cfg-if", - "cfg_aliases 0.1.1", + "cfg_aliases", "libc", "memoffset", ] -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.5.0", - "cfg-if", - "cfg_aliases 0.2.1", - "libc", -] - [[package]] name = "num-bigint-dig" version = "0.8.4" @@ -2463,6 +2454,21 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +[[package]] +name = "opentelemetry" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900d57987be3f2aeb70d385fff9b27fb74c5723cc9a52d904d4f9c807a0667bf" +dependencies = [ + "futures-core", + "futures-sink", + "js-sys", + "once_cell", + "pin-project-lite", + "thiserror", + "urlencoding", +] + [[package]] name = "opentelemetry" version = "0.23.0" @@ -2479,48 +2485,67 @@ dependencies = [ [[package]] name = "opentelemetry-otlp" -version = "0.16.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a94c69209c05319cdf7460c6d4c055ed102be242a0a6245835d7bc42c6ec7f54" +checksum = "1a016b8d9495c639af2145ac22387dcb88e44118e45320d9238fbf4e7889abcb" dependencies = [ "async-trait", "futures-core", "http 0.2.12", - "opentelemetry", - "opentelemetry-proto", - "opentelemetry_sdk", + "opentelemetry 0.22.0", + "opentelemetry-proto 0.5.0", + "opentelemetry-semantic-conventions", + "opentelemetry_sdk 0.22.1", "prost", "thiserror", "tokio", "tonic", ] +[[package]] +name = "opentelemetry-proto" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8fddc9b68f5b80dae9d6f510b88e02396f006ad48cac349411fbecc80caae4" +dependencies = [ + "opentelemetry 0.22.0", + "opentelemetry_sdk 0.22.1", + "prost", + "tonic", +] + [[package]] name = "opentelemetry-proto" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "984806e6cf27f2b49282e2a05e288f30594f3dbc74eb7a6e99422bc48ed78162" dependencies = [ - "opentelemetry", - "opentelemetry_sdk", + "opentelemetry 0.23.0", + "opentelemetry_sdk 0.23.0", "prost", "tonic", ] +[[package]] +name = "opentelemetry-semantic-conventions" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9ab5bd6c42fb9349dcf28af2ba9a0667f697f9bdcca045d39f2cec5543e2910" + [[package]] name = "opentelemetry_sdk" -version = "0.23.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae312d58eaa90a82d2e627fd86e075cf5230b3f11794e2ed74199ebbe572d4fd" +checksum = "9e90c7113be649e31e9a0f8b5ee24ed7a16923b322c3c5ab6367469c049d6b7e" dependencies = [ "async-trait", + "crossbeam-channel", "futures-channel", "futures-executor", "futures-util", "glob", - "lazy_static", "once_cell", - "opentelemetry", + "opentelemetry 0.22.0", "ordered-float", "percent-encoding", "rand", @@ -2530,6 +2555,25 @@ dependencies = [ "tokio-stream", ] +[[package]] +name = "opentelemetry_sdk" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae312d58eaa90a82d2e627fd86e075cf5230b3f11794e2ed74199ebbe572d4fd" +dependencies = [ + "async-trait", + "futures-channel", + "futures-executor", + "futures-util", + "glob", + "lazy_static", + "once_cell", + "opentelemetry 0.23.0", + "ordered-float", + "serde_json", + "thiserror", +] + [[package]] name = "ordered-float" version = "4.2.0" @@ -4184,6 +4228,12 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf8parse" version = "0.2.1" diff --git a/bazel/test_workspace/cargo-bazel-test-lock.json b/bazel/test_workspace/cargo-bazel-test-lock.json index 0e997b3d9f..1fece03085 100644 --- a/bazel/test_workspace/cargo-bazel-test-lock.json +++ b/bazel/test_workspace/cargo-bazel-test-lock.json @@ -1,5 +1,5 @@ { - "checksum": "769a9a60f26f4949df6e4ce64a3f07543b02a9a7acc8aa2ec3a6a35725ddc2c0", + "checksum": "47f0b135e3fb47fa7aa7737628750134610264099cf1d10774c406a0993eb3a1", "crates": { "acpi 5.0.0": { "name": "acpi", @@ -2787,44 +2787,6 @@ ], "license_file": "LICENSE" }, - "cfg_aliases 0.2.1": { - "name": "cfg_aliases", - "version": "0.2.1", - "package_url": "https://github.com/katharostech/cfg_aliases", - "repository": { - "Http": { - "url": "https://static.crates.io/crates/cfg_aliases/0.2.1/download", - "sha256": "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - } - }, - "targets": [ - { - "Library": { - "crate_name": "cfg_aliases", - "crate_root": "src/lib.rs", - "srcs": { - "allow_empty": false, - "include": [ - "**/*.rs" - ] - } - } - } - ], - "library_target_name": "cfg_aliases", - "common_attrs": { - "compile_data_glob": [ - "**" - ], - "edition": "2018", - "version": "0.2.1" - }, - "license": "MIT", - "license_ids": [ - "MIT" - ], - "license_file": "LICENSE" - }, "chacha20 0.9.1": { "name": "chacha20", "version": "0.9.1", @@ -5020,6 +4982,61 @@ ], "license_file": "LICENSE-APACHE" }, + "crossbeam-channel 0.5.13": { + "name": "crossbeam-channel", + "version": "0.5.13", + "package_url": "https://github.com/crossbeam-rs/crossbeam", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/crossbeam-channel/0.5.13/download", + "sha256": "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" + } + }, + "targets": [ + { + "Library": { + "crate_name": "crossbeam_channel", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": false, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "crossbeam_channel", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "default", + "std" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "crossbeam-utils 0.8.20", + "target": "crossbeam_utils" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "0.5.13" + }, + "license": "MIT OR Apache-2.0", + "license_ids": [ + "Apache-2.0", + "MIT" + ], + "license_file": "LICENSE-APACHE" + }, "crossbeam-deque 0.8.5": { "name": "crossbeam-deque", "version": "0.8.5", @@ -6546,7 +6563,7 @@ "target": "maplit" }, { - "id": "nix 0.29.0", + "id": "nix 0.27.1", "target": "nix" }, { @@ -6558,11 +6575,11 @@ "target": "once_cell" }, { - "id": "opentelemetry 0.23.0", + "id": "opentelemetry 0.22.0", "target": "opentelemetry" }, { - "id": "opentelemetry-otlp 0.16.0", + "id": "opentelemetry-otlp 0.15.0", "target": "opentelemetry_otlp" }, { @@ -6570,7 +6587,7 @@ "target": "opentelemetry_proto" }, { - "id": "opentelemetry_sdk 0.23.0", + "id": "opentelemetry_sdk 0.22.1", "target": "opentelemetry_sdk" }, { @@ -13817,12 +13834,14 @@ "crate_features": { "common": [ "default", + "feature", "fs", "mount", "process", "sched", "signal", - "uio" + "uio", + "user" ], "selects": {} }, @@ -13950,101 +13969,6 @@ ], "license_file": "LICENSE" }, - "nix 0.29.0": { - "name": "nix", - "version": "0.29.0", - "package_url": "https://github.com/nix-rust/nix", - "repository": { - "Http": { - "url": "https://static.crates.io/crates/nix/0.29.0/download", - "sha256": "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" - } - }, - "targets": [ - { - "Library": { - "crate_name": "nix", - "crate_root": "src/lib.rs", - "srcs": { - "allow_empty": false, - "include": [ - "**/*.rs" - ] - } - } - }, - { - "BuildScript": { - "crate_name": "build_script_build", - "crate_root": "build.rs", - "srcs": { - "allow_empty": false, - "include": [ - "**/*.rs" - ] - } - } - } - ], - "library_target_name": "nix", - "common_attrs": { - "compile_data_glob": [ - "**" - ], - "crate_features": { - "common": [ - "default", - "feature", - "process", - "signal", - "user" - ], - "selects": {} - }, - "deps": { - "common": [ - { - "id": "bitflags 2.5.0", - "target": "bitflags" - }, - { - "id": "cfg-if 1.0.0", - "target": "cfg_if" - }, - { - "id": "libc 0.2.155", - "target": "libc" - }, - { - "id": "nix 0.29.0", - "target": "build_script_build" - } - ], - "selects": {} - }, - "edition": "2021", - "version": "0.29.0" - }, - "build_script_attrs": { - "data_glob": [ - "**" - ], - "deps": { - "common": [ - { - "id": "cfg_aliases 0.2.1", - "target": "cfg_aliases" - } - ], - "selects": {} - } - }, - "license": "MIT", - "license_ids": [ - "MIT" - ], - "license_file": "LICENSE" - }, "num-bigint-dig 0.8.4": { "name": "num-bigint-dig", "version": "0.8.4", @@ -14887,6 +14811,90 @@ ], "license_file": "LICENSE-APACHE" }, + "opentelemetry 0.22.0": { + "name": "opentelemetry", + "version": "0.22.0", + "package_url": "https://github.com/open-telemetry/opentelemetry-rust", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/opentelemetry/0.22.0/download", + "sha256": "900d57987be3f2aeb70d385fff9b27fb74c5723cc9a52d904d4f9c807a0667bf" + } + }, + "targets": [ + { + "Library": { + "crate_name": "opentelemetry", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": false, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "opentelemetry", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "default", + "logs", + "metrics", + "pin-project-lite", + "trace" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "futures-core 0.3.30", + "target": "futures_core" + }, + { + "id": "futures-sink 0.3.30", + "target": "futures_sink" + }, + { + "id": "once_cell 1.19.0", + "target": "once_cell" + }, + { + "id": "pin-project-lite 0.2.14", + "target": "pin_project_lite" + }, + { + "id": "thiserror 1.0.61", + "target": "thiserror" + }, + { + "id": "urlencoding 2.1.3", + "target": "urlencoding" + } + ], + "selects": { + "cfg(all(target_arch = \"wasm32\", not(target_os = \"wasi\")))": [ + { + "id": "js-sys 0.3.69", + "target": "js_sys" + } + ] + } + }, + "edition": "2021", + "version": "0.22.0" + }, + "license": "Apache-2.0", + "license_ids": [ + "Apache-2.0" + ], + "license_file": "LICENSE" + }, "opentelemetry 0.23.0": { "name": "opentelemetry", "version": "0.23.0", @@ -14967,14 +14975,14 @@ ], "license_file": "LICENSE" }, - "opentelemetry-otlp 0.16.0": { + "opentelemetry-otlp 0.15.0": { "name": "opentelemetry-otlp", - "version": "0.16.0", + "version": "0.15.0", "package_url": "https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry-otlp", "repository": { "Http": { - "url": "https://static.crates.io/crates/opentelemetry-otlp/0.16.0/download", - "sha256": "a94c69209c05319cdf7460c6d4c055ed102be242a0a6245835d7bc42c6ec7f54" + "url": "https://static.crates.io/crates/opentelemetry-otlp/0.15.0/download", + "sha256": "1a016b8d9495c639af2145ac22387dcb88e44118e45320d9238fbf4e7889abcb" } }, "targets": [ @@ -15001,6 +15009,7 @@ "default", "grpc-tonic", "http", + "logs", "metrics", "prost", "tokio", @@ -15020,15 +15029,19 @@ "target": "http" }, { - "id": "opentelemetry 0.23.0", + "id": "opentelemetry 0.22.0", "target": "opentelemetry" }, { - "id": "opentelemetry-proto 0.6.0", + "id": "opentelemetry-proto 0.5.0", "target": "opentelemetry_proto" }, { - "id": "opentelemetry_sdk 0.23.0", + "id": "opentelemetry-semantic-conventions 0.14.0", + "target": "opentelemetry_semantic_conventions" + }, + { + "id": "opentelemetry_sdk 0.22.1", "target": "opentelemetry_sdk" }, { @@ -15060,7 +15073,78 @@ ], "selects": {} }, - "version": "0.16.0" + "version": "0.15.0" + }, + "license": "Apache-2.0", + "license_ids": [ + "Apache-2.0" + ], + "license_file": "LICENSE" + }, + "opentelemetry-proto 0.5.0": { + "name": "opentelemetry-proto", + "version": "0.5.0", + "package_url": "https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry-proto", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/opentelemetry-proto/0.5.0/download", + "sha256": "3a8fddc9b68f5b80dae9d6f510b88e02396f006ad48cac349411fbecc80caae4" + } + }, + "targets": [ + { + "Library": { + "crate_name": "opentelemetry_proto", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": false, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "opentelemetry_proto", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "gen-tonic", + "gen-tonic-messages", + "logs", + "metrics", + "prost", + "tonic", + "trace" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "opentelemetry 0.22.0", + "target": "opentelemetry" + }, + { + "id": "opentelemetry_sdk 0.22.1", + "target": "opentelemetry_sdk" + }, + { + "id": "prost 0.12.6", + "target": "prost" + }, + { + "id": "tonic 0.11.0", + "target": "tonic" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "0.5.0" }, "license": "Apache-2.0", "license_ids": [ @@ -15105,8 +15189,7 @@ "logs", "metrics", "prost", - "tonic", - "trace" + "tonic" ], "selects": {} }, @@ -15140,14 +15223,52 @@ ], "license_file": "LICENSE" }, - "opentelemetry_sdk 0.23.0": { + "opentelemetry-semantic-conventions 0.14.0": { + "name": "opentelemetry-semantic-conventions", + "version": "0.14.0", + "package_url": "https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry-semantic-conventions", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/opentelemetry-semantic-conventions/0.14.0/download", + "sha256": "f9ab5bd6c42fb9349dcf28af2ba9a0667f697f9bdcca045d39f2cec5543e2910" + } + }, + "targets": [ + { + "Library": { + "crate_name": "opentelemetry_semantic_conventions", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": false, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "opentelemetry_semantic_conventions", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "edition": "2021", + "version": "0.14.0" + }, + "license": "Apache-2.0", + "license_ids": [ + "Apache-2.0" + ], + "license_file": "LICENSE" + }, + "opentelemetry_sdk 0.22.1": { "name": "opentelemetry_sdk", - "version": "0.23.0", + "version": "0.22.1", "package_url": "https://github.com/open-telemetry/opentelemetry-rust", "repository": { "Http": { - "url": "https://static.crates.io/crates/opentelemetry_sdk/0.23.0/download", - "sha256": "ae312d58eaa90a82d2e627fd86e075cf5230b3f11794e2ed74199ebbe572d4fd" + "url": "https://static.crates.io/crates/opentelemetry_sdk/0.22.1/download", + "sha256": "9e90c7113be649e31e9a0f8b5ee24ed7a16923b322c3c5ab6367469c049d6b7e" } }, "targets": [ @@ -15172,6 +15293,7 @@ "crate_features": { "common": [ "async-trait", + "crossbeam-channel", "default", "glob", "logs", @@ -15188,6 +15310,10 @@ }, "deps": { "common": [ + { + "id": "crossbeam-channel 0.5.13", + "target": "crossbeam_channel" + }, { "id": "futures-channel 0.3.30", "target": "futures_channel" @@ -15204,16 +15330,12 @@ "id": "glob 0.3.1", "target": "glob" }, - { - "id": "lazy_static 1.4.0", - "target": "lazy_static" - }, { "id": "once_cell 1.19.0", "target": "once_cell" }, { - "id": "opentelemetry 0.23.0", + "id": "opentelemetry 0.22.0", "target": "opentelemetry" }, { @@ -15257,6 +15379,108 @@ ], "selects": {} }, + "version": "0.22.1" + }, + "license": "Apache-2.0", + "license_ids": [ + "Apache-2.0" + ], + "license_file": "LICENSE" + }, + "opentelemetry_sdk 0.23.0": { + "name": "opentelemetry_sdk", + "version": "0.23.0", + "package_url": "https://github.com/open-telemetry/opentelemetry-rust", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/opentelemetry_sdk/0.23.0/download", + "sha256": "ae312d58eaa90a82d2e627fd86e075cf5230b3f11794e2ed74199ebbe572d4fd" + } + }, + "targets": [ + { + "Library": { + "crate_name": "opentelemetry_sdk", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": false, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "opentelemetry_sdk", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "async-trait", + "glob", + "logs", + "metrics", + "serde_json" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "futures-channel 0.3.30", + "target": "futures_channel" + }, + { + "id": "futures-executor 0.3.30", + "target": "futures_executor" + }, + { + "id": "futures-util 0.3.30", + "target": "futures_util" + }, + { + "id": "glob 0.3.1", + "target": "glob" + }, + { + "id": "lazy_static 1.4.0", + "target": "lazy_static" + }, + { + "id": "once_cell 1.19.0", + "target": "once_cell" + }, + { + "id": "opentelemetry 0.23.0", + "target": "opentelemetry" + }, + { + "id": "ordered-float 4.2.0", + "target": "ordered_float" + }, + { + "id": "serde_json 1.0.117", + "target": "serde_json" + }, + { + "id": "thiserror 1.0.61", + "target": "thiserror" + } + ], + "selects": {} + }, + "edition": "2021", + "proc_macro_deps": { + "common": [ + { + "id": "async-trait 0.1.80", + "target": "async_trait" + } + ], + "selects": {} + }, "version": "0.23.0" }, "license": "Apache-2.0", @@ -23646,6 +23870,12 @@ ], "selects": {} }, + "rustc_flags": { + "common": [ + "--cfg=tokio_unstable" + ], + "selects": {} + }, "version": "1.38.0" }, "license": "MIT", @@ -25453,6 +25683,44 @@ ], "license_file": "LICENSE-MIT" }, + "urlencoding 2.1.3": { + "name": "urlencoding", + "version": "2.1.3", + "package_url": "https://github.com/kornelski/rust_urlencoding", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/urlencoding/2.1.3/download", + "sha256": "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + } + }, + "targets": [ + { + "Library": { + "crate_name": "urlencoding", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": false, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "urlencoding", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "edition": "2021", + "version": "2.1.3" + }, + "license": "MIT", + "license_ids": [ + "MIT" + ], + "license_file": "LICENSE" + }, "utf8parse 0.2.1": { "name": "utf8parse", "version": "0.2.1", @@ -31219,13 +31487,13 @@ "lock_api 0.4.12", "log 0.4.21", "maplit 1.0.2", - "nix 0.29.0", + "nix 0.27.1", "oci-spec 0.6.5", "once_cell 1.19.0", - "opentelemetry 0.23.0", - "opentelemetry-otlp 0.16.0", + "opentelemetry 0.22.0", + "opentelemetry-otlp 0.15.0", "opentelemetry-proto 0.6.0", - "opentelemetry_sdk 0.23.0", + "opentelemetry_sdk 0.22.1", "ouroboros 0.18.4", "p256 0.13.2", "p384 0.13.0", diff --git a/justfile b/justfile index 1a94cb0485..43cd6660b5 100644 --- a/justfile +++ b/justfile @@ -248,7 +248,8 @@ clang-tidy: # We store the command for the query in this variable, but defer executing it # until usage to prevent bazel invocation on any just invocation. # Lazy assignment is not yet supported: https://github.com/casey/just/issues/953 -bare_metal_crates_query := "bazel cquery 'kind(\"rust_.*\", //...) intersect attr(\"target_compatible_with\", \"@platforms//os:none\", //...)' --platforms=//:x86_64-unknown-none | cut -d' ' -f1 | tr '\\n' ' '" +bare_metal_crates_query := "bazel cquery 'kind(\"rust_.*\", //...) intersect attr(\"target_compatible_with\", \"x86_64-none-setting\", //...)' --platforms=//:x86_64-unknown-none | cut -d' ' -f1 | tr '\\n' ' '" +wasm_crates_query := "bazel cquery 'kind(\"rust_.*\", //...) intersect attr(\"target_compatible_with\", \"wasm32-none-setting\", //...)' | cut -d' ' -f1 | tr '\\n' ' '" bazel-ci: # Test Oak as a dependency in the test workspace @@ -259,8 +260,9 @@ bazel-ci: bazel build --config=unsafe-fast-presubmit -- //...:all bazel test --config=unsafe-fast-presubmit --test_output=errors -- //...:all - # Some crates also need to be built for x86_64-unknown-none. + # Some crates also need to be built for x86_64-unknown-none and for wasm32-unknown-unknown. bazel build --config=unsafe-fast-presubmit --platforms=//:x86_64-unknown-none -- $({{bare_metal_crates_query}}) + bazel build --config=unsafe-fast-presubmit --platforms=//:wasm32-unknown-unknown -- $({{wasm_crates_query}}) bazel-clippy: diff --git a/micro_rpc/BUILD b/micro_rpc/BUILD index 4d87957497..d67ec66978 100644 --- a/micro_rpc/BUILD +++ b/micro_rpc/BUILD @@ -31,8 +31,9 @@ rust_library( "@oak_crates_index//:prost-derive", ], target_compatible_with = either_platform([ - "@platforms//os:linux", - "@platforms//os:none", + "//:x86_64-linux-setting", + "//:x86_64-none-setting", + "//:wasm32-none-setting", ]), deps = [ ":build", diff --git a/oak_channel/BUILD b/oak_channel/BUILD index 54de265a09..fc799d0ead 100644 --- a/oak_channel/BUILD +++ b/oak_channel/BUILD @@ -41,7 +41,7 @@ rust_library( name = "oak_channel", srcs = glob(["src/**"]), target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = _OAK_CHANNEL_DEPS, ) diff --git a/oak_containers_syslogd/BUILD b/oak_containers_syslogd/BUILD index c6c01529fc..9e5319ed28 100644 --- a/oak_containers_syslogd/BUILD +++ b/oak_containers_syslogd/BUILD @@ -28,6 +28,7 @@ rust_binary( crate_features = ["bazel"], # TODO: b/335717840 - Fix systemd linker issue and remove this tag. tags = ["noci"], + target_compatible_with = ["@platforms//:incompatible"], deps = [ ":build", "//oak_containers_orchestrator:lib", diff --git a/oak_core/BUILD b/oak_core/BUILD index 092f834e5b..65cccb9ccf 100644 --- a/oak_core/BUILD +++ b/oak_core/BUILD @@ -25,7 +25,7 @@ rust_library( name = "oak_core", srcs = glob(["src/**"]), target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = [ "@oak_crates_index//:lock_api", diff --git a/oak_crypto/BUILD b/oak_crypto/BUILD index 76e8fef444..44889609f5 100644 --- a/oak_crypto/BUILD +++ b/oak_crypto/BUILD @@ -32,7 +32,7 @@ rust_library( "@oak_crates_index//:async-trait", ], target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = [ "//oak_proto_rust", diff --git a/oak_dice/BUILD b/oak_dice/BUILD index 502621fec6..7180c564d1 100644 --- a/oak_dice/BUILD +++ b/oak_dice/BUILD @@ -28,7 +28,7 @@ rust_library( "no_std", ], target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = [ "@oak_crates_index//:static_assertions", diff --git a/oak_functions/examples/echo/BUILD b/oak_functions/examples/echo/BUILD index ec6ac9a899..63c9caaef3 100644 --- a/oak_functions/examples/echo/BUILD +++ b/oak_functions/examples/echo/BUILD @@ -24,5 +24,6 @@ package( rust_shared_library( name = "echo", srcs = ["module/src/lib.rs"], + target_compatible_with = ["//:wasm32-none-setting"], deps = ["//oak_functions_sdk"], ) diff --git a/oak_linux_boot_params/BUILD b/oak_linux_boot_params/BUILD index b996234cca..42344f1d53 100644 --- a/oak_linux_boot_params/BUILD +++ b/oak_linux_boot_params/BUILD @@ -25,7 +25,7 @@ rust_library( name = "oak_linux_boot_params", srcs = glob(["src/**"]), target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = [ "@oak_crates_index//:static_assertions", diff --git a/oak_proto_rust/BUILD b/oak_proto_rust/BUILD index e58bbfd4af..3ec48dd8ec 100644 --- a/oak_proto_rust/BUILD +++ b/oak_proto_rust/BUILD @@ -31,8 +31,9 @@ rust_library( "@oak_crates_index//:prost-derive", ], target_compatible_with = either_platform([ - "@platforms//os:linux", - "@platforms//os:none", + "//:x86_64-linux-setting", + "//:x86_64-none-setting", + "//:wasm32-none-setting", ]), deps = [ ":build", diff --git a/oak_restricted_kernel/BUILD b/oak_restricted_kernel/BUILD index 07ccd11e61..03dd8763a8 100644 --- a/oak_restricted_kernel/BUILD +++ b/oak_restricted_kernel/BUILD @@ -82,7 +82,7 @@ rust_library( ], crate_name = "oak_restricted_kernel", target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = _OAK_RESTRICTED_KERNEL_COMMON_DEPS + [ "@oak_no_std_crates_index//:virtio-drivers", @@ -98,7 +98,7 @@ rust_library( ], crate_name = "oak_restricted_kernel", target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = _OAK_RESTRICTED_KERNEL_COMMON_DEPS + [ "//oak_virtio", @@ -114,7 +114,7 @@ rust_library( ], crate_name = "oak_restricted_kernel", target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = _OAK_RESTRICTED_KERNEL_COMMON_DEPS + [ "@oak_crates_index//:uart_16550", @@ -130,7 +130,7 @@ rust_library( ], crate_name = "oak_restricted_kernel", target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = _OAK_RESTRICTED_KERNEL_COMMON_DEPS + [ "//oak_simple_io", diff --git a/oak_restricted_kernel_dice/BUILD b/oak_restricted_kernel_dice/BUILD index 6aa831f412..0188f1b7ee 100644 --- a/oak_restricted_kernel_dice/BUILD +++ b/oak_restricted_kernel_dice/BUILD @@ -25,7 +25,7 @@ rust_library( name = "oak_restricted_kernel_dice", srcs = glob(["src/**"]), target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = [ "//oak_crypto", diff --git a/oak_sev_guest/BUILD b/oak_sev_guest/BUILD index cf6cd42d73..f320b86775 100644 --- a/oak_sev_guest/BUILD +++ b/oak_sev_guest/BUILD @@ -28,7 +28,7 @@ rust_library( "rust-crypto", ], target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = [ "//oak_sev_snp_attestation_report", diff --git a/oak_sev_snp_attestation_report/BUILD b/oak_sev_snp_attestation_report/BUILD index ae4b3ea8f4..294b936ef5 100644 --- a/oak_sev_snp_attestation_report/BUILD +++ b/oak_sev_snp_attestation_report/BUILD @@ -25,7 +25,7 @@ rust_library( name = "oak_sev_snp_attestation_report", srcs = glob(["src/**"]), target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = [ "@oak_crates_index//:static_assertions", diff --git a/oak_virtio/BUILD b/oak_virtio/BUILD index 57987c4c40..2a3483e660 100644 --- a/oak_virtio/BUILD +++ b/oak_virtio/BUILD @@ -25,7 +25,7 @@ rust_library( name = "oak_virtio", srcs = glob(["src/**"]), target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = [ "//third_party/rust-hypervisor-firmware-virtio", diff --git a/sev_serial/BUILD b/sev_serial/BUILD index 4d0d38dbdc..c9a9ac63fb 100644 --- a/sev_serial/BUILD +++ b/sev_serial/BUILD @@ -25,7 +25,7 @@ rust_library( name = "sev_serial", srcs = glob(["src/**"]), target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = [ "//oak_sev_guest", diff --git a/stage0/BUILD b/stage0/BUILD index ad714cd661..a101e2d4e4 100644 --- a/stage0/BUILD +++ b/stage0/BUILD @@ -25,7 +25,7 @@ rust_library( name = "stage0", srcs = glob(["src/**"]), target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = [ "//oak_core", diff --git a/stage0_dice/BUILD b/stage0_dice/BUILD index 07d3dbe57e..6761fa84de 100644 --- a/stage0_dice/BUILD +++ b/stage0_dice/BUILD @@ -26,7 +26,7 @@ rust_library( srcs = glob(["src/**"]), crate_name = "oak_stage0_dice", target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = [ "//oak_dice", diff --git a/third_party/rust-hypervisor-firmware-virtio/BUILD b/third_party/rust-hypervisor-firmware-virtio/BUILD index 658839fc15..4f3fa0278d 100644 --- a/third_party/rust-hypervisor-firmware-virtio/BUILD +++ b/third_party/rust-hypervisor-firmware-virtio/BUILD @@ -24,7 +24,7 @@ rust_library( name = "rust-hypervisor-firmware-virtio", srcs = glob(["src/**"]), target_compatible_with = [ - "@platforms//os:none", + "//:x86_64-none-setting", ], deps = [ "@oak_crates_index//:atomic_refcell",