1// Copyright (C) 2019 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    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "packages_modules_appsearch_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["packages_modules_appsearch_license"],
22}
23
24genrule {
25    name: "statslog-appsearch-java-gen",
26    tools: ["stats-log-api-gen"],
27    cmd: "$(location stats-log-api-gen) --java $(out) --module appsearch --javaPackage com.android.server.appsearch.stats --javaClass AppSearchStatsLog",
28    out: ["com/android/server/appsearch/stats/AppSearchStatsLog.java"],
29}
30
31java_library {
32    name: "statslog-appsearch-lib",
33    srcs: [":statslog-appsearch-java-gen"],
34    libs: [
35        // needed for restricted atoms.
36        "androidx.annotation_annotation",
37        // add StatsLog as a dependency of the generated file.
38        "framework-statsd.stubs.module_lib",
39    ],
40    sdk_version: "system_server_current",
41    min_sdk_version: "Tiramisu",
42    apex_available: ["com.android.appsearch"],
43}
44
45java_defaults {
46    name: "service-appsearch-defaults",
47    srcs: [
48        "java/**/*.java",
49    ],
50    sdk_version: "system_server_current",
51    min_sdk_version: "Tiramisu",
52    static_libs: [
53        "icing-java-proto-lite",
54        "libicing-java",
55        "statslog-appsearch-lib",
56
57        // Entries below this line are outside of the appsearch package tree and must be kept in
58        // sync with jarjar.txt
59        "appsearch_flags_java_lib",
60        "modules-utils-preconditions",
61    ],
62    libs: [
63        "framework-appsearch.impl",
64        "framework-configinfrastructure.stubs.module_lib",
65        "framework-permission-s.stubs.module_lib",
66        "framework-statsd.stubs.module_lib",
67    ],
68    optimize: {
69        proguard_flags_files: ["proguard.flags"],
70    },
71    defaults: [
72        "framework-system-server-module-defaults",
73        "framework-system-server-module-optimize-defaults",
74    ],
75    permitted_packages: [
76        "com.android.server.appsearch",
77        "com.google.android.icing",
78    ],
79    jarjar_rules: "jarjar-rules.txt",
80    visibility: [
81        // These are required until appsearch is properly unbundled.
82        "//frameworks/base/services/tests/mockingservicestests",
83        "//frameworks/base/services/tests/servicestests",
84    ],
85    apex_available: ["com.android.appsearch"],
86}
87
88// A special library created strictly for use by the tests as they need the implementation library
89// but that is not available when building from prebuilts. Using a library with a different name to
90// what is used by the prebuilts ensures that this will never depend on the prebuilt.
91// Switching service-appsearch to a java_sdk_library would also have worked as that has built in
92// support for managing this but that is too big a change at this point.
93java_library {
94    name: "service-appsearch-for-tests",
95    defaults: ["service-appsearch-defaults"],
96}
97
98java_library {
99    name: "service-appsearch",
100    defaults: ["service-appsearch-defaults"],
101    installable: true,
102}
103