xref: /aosp_15_r20/external/bazelbuild-rules_rust/test/native_deps/BUILD.bazel (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1*d4726bddSHONG Yifanload("@rules_cc//cc:defs.bzl", "cc_library")
2*d4726bddSHONG Yifanload(
3*d4726bddSHONG Yifan    "@rules_rust//rust:defs.bzl",
4*d4726bddSHONG Yifan    "rust_library",
5*d4726bddSHONG Yifan    "rust_test",
6*d4726bddSHONG Yifan)
7*d4726bddSHONG Yifan
8*d4726bddSHONG Yifan# TODO: These targets started failing on windows after the Rust 1.78.0 upgrade.
9*d4726bddSHONG Yifan# https://github.com/bazelbuild/rules_rust/issues/2640
10*d4726bddSHONG YifanINCOMPATIBLE_WINDOWS = select({
11*d4726bddSHONG Yifan    "@platforms//os:windows": ["@platforms//:incompatible"],
12*d4726bddSHONG Yifan    "//conditions:default": [],
13*d4726bddSHONG Yifan})
14*d4726bddSHONG Yifan
15*d4726bddSHONG Yifanrust_library(
16*d4726bddSHONG Yifan    name = "transitive",
17*d4726bddSHONG Yifan    srcs = ["transitive.rs"],
18*d4726bddSHONG Yifan    edition = "2018",
19*d4726bddSHONG Yifan    target_compatible_with = INCOMPATIBLE_WINDOWS,
20*d4726bddSHONG Yifan)
21*d4726bddSHONG Yifan
22*d4726bddSHONG Yifancc_library(
23*d4726bddSHONG Yifan    name = "direct",
24*d4726bddSHONG Yifan    srcs = ["direct.cc"],
25*d4726bddSHONG Yifan    hdrs = ["direct.h"],
26*d4726bddSHONG Yifan    target_compatible_with = INCOMPATIBLE_WINDOWS,
27*d4726bddSHONG Yifan    deps = [":transitive"],
28*d4726bddSHONG Yifan)
29*d4726bddSHONG Yifan
30*d4726bddSHONG Yifanrust_test(
31*d4726bddSHONG Yifan    name = "main",
32*d4726bddSHONG Yifan    srcs = ["main.rs"],
33*d4726bddSHONG Yifan    edition = "2018",
34*d4726bddSHONG Yifan    target_compatible_with = INCOMPATIBLE_WINDOWS,
35*d4726bddSHONG Yifan    deps = [":direct"],
36*d4726bddSHONG Yifan)
37