fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
11343929
cleanup
1load ( "@rules_rust//rust:defs.bzl" , "rust_binary" ) 2 3package ( default_visibility = [ "//visibility:public" ]) 4 5filegroup ( 6name = "all" , 7srcs = [ 8":hello_world_aarch64" , 9":hello_world_host" , 10":hello_world_x86_64" , 11], 12) 13 14rust_binary ( 15name = "hello_world_host" , 16srcs = [ "src/main.rs" ], 17deps = [ 18"@crates//:lz4-sys" , 19"@crates//:mimalloc" , 20], 21) 22 23rust_binary ( 24name = "hello_world_x86_64" , 25srcs = [ "src/main.rs" ], 26platform = "//build/platforms:linux-x86_64" , 27deps = [ 28"@crates//:lz4-sys" , 29"@crates//:mimalloc" , 30], 31) 32 33rust_binary ( 34name = "hello_world_aarch64" , 35srcs = [ "src/main.rs" ], 36platform = "//build/platforms:linux-aarch64" , 37deps = [ 38"@crates//:lz4-sys" , 39"@crates//:mimalloc" , 40], 41) 42 43# Test if the host binary works. 44# Note, we cannot test for platform since Bazel determines the host platform automatically 45sh_test ( 46name = "test_hello_world_host" , 47srcs = [ "test_hello_world.sh" ], 48args = [ 49"$(rlocationpath :hello_world_host)" , 50], 51data = [ 52":hello_world_host" , 53], 54deps = [ 55"@bazel_tools//tools/bash/runfiles" , 56], 57) 58 59# Test the for x86_64 architecture 60sh_test ( 61name = "test_linux_x86_64" , 62srcs = [ "test_platform.sh" ], 63args = [ 64"$(rootpath :hello_world_x86_64)" , 65"x86_64" , 66], 67data = [ 68":hello_world_x86_64" , 69], 70deps = [ 71"@bazel_tools//tools/bash/runfiles" , 72], 73) 74 75# Test for ARM architecture 76sh_test ( 77name = "test_linux_arm64" , 78srcs = [ "test_platform.sh" ], 79args = [ 80"$(rootpath :hello_world_aarch64)" , 81"aarch64" , 82], 83data = [ 84":hello_world_aarch64" , 85], 86deps = [ 87"@bazel_tools//tools/bash/runfiles" , 88], 89)