xref: /aosp_15_r20/external/bazelbuild-rules_rust/examples/ios/BUILD.bazel (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1*d4726bddSHONG Yifanload("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
2*d4726bddSHONG Yifanload("@build_bazel_rules_apple//apple:macos.bzl", "macos_application")
3*d4726bddSHONG Yifanload("@rules_cc//cc:defs.bzl", "cc_library", "objc_library")
4*d4726bddSHONG Yifanload("@rules_rust//rust:defs.bzl", "rust_library")
5*d4726bddSHONG Yifan
6*d4726bddSHONG Yifanrust_library(
7*d4726bddSHONG Yifan    name = "rust_lib",
8*d4726bddSHONG Yifan    srcs = ["demo.rs"],
9*d4726bddSHONG Yifan    edition = "2018",
10*d4726bddSHONG Yifan    tags = ["manual"],
11*d4726bddSHONG Yifan)
12*d4726bddSHONG Yifan
13*d4726bddSHONG Yifan# TODO: Remove this once rules_rust doesn't support bazel 5.x
14*d4726bddSHONG Yifancc_library(
15*d4726bddSHONG Yifan    name = "shim",
16*d4726bddSHONG Yifan    tags = ["manual"],
17*d4726bddSHONG Yifan    deps = [":rust_lib"],
18*d4726bddSHONG Yifan)
19*d4726bddSHONG Yifan
20*d4726bddSHONG Yifanobjc_library(
21*d4726bddSHONG Yifan    name = "main_lib",
22*d4726bddSHONG Yifan    srcs = ["main_lib.m"],
23*d4726bddSHONG Yifan    tags = ["manual"],
24*d4726bddSHONG Yifan    deps = [":shim"],
25*d4726bddSHONG Yifan)
26*d4726bddSHONG Yifan
27*d4726bddSHONG Yifanios_application(
28*d4726bddSHONG Yifan    name = "ios_app",
29*d4726bddSHONG Yifan    bundle_id = "com.example.iosapp",
30*d4726bddSHONG Yifan    families = ["iphone"],
31*d4726bddSHONG Yifan    infoplists = ["Info.plist"],
32*d4726bddSHONG Yifan    minimum_os_version = "13.0",
33*d4726bddSHONG Yifan    deps = [":main_lib"],
34*d4726bddSHONG Yifan)
35*d4726bddSHONG Yifan
36*d4726bddSHONG Yifanmacos_application(
37*d4726bddSHONG Yifan    name = "macos_app",
38*d4726bddSHONG Yifan    bundle_id = "com.example.macosapp",
39*d4726bddSHONG Yifan    infoplists = ["Info.plist"],
40*d4726bddSHONG Yifan    minimum_os_version = "10.15",
41*d4726bddSHONG Yifan    deps = [":main_lib"],
42*d4726bddSHONG Yifan)
43*d4726bddSHONG Yifan
44*d4726bddSHONG Yifanplatform(
45*d4726bddSHONG Yifan    name = "macos_x86_64",
46*d4726bddSHONG Yifan    constraint_values = [
47*d4726bddSHONG Yifan        "@platforms//cpu:x86_64",
48*d4726bddSHONG Yifan        "@platforms//os:macos",
49*d4726bddSHONG Yifan    ],
50*d4726bddSHONG Yifan)
51*d4726bddSHONG Yifan
52*d4726bddSHONG Yifanplatform(
53*d4726bddSHONG Yifan    name = "macos_arm64",
54*d4726bddSHONG Yifan    constraint_values = [
55*d4726bddSHONG Yifan        "@platforms//cpu:arm64",
56*d4726bddSHONG Yifan        "@platforms//os:macos",
57*d4726bddSHONG Yifan    ],
58*d4726bddSHONG Yifan)
59*d4726bddSHONG Yifan
60*d4726bddSHONG Yifanplatform(
61*d4726bddSHONG Yifan    name = "ios_x86_64",
62*d4726bddSHONG Yifan    constraint_values = [
63*d4726bddSHONG Yifan        "@platforms//cpu:x86_64",
64*d4726bddSHONG Yifan        "@platforms//os:ios",
65*d4726bddSHONG Yifan        "@build_bazel_apple_support//constraints:simulator",
66*d4726bddSHONG Yifan    ],
67*d4726bddSHONG Yifan)
68*d4726bddSHONG Yifan
69*d4726bddSHONG Yifanplatform(
70*d4726bddSHONG Yifan    name = "ios_sim_arm64",
71*d4726bddSHONG Yifan    constraint_values = [
72*d4726bddSHONG Yifan        "@platforms//cpu:arm64",
73*d4726bddSHONG Yifan        "@platforms//os:ios",
74*d4726bddSHONG Yifan        "@build_bazel_apple_support//constraints:simulator",
75*d4726bddSHONG Yifan    ],
76*d4726bddSHONG Yifan)
77*d4726bddSHONG Yifan
78*d4726bddSHONG Yifanplatform(
79*d4726bddSHONG Yifan    name = "ios_arm64",
80*d4726bddSHONG Yifan    constraint_values = [
81*d4726bddSHONG Yifan        "@platforms//cpu:arm64",
82*d4726bddSHONG Yifan        "@platforms//os:ios",
83*d4726bddSHONG Yifan        "@build_bazel_apple_support//constraints:device",
84*d4726bddSHONG Yifan    ],
85*d4726bddSHONG Yifan)
86