tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# TensorFlow Lite for Swift
 
package(default_visibility = ["//visibility:private"])
 
licenses(["notice"])  # Apache 2.0
 
exports_files(["LICENSE"])
 
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
 
MINIMUM_OS_VERSION = "9.0"
 
# Default tags for filtering targets. Targets in this file are restricted to Apple platforms.
DEFAULT_TAGS = [
    "apple",
]
 
swift_library(
    name = "TensorFlowLite",
    srcs = glob(["Sources/*.swift"]),
    module_name = "TensorFlowLite",
    tags = DEFAULT_TAGS,
    deps = [
        "//tensorflow/lite/experimental/c:c_api",
    ],
)
 
ios_unit_test(
    name = "TensorFlowLiteTests",
    size = "small",
    minimum_os_version = MINIMUM_OS_VERSION,
    tags = DEFAULT_TAGS + [
        # DISABLED: Following sanitizer tests are not supported by iOS test targets.
        "noasan",
        "nomsan",
        "notsan",
    ],
    deps = [
        ":TestsLib",
    ],
)
 
ios_application(
    name = "TensorFlowLiteApp",
    app_icons = glob(["TestApps/TensorFlowLiteApp/TensorFlowLiteApp/Assets.xcassets/AppIcon.appiconset/**"]),
    bundle_id = "com.tensorflow.lite.swift.TensorFlowLite",
    families = [
        "ipad",
        "iphone",
    ],
    infoplists = ["TestApps/TensorFlowLiteApp/TensorFlowLiteApp/Info.plist"],
    launch_storyboard = "TestApps/TensorFlowLiteApp/TensorFlowLiteApp/Base.lproj/LaunchScreen.storyboard",
    minimum_os_version = MINIMUM_OS_VERSION,
    sdk_frameworks = [
        "CoreGraphics",
    ],
    tags = DEFAULT_TAGS + ["manual"],
    deps = [
        ":AppLib",
    ],
)
 
swift_library(
    name = "TestsLib",
    testonly = 1,
    srcs = glob(["Tests/*.swift"]),
    tags = DEFAULT_TAGS,
    deps = [
        ":Resources",
        ":TensorFlowLite",
    ],
)
 
swift_library(
    name = "AppLib",
    srcs = glob(["TestApps/TensorFlowLiteApp/TensorFlowLiteApp/*.swift"]),
    module_name = "AppLib",
    tags = DEFAULT_TAGS + ["manual"],
    deps = [
        ":AppResources",
        ":TensorFlowLite",
    ],
)
 
objc_library(
    name = "Resources",
    data = [
        "//tensorflow/lite:testdata/add.bin",
        "//tensorflow/lite:testdata/add_quantized.bin",
        "//tensorflow/lite:testdata/multi_add.bin",
    ],
    tags = DEFAULT_TAGS,
)
 
objc_library(
    name = "AppResources",
    data = glob([
        "TestApps/TensorFlowLiteApp/TensorFlowLiteApp/Base.lproj/*.storyboard",
    ]),
    tags = DEFAULT_TAGS + ["manual"],
    deps = [
        ":Resources",
    ],
)