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