• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2023 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_federated_compute_license"],
17}
18
19license {
20    name: "external_federated_compute_license",
21    visibility: [":__subpackages__"],
22    license_kinds: [
23        "SPDX-license-identifier-Apache-2.0",
24    ],
25    license_text: [
26        "LICENSE",
27    ],
28}
29
30cc_library_headers {
31    name: "libfederatedcompute_headers",
32    export_include_dirs: ["."],
33    sdk_version: "current",
34    min_sdk_version: "33",
35    apex_available: ["com.android.ondevicepersonalization"],
36}
37
38java_library_static {
39    name: "federated-compute-java-proto-lite",
40    proto: {
41        type: "lite",
42        canonical_path_from_root: false,
43        include_dirs: [
44            "external/protobuf/src",
45            "external/protobuf/java",
46            "external/tensorflow",
47        ],
48    },
49    srcs: [
50        "fcp/protos/ondevicepersonalization/task_assignments.proto",
51        "fcp/protos/ondevicepersonalization/eligibility_spec.proto",
52        "fcp/protos/federatedcompute/common.proto",
53        "fcp/protos/plan.proto",
54        "fcp/client/**/*.proto",
55        ":libprotobuf-internal-protos",
56    ],
57    static_libs: [
58        "libprotobuf-java-lite",
59        "tensorflow_core_proto_java_lite",
60    ],
61    sdk_version: "current",
62    min_sdk_version: "33",
63    apex_available: ["com.android.ondevicepersonalization"],
64}
65
66cc_library {
67    name: "federated-compute-cc-proto-lite",
68    srcs: [
69        "fcp/secagg/shared/secagg_messages.proto",
70        "fcp/secagg/server/secagg_server_enums.proto",
71        "fcp/client/**/*.proto",
72        "fcp/protos/**/*.proto",
73        "fcp/dictionary/*.proto",
74        ":libprotobuf-internal-protos",
75    ],
76    proto: {
77        type: "lite",
78        export_proto_headers: true,
79        canonical_path_from_root: false,
80        include_dirs: [
81            "external/protobuf/src",
82            "external/tensorflow",
83        ],
84    },
85    static_libs: [
86        "tensorflow_core_proto_cpp_lite",
87    ],
88    shared_libs: [
89        "liblog",
90    ],
91    stl: "libc++_static",
92    apex_available: ["com.android.ondevicepersonalization"],
93    sdk_version: "current",
94    min_sdk_version: "33",
95}
96
97cc_library_static {
98    name: "libfederatedcompute",
99    srcs: [
100        "fcp/client/fcp_runner.cc",
101        "fcp/client/interruptible_runner.cc",
102        "fcp/client/simple_task_environment.cc",
103        "fcp/client/engine/*.cc",
104        "fcp/tensorflow/*.cc",
105        "fcp/dictionary/dictionary.cc",
106        "fcp/base/base_name.cc",
107        "fcp/base/monitoring.cc",
108        "fcp/base/platform.cc",
109        "fcp/base/clock.cc",
110        "fcp/base/random_token.cc",
111        "fcp/base/scheduler.cc",
112    ],
113    exclude_srcs: [
114        "fcp/**/*test*.cc",
115        "fcp/client/fake_*.cc",
116        // Exclude tfmobile engine dependencies.
117        "fcp/client/engine/tf_wrapper.cc",
118        "fcp/client/engine/simple_plan_engine.cc",
119        "fcp/tensorflow/tf_session.cc",
120    ],
121    static_libs: [
122        "federated-compute-cc-proto-lite",
123    ],
124    whole_static_libs: [
125        "libtflite_flex_delegate",
126    ],
127    export_include_dirs: ["."],
128    header_libs: [
129        "flatbuffer_headers",
130        "libeigen",
131        "libtextclassifier_hash_headers",
132    ],
133    shared_libs: [
134        "libcrypto",
135    ],
136    visibility: [
137        "//packages/modules/OnDevicePersonalization:__subpackages__",
138    ],
139    cflags: [
140        "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash",
141        "-Wno-ignored-qualifiers",
142        "-Wno-unused-parameter",
143        "-Wno-missing-field-initializers",
144        "-Wno-defaulted-function-deleted",
145        "-Wno-deprecated-declarations",
146    ],
147    stl: "libc++_static",
148    sdk_version: "current",
149    apex_available: ["com.android.ondevicepersonalization"],
150    min_sdk_version: "33",
151}
152
153filegroup {
154    name: "fcp_native_wrapper",
155    srcs: ["fcp/java_src/main/java/com/google/fcp/client/CallFromNativeWrapper.java"],
156    visibility: [
157        "//packages/modules/OnDevicePersonalization:__subpackages__",
158    ],
159}
160
161filegroup {
162    name: "fcp_artifacts_testdata",
163    srcs: [
164        "fcp/testdata/federation_client_only_plan.pb",
165        "fcp/testdata/federation_proxy_train_examples.pb",
166        "fcp/testdata/federation_test_checkpoint.client.ckp",
167        "fcp/testdata/federation_test_select_checkpoints.pb",
168    ],
169    visibility: [
170        "//packages/modules/OnDevicePersonalization:__subpackages__",
171    ],
172}
173
174cc_test {
175    name: "fcp_plan_engine_test",
176    srcs: [
177        "fcp/client/engine/tflite_plan_engine_test.cc",
178        "fcp/client/engine/example_query_plan_engine_test.cc",
179        "fcp/tensorflow/file_descriptor_filesystem_test.cc",
180        "fcp/client/test_helpers.cc",
181    ],
182    test_suites: [
183        "general-tests",
184    ],
185    static_libs: [
186        "federated-compute-cc-proto-lite",
187        "libgmock",
188        "libbase_ndk",
189        "libprotobuf-cpp-lite-ndk",
190        "liblog",
191        "tensorflow_abseil",
192    ],
193    whole_static_libs: [
194        "libfederatedcompute",
195    ],
196    shared_libs: [
197        "libcurl",
198        "libcrypto",
199    ],
200    header_libs: [
201        "libeigen",
202    ],
203    stl: "libc++_static",
204    data: [
205        "fcp/testdata/federation_client_only_plan.pb",
206        "fcp/testdata/federation_proxy_train_examples.pb",
207        "fcp/testdata/federation_test_checkpoint.client.ckp",
208        "fcp/testdata/federation_test_select_checkpoints.pb",
209    ],
210    cflags: [
211        "-Wno-unused-parameter",
212        "-Wno-ignored-qualifiers",
213        "-Wno-missing-field-initializers",
214    ],
215}
216