1load("@rules_cc//cc:defs.bzl", "cc_library") 2load("@rules_rust//rust:defs.bzl", "rust_binary") 3 4# A rust_binary that depends on two native libs with the same name. 5# See https://github.com/bazelbuild/rules_rust/issues/840. 6rust_binary( 7 name = "bin_with_same_name_deps", 8 srcs = ["bin.rs"], 9 deps = [ 10 "//ambiguous_deps/x:exc", 11 "//ambiguous_deps/y:exc", 12 ], 13) 14 15# A rust_binary that depends on a native library with a name that doesn't 16# match the `lib<name>.a` pattern on linux. 17rust_binary( 18 name = "nonstandard_name_bin", 19 srcs = ["nonstandard_name_bin.rs"], 20 deps = [":nonstandard_name_intermediate"], 21) 22 23cc_library( 24 name = "nonstandard_name_cc_lib", 25 srcs = ["cc_library_with_func.cc"], 26) 27 28genrule( 29 name = "nonstandard_name_gen", 30 srcs = [":nonstandard_name_cc_lib"], 31 outs = ["nonstandard_name_gen.a"], 32 # Copy the first member (libnonstandard_name_cc_lib.a) from the srcs to the 33 # output nonstandard_name_gen.a. 34 cmd = "cp $$(awk '{print $$1}' <<< '$(SRCS)') $@", 35) 36 37cc_library( 38 name = "nonstandard_name_intermediate", 39 srcs = [":nonstandard_name_gen.a"], 40) 41