fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
c177ccc1
patching
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) 19 20rust_binary ( 21name = "hello_world_x86_64" , 22srcs = [ "src/main.rs" ], 23platform = "//build/platforms:linux-x86_64" , 24deps = [], 25) 26 27rust_binary ( 28name = "hello_world_aarch64" , 29srcs = [ "src/main.rs" ], 30platform = "//build/platforms:linux-aarch64" , 31deps = [], 32) 33 34# Test if the host binary works. 35# Note, we cannot test for platform since Bazel determines the host platform automatically 36sh_test ( 37name = "test_hello_world_host" , 38srcs = [ "test_hello_world.sh" ], 39args = [ 40"$(rlocationpath :hello_world_host)" , 41], 42data = [ 43":hello_world_host" , 44], 45deps = [ 46"@bazel_tools//tools/bash/runfiles" , 47], 48) 49 50# Test the for x86_64 architecture 51sh_test ( 52name = "test_linux_x86_64" , 53srcs = [ "test_platform.sh" ], 54args = [ 55"$(rootpath :hello_world_x86_64)" , 56"x86_64" , 57], 58data = [ 59":hello_world_x86_64" , 60], 61deps = [ 62"@bazel_tools//tools/bash/runfiles" , 63], 64) 65 66# Test for ARM architecture 67sh_test ( 68name = "test_linux_arm64" , 69srcs = [ "test_platform.sh" ], 70args = [ 71"$(rootpath :hello_world_aarch64)" , 72"aarch64" , 73], 74data = [ 75":hello_world_aarch64" , 76], 77deps = [ 78"@bazel_tools//tools/bash/runfiles" , 79], 80)