1// Copyright (C) 2022 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_visibility: [":__subpackages__"],
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20java_defaults {
21    name: "federatedcompute-java-defaults",
22    lint: {
23        error_checks: ["NewApi"],
24        strict_updatability_linting: true,
25    },
26    min_sdk_version: "Tiramisu ",
27}
28
29java_genrule {
30    name: "federatedcompute-fbs",
31    tools: [
32        "flatc",
33        "soong_zip",
34    ],
35    host_supported: true,
36    srcs: ["src/**/*.fbs"],
37    out: ["federatedcompute-fbs.srcjar"],
38    cmd: "$(location flatc) -o $(genDir) --java $(in) " +
39        "&& $(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
40    visibility: [
41      "//packages/modules/OnDevicePersonalization:__subpackages__"
42    ],
43}
44
45filegroup {
46    name: "federatedcompute-sources",
47    srcs: [
48        "src/**/*.java",
49        "src/**/*.aidl",
50    ],
51    path: "src",
52    visibility: [
53      "//packages/modules/OnDevicePersonalization:__subpackages__"
54    ],
55}
56
57cc_library_shared {
58    name: "libfcp_cpp_dep_jni",
59    srcs: [
60        "jni/cpp/example_iterator_wrapper_impl.cc",
61        "jni/cpp/fl_runner_jni.cc",
62        "jni/cpp/log_manager_wrapper_impl.cc",
63        "jni/cpp/simple_task_environment_wrapper_impl.cc",
64        // Add tensorflow java API jni source files
65        ":tensorflowlite_jni_src",
66    ],
67    include_dirs: [
68        "external/flatbuffers/include",
69        "external/tensorflow",
70    ],
71    version_script: "jni/jni.lds",
72    whole_static_libs: [
73        "libfederatedcompute",
74    ],
75    static_libs:[
76        "federated-compute-cc-proto-lite",
77        "libprotobuf-cpp-lite-ndk",
78    ],
79    header_libs: [
80        "libbase_headers",
81        "libnativehelper_header_only",
82        "libeigen",
83    ],
84    shared_libs: [
85        "liblog",
86        "libcrypto",
87    ],
88    stl: "libc++_static",
89    apex_available: ["com.android.ondevicepersonalization"],
90    sdk_version: "current",
91    min_sdk_version: "Tiramisu",
92    visibility: [
93        "//packages/modules/OnDevicePersonalization:__subpackages__",
94    ],
95    cflags: [
96        "-Wno-unused-parameter",
97    ],
98}
99
100cc_library_shared {
101    name: "libfcp_hpke_jni",
102    srcs: [
103        "jni/cpp/hpke_jni.cc",
104    ],
105    include_dirs: [
106        "packages/modules/OnDevicePersonalization/federatedcompute/jni/include"
107    ],
108    version_script: "jni/jni.lds",
109    header_libs: [
110        "jni_headers",
111    ],
112    shared_libs: [
113        "libcrypto",
114    ],
115    stl: "libc++_static",
116    apex_available: ["com.android.ondevicepersonalization"],
117    sdk_version: "current",
118    min_sdk_version: "Tiramisu",
119    visibility: [
120        "//packages/modules/OnDevicePersonalization:__subpackages__",
121    ],
122    cflags: [
123        "-Wno-unused-parameter",
124    ],
125}
126