xref: /aosp_15_r20/external/libtextclassifier/java/Android.bp (revision 993b0882672172b81d12fad7a7ac0c3e5c824a12)
1//
2// Copyright (C) 2019 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17// A standalone TextClassifierService app for testing.
18package {
19    // See: http://go/android-license-faq
20    // A large-scale-change added 'default_applicable_licenses' to import
21    // all of the 'license_kinds' from "external_libtextclassifier_license"
22    // to get the below license kinds:
23    //   SPDX-license-identifier-Apache-2.0
24    default_applicable_licenses: ["external_libtextclassifier_license"],
25}
26
27android_app {
28    name: "TextClassifierService",
29    static_libs: ["TextClassifierServiceLib"],
30    jni_libs: ["libtextclassifier"],
31    sdk_version: "system_current",
32    min_sdk_version: "30",
33    certificate: "platform",
34    optimize: {
35        proguard_flags_files: ["proguard.flags"],
36    },
37    use_embedded_native_libs: true,
38}
39
40// A library that contains all java classes with the AndroidManifest.
41android_library {
42    name: "TextClassifierServiceLib",
43    static_libs: ["TextClassifierServiceLibNoManifest"],
44    sdk_version: "system_current",
45    min_sdk_version: "30",
46    manifest: "AndroidManifest.xml",
47    aaptflags: [
48        "-0 .model",
49    ],
50}
51
52// Similar to TextClassifierServiceLib, but without the AndroidManifest.
53android_library {
54    name: "TextClassifierServiceLibNoManifest",
55    srcs: [
56        "src/**/*.java",
57        "src/**/*.aidl",
58    ],
59    manifest: "LibNoManifest_AndroidManifest.xml",
60    plugins: [
61        "auto_value_plugin",
62        "androidx.room_room-compiler-plugin",
63    ],
64    static_libs: [
65        "androidx.core_core",
66        "libtextclassifier-java",
67        "androidx.annotation_annotation",
68        "guava",
69        "textclassifier-statsd",
70        "error_prone_annotations",
71        "androidx.work_work-runtime",
72        "android_downloader_lib",
73        "textclassifier-statsd",
74        "textclassifier-java-proto-lite",
75        "androidx.concurrent_concurrent-futures",
76        "auto_value_annotations",
77        "androidx.room_room-runtime",
78    ],
79    sdk_version: "system_current",
80    min_sdk_version: "30",
81    aaptflags: [
82        "-0 .model",
83    ],
84    apex_available: [
85        "//apex_available:platform",
86        "com.android.extservices",
87    ],
88
89}
90
91java_library {
92    name: "textclassifier-statsd",
93    sdk_version: "system_current",
94    min_sdk_version: "30",
95    srcs: [
96        ":statslog-textclassifier-java-gen",
97    ],
98    apex_available: [
99        "//apex_available:platform",
100        "com.android.extservices",
101    ],
102}
103
104genrule {
105    name: "statslog-textclassifier-java-gen",
106    tools: ["stats-log-api-gen"],
107    cmd: "$(location stats-log-api-gen) --java $(out) --module textclassifier" +
108         " --javaPackage com.android.textclassifier.common.statsd" +
109         " --javaClass TextClassifierStatsLog --minApiLevel 30",
110    out: ["com/android/textclassifier/common/statsd/TextClassifierStatsLog.java"],
111}
112