load("@rules_rust//rust:defs.bzl", "rust_binary") package(default_visibility = ["//visibility:public"]) filegroup( name = "all", srcs = [ ":hello_world_aarch64", ":hello_world_host", ":hello_world_x86_64", ], ) rust_binary( name = "hello_world_host", srcs = ["src/main.rs"], deps = [], ) rust_binary( name = "hello_world_x86_64", srcs = ["src/main.rs"], platform = "//build/platforms:linux-x86_64", deps = [], ) rust_binary( name = "hello_world_aarch64", srcs = ["src/main.rs"], platform = "//build/platforms:linux-aarch64", deps = [], ) # Test if the host binary works. # Note, we cannot test for platform since Bazel determines the host platform automatically sh_test( name = "test_hello_world_host", srcs = ["test_hello_world.sh"], args = [ "$(rlocationpath :hello_world_host)", ], data = [ ":hello_world_host", ], deps = [ "@bazel_tools//tools/bash/runfiles", ], ) # Test the for x86_64 architecture sh_test( name = "test_linux_x86_64", srcs = ["test_platform.sh"], args = [ "$(rootpath :hello_world_x86_64)", "x86_64", ], data = [ ":hello_world_x86_64", ], deps = [ "@bazel_tools//tools/bash/runfiles", ], ) # Test for ARM architecture sh_test( name = "test_linux_arm64", srcs = ["test_platform.sh"], args = [ "$(rootpath :hello_world_aarch64)", "aarch64", ], data = [ ":hello_world_aarch64", ], deps = [ "@bazel_tools//tools/bash/runfiles", ], )