1load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_static_library") 2 3rust_binary( 4 name = "hello_world", 5 srcs = ["hello_world.rs"], 6 # TODO: When building binary for android target, rustc adds `"-ldl" "-llog" "-lgcc" "-ldl" "-lc" "-lm"` 7 # that don't get resolved yet. 8 target_compatible_with = select({ 9 "//build/bazel_common_rules/platforms/os:android": ["@platforms//:incompatible"], 10 "//conditions:default": [], 11 }), 12) 13 14rust_library( 15 name = "hello_lib", 16 srcs = [ 17 "src/greeter.rs", 18 "src/lib.rs", 19 ], 20 crate_features = ["default"], 21 rustc_flags = ["--cap-lints=allow"], 22) 23 24rust_static_library( 25 name = "hello_test_staticlib", 26 srcs = [ 27 "tests/greeting.rs", 28 ], 29 deps = [":hello_lib"], 30) 31