xref: /aosp_15_r20/external/bazelbuild-rules_rust/examples/ios_build/BUILD.bazel (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1*d4726bddSHONG Yifanload("@rules_rust//rust:defs.bzl", "rust_static_library")
2*d4726bddSHONG Yifan
3*d4726bddSHONG Yifanexports_files([
4*d4726bddSHONG Yifan    "Cargo.toml",
5*d4726bddSHONG Yifan    "Cargo.lock",
6*d4726bddSHONG Yifan])
7*d4726bddSHONG Yifan
8*d4726bddSHONG Yifanrust_static_library(
9*d4726bddSHONG Yifan    name = "ios_build_lib",
10*d4726bddSHONG Yifan    srcs = glob(["**/*.rs"]),
11*d4726bddSHONG Yifan    edition = "2018",
12*d4726bddSHONG Yifan    deps = [
13*d4726bddSHONG Yifan        "@ios_build//:zstd",
14*d4726bddSHONG Yifan    ],
15*d4726bddSHONG Yifan)
16*d4726bddSHONG Yifan
17*d4726bddSHONG Yifanfilegroup(
18*d4726bddSHONG Yifan    name = "lib",
19*d4726bddSHONG Yifan    srcs = ["ios_build_lib"],
20*d4726bddSHONG Yifan)
21*d4726bddSHONG Yifan
22*d4726bddSHONG Yifansh_test(
23*d4726bddSHONG Yifan    name = "check_arch",
24*d4726bddSHONG Yifan    srcs = ["check_arch.sh"],
25*d4726bddSHONG Yifan    args = ["$(location :lib)"],
26*d4726bddSHONG Yifan    data = [":lib"],
27*d4726bddSHONG Yifan)
28*d4726bddSHONG Yifan
29*d4726bddSHONG Yifanplatform(
30*d4726bddSHONG Yifan    name = "macos_x86_64",
31*d4726bddSHONG Yifan    constraint_values = [
32*d4726bddSHONG Yifan        "@platforms//cpu:x86_64",
33*d4726bddSHONG Yifan        "@platforms//os:macos",
34*d4726bddSHONG Yifan    ],
35*d4726bddSHONG Yifan)
36*d4726bddSHONG Yifan
37*d4726bddSHONG Yifanplatform(
38*d4726bddSHONG Yifan    name = "macos_arm64",
39*d4726bddSHONG Yifan    constraint_values = [
40*d4726bddSHONG Yifan        "@platforms//cpu:arm64",
41*d4726bddSHONG Yifan        "@platforms//os:macos",
42*d4726bddSHONG Yifan    ],
43*d4726bddSHONG Yifan)
44*d4726bddSHONG Yifan
45*d4726bddSHONG Yifanplatform(
46*d4726bddSHONG Yifan    name = "ios_x86_64",
47*d4726bddSHONG Yifan    constraint_values = [
48*d4726bddSHONG Yifan        "@platforms//cpu:x86_64",
49*d4726bddSHONG Yifan        "@platforms//os:ios",
50*d4726bddSHONG Yifan        "@build_bazel_apple_support//constraints:simulator",
51*d4726bddSHONG Yifan    ],
52*d4726bddSHONG Yifan)
53*d4726bddSHONG Yifan
54*d4726bddSHONG Yifanplatform(
55*d4726bddSHONG Yifan    name = "ios_sim_arm64",
56*d4726bddSHONG Yifan    constraint_values = [
57*d4726bddSHONG Yifan        "@platforms//cpu:arm64",
58*d4726bddSHONG Yifan        "@platforms//os:ios",
59*d4726bddSHONG Yifan        "@build_bazel_apple_support//constraints:simulator",
60*d4726bddSHONG Yifan    ],
61*d4726bddSHONG Yifan)
62*d4726bddSHONG Yifan
63*d4726bddSHONG Yifanplatform(
64*d4726bddSHONG Yifan    name = "ios_arm64",
65*d4726bddSHONG Yifan    constraint_values = [
66*d4726bddSHONG Yifan        "@platforms//cpu:arm64",
67*d4726bddSHONG Yifan        "@platforms//os:ios",
68*d4726bddSHONG Yifan        "@build_bazel_apple_support//constraints:device",
69*d4726bddSHONG Yifan    ],
70*d4726bddSHONG Yifan)
71