• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2017 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    default_applicable_licenses: ["external_tensorflow_license"],
17}
18
19// Added automatically by a large-scale-change that took the approach of
20// 'apply every license found to every target'. While this makes sure we respect
21// every license restriction, it may not be entirely correct.
22//
23// e.g. GPL in an MIT project might only apply to the contrib/ directory.
24//
25// Please consider splitting the single license below into multiple licenses,
26// taking care not to lose any license_kind information, and overriding the
27// default license using the 'licenses: [...]' property on targets as needed.
28//
29// For unused files, consider creating a 'fileGroup' with "//visibility:private"
30// to attach the license to, and including a comment whether the files may be
31// used in the current project.
32//
33// large-scale-change included anything that looked like it might be a license
34// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
35//
36// Please consider removing redundant or irrelevant files from 'license_text:'.
37//
38// large-scale-change filtered out the below license kinds as false-positives:
39//   SPDX-license-identifier-CC-BY-SA
40//   SPDX-license-identifier-MPL-2.0
41// See: http://go/android-license-faq
42license {
43    name: "external_tensorflow_license",
44    visibility: [":__subpackages__"],
45    license_kinds: [
46        "SPDX-license-identifier-Apache-2.0",
47        "SPDX-license-identifier-BSD",
48        "SPDX-license-identifier-MIT",
49        "legacy_unencumbered",
50    ],
51    license_text: [
52        "LICENSE",
53        "NOTICE",
54    ],
55}
56
57cc_library_headers {
58    name: "tensorflow_headers",
59    export_include_dirs: ["."],
60    vendor_available: true,
61    host_supported: true,
62    sdk_version: "current",
63    min_sdk_version: "apex_inherit",
64    apex_available: [
65        "//apex_available:platform",
66        "com.android.extservices",
67        "com.android.neuralnetworks",
68        "test_com.android.neuralnetworks",
69        "com.android.adservices",
70    ],
71}
72
73genrule {
74    name: "libtflite_mutable_schema",
75    tools: ["flatc"],
76    cmd: "$(location flatc) --cpp --no-union-value-namespacing --gen-object-api --gen-mutable --keep-prefix -o $$(dirname $(out)) $(in)",
77    srcs: [ "tensorflow/lite/schema/schema.fbs" ],
78    out: [ "tensorflow/lite/schema/mutable/schema_generated.h" ],
79}
80
81subdirs = ["tensorflow/lite"]
82
83filegroup {
84    name: "tensorflow_tsl_logging_srcs",
85    srcs: [
86        "tensorflow/tsl/platform/default/logging.cc",
87        "tensorflow/tsl/platform/default/env_time.cc",
88    ],
89}
90
91cc_library_static {
92    name: "TfliteNnapiDelegateTests_static",
93    srcs: [
94        "tensorflow/lite/delegates/nnapi/nnapi_delegate_test.cc",
95        "tensorflow/lite/kernels/test_delegate_providers.cc",
96        "tensorflow/lite/kernels/test_util.cc",
97        "tensorflow/lite/kernels/acceleration_test_util.cc",
98        "tensorflow/lite/kernels/acceleration_test_util_internal.cc",
99        "tensorflow/lite/delegates/nnapi/acceleration_test_list.cc",
100        "tensorflow/lite/delegates/nnapi/acceleration_test_util.cc",
101    ],
102    include_dirs: [
103        "external/flatbuffers/include",
104        "external/tensorflow",
105        "external/ruy",
106    ],
107    cflags: [
108        "-DPLATFORM_POSIX_ANDROID",
109        "-Wextra",
110        "-Wno-extern-c-compat",
111        "-Wno-sign-compare",
112        "-Wno-unused-parameter",
113        "-Wno-unused-private-field",
114    ],
115    shared_libs: [
116        "libandroid",
117        "liblog",
118        "libneuralnetworks",
119    ],
120    static_libs: [
121        "libgtest_ndk_c++",
122        "libgmock_ndk",
123        "libtflite_static",
124        "tensorflow_abseil",
125    ],
126    header_libs: [
127        "libeigen",
128        "gemmlowp_headers",
129        "libtflite_schema_headers",
130    ],
131    sdk_version: "current",
132    stl: "c++_static",
133}
134
135cc_library_static {
136    name: "libtensorflow_core_mobile_srcs_only_runtime",
137    srcs: [
138        ":tensorflow_c_srcs",
139        ":tensorflow_c_eager_srcs",
140        ":tensorflow_core_common_runtime_mobile_srcs_only_runtime",
141        ":tensorflow_core_framework_mobile_srcs_only_runtime",
142        ":tensorflow_core_framework_mobile_srcs_no_runtime",
143        ":tensorflow_core_graph_mobile_srcs_only_runtime",
144        ":tensorflow_core_util_mobile_srcs_no_runtime",
145        ":tensorflow_core_util_mobile_srcs_only_runtime",
146        ":tensorflow_core_platform_mobile_srcs_no_runtime",
147        ":tensorflow_core_platform_mobile_srcs_only_runtime",
148        ":tensorflow_core_profiler_mobile_srcs_no_runtime",
149        ":tensorflow_core_tfrt_fallback_op_kernel_runner",
150        ":tensorflow_tsl_platform_default_mobile_srcs_no_runtime",
151        ":tensorflow_tsl_platform_default_mobile_srcs_only_runtime",
152        ":tensorflow_core_lib_io_mobile_src_only_runtime",
153        ":tensorflow_core_lib_mobile_src_only_runtime",
154        ":tensorflow_core_lib_mobile_src_no_runtime",
155        "tensorflow/core/nccl/collective_communicator.cc",
156        "tensorflow/core/example/feature_util.cc",
157        "tensorflow/core/lib/wav/wav_io.cc",
158        "tensorflow/compiler/jit/defs.cc",
159    ],
160    export_include_dirs: ["."],
161    static_libs: [
162        "tensorflow_abseil",
163    ],
164    whole_static_libs: [
165        "libdoubleconversion",
166        "tensorflow_core_proto_cpp_lite",
167    ],
168    shared_libs: [
169        "libz",
170    ],
171    header_libs: [
172        "libtextclassifier_hash_headers",
173        "libeigen",
174        "tensorflow_headers",
175    ],
176    cflags: [
177        "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash",
178        "-DTF_ANDROID_ENABLE_LOGSINK",
179        "-DPLATFORM_POSIX_ANDROID",
180        "-DENABLE_ABSL_IN_TENSORFLOW",
181        "-DIS_MOBILE_PLATFORM",
182        "-DTF_ANDROID_ENABLE_LOG_EVERY_N_SECONDS",
183        "-Wno-deprecated-builtins",
184        "-Wno-deprecated-declarations",
185        "-Wno-expansion-to-defined",
186        "-Wno-ignored-qualifiers",
187        "-Wno-missing-field-initializers",
188        "-Wno-mismatched-tags",
189        "-Wno-unused-const-variable",
190        "-Wno-unused-but-set-variable",
191        "-Wno-unused-parameter",
192    ],
193    stl: "libc++_static",
194}
195
196cc_library_static {
197    name: "tflite_configuration_proto",
198    proto: {
199        type: "lite",
200        canonical_path_from_root: false,
201        export_proto_headers: true,
202    },
203    stl: "libc++",
204    srcs: ["tensorflow/lite/experimental/acceleration/configuration/**/*.proto"],
205    sdk_version: "current",
206    min_sdk_version: "30",
207    apex_available: [
208        "com.android.adservices",
209        "com.android.extservices",
210    ],
211}
212
213filegroup(
214    name = "tensorflow_core_protobuf_src",
215    srcs = [
216        "tensorflow/core/protobuf/bfc_memory_map.proto",
217        "tensorflow/core/protobuf/config.proto",
218        "tensorflow/core/protobuf/coordination_config.proto",
219        "tensorflow/core/protobuf/coordination_service.proto",
220        "tensorflow/core/protobuf/cluster.proto",
221        "tensorflow/core/protobuf/debug.proto",
222        "tensorflow/core/protobuf/device_filters.proto",
223        "tensorflow/core/protobuf/device_properties.proto",
224        "tensorflow/core/protobuf/data_service.proto",
225        "tensorflow/core/protobuf/debug_event.proto",
226        "tensorflow/core/protobuf/eager_service.proto",
227        "tensorflow/core/protobuf/graph_debug_info.proto",
228        "tensorflow/core/protobuf/queue_runner.proto",
229        "tensorflow/core/protobuf/rewriter_config.proto",
230        "tensorflow/core/protobuf/tensor_bundle.proto",
231        "tensorflow/core/protobuf/saver.proto",
232        "tensorflow/core/protobuf/verifier_config.proto",
233        "tensorflow/core/protobuf/error_codes.proto",
234        "tensorflow/core/protobuf/composite_tensor_variant.proto",
235        "tensorflow/core/protobuf/master.proto",
236        "tensorflow/core/protobuf/meta_graph.proto",
237        "tensorflow/core/protobuf/named_tensor.proto",
238        "tensorflow/core/protobuf/remote_tensor_handle.proto",
239        "tensorflow/core/protobuf/saved_model.proto",
240        "tensorflow/core/protobuf/saved_object_graph.proto",
241        "tensorflow/core/protobuf/status.proto",
242        "tensorflow/core/protobuf/struct.proto",
243        "tensorflow/core/protobuf/worker.proto",
244        "tensorflow/core/protobuf/tensorflow_server.proto",
245        "tensorflow/core/protobuf/trackable_object_graph.proto",
246        "tensorflow/core/protobuf/transport_options.proto",
247        "tensorflow/core/grappler/costs/op_performance_data.proto",
248        "tensorflow/compiler/xla/pjrt/distributed/protocol.proto",
249        "tensorflow/compiler/xla/stream_executor/dnn.proto",
250    ],
251)
252
253cc_library {
254    name: "tensorflow_core_proto_cpp_lite",
255    proto: {
256        export_proto_headers: true,
257        canonical_path_from_root: false,
258        type: "lite",
259        include_dirs: ["external/protobuf/src"],
260    },
261    srcs: [
262        "tensorflow/core/framework/*.proto",
263        "tensorflow/core/example/example.proto",
264        "tensorflow/core/example/feature.proto",
265        "tensorflow/core/example/example_parser_configuration.proto",
266        "tensorflow/core/profiler/protobuf/xplane.proto",
267        "tensorflow/core/profiler/profiler_options.proto",
268        "tensorflow/core/util/saved_tensor_slice.proto",
269        "tensorflow/core/util/event.proto",
270        ":tensorflow_core_protobuf_src",
271        ":libprotobuf-internal-protos",
272    ],
273    shared_libs: [
274        "libprotobuf-cpp-lite",
275    ],
276    export_include_dirs: ["."],
277}
278
279java_library_static {
280    name: "tensorflow_core_proto_java_lite",
281    srcs: [
282        "tensorflow/core/framework/*.proto",
283        "tensorflow/core/example/example.proto",
284        "tensorflow/core/example/feature.proto",
285        "tensorflow/core/example/example_parser_configuration.proto",
286        "tensorflow/core/profiler/protobuf/xplane.proto",
287        "tensorflow/core/profiler/profiler_options.proto",
288        "tensorflow/core/util/saved_tensor_slice.proto",
289        "tensorflow/core/util/event.proto",
290        ":tensorflow_core_protobuf_src",
291        ":libprotobuf-internal-protos",
292    ],
293    proto: {
294        canonical_path_from_root: false,
295        include_dirs: [
296            "external/protobuf/src",
297            "external/protobuf/java",
298        ],
299        type: "lite",
300    },
301    static_libs: ["libprotobuf-java-lite"],
302    sdk_version: "current",
303    min_sdk_version: "33",
304    apex_available: ["com.android.ondevicepersonalization"],
305}
306