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// i18n APEX is intended as a home for ICU as of July 2019.
17// Various parts and dependencies of ICU would be gradually moved into this APEX,
18// and the below build rules should reflect the latest status.
19// TODO(b/138434658): Move the apex declaration back to external/icu
20// The apex is declared in libcore/ to workaround new dependency from external/icu
21// to system/sepolicy in a downstream branch.
22package {
23    default_applicable_licenses: ["Android-Apache-2.0"],
24}
25
26apex {
27    name: "com.android.i18n",
28    defaults: ["com.android.i18n-defaults"],
29    certificate: ":com.android.i18n.certificate",
30}
31
32apex_defaults {
33    name: "com.android.i18n-defaults",
34    compile_multilib: "both",
35    manifest: "manifest.json",
36    prebuilts: ["apex_icu.dat"],
37    key: "com.android.i18n.key",
38    native_shared_libs: [
39        "libandroidicu",
40        "libicu",
41        "libicui18n",
42        "libicuuc",
43        // libicu_jni is not in jni_libs, but native_shared_libs because it's required to bootstrap
44        // the Java method System.loadLibrary.
45        "libicu_jni",
46    ],
47    bootclasspath_fragments: [
48        "i18n-bootclasspath-fragment",
49    ],
50    updatable: false,
51}
52
53apex_key {
54    name: "com.android.i18n.key",
55    public_key: "com.android.i18n.avbpubkey",
56    private_key: "com.android.i18n.pem",
57}
58
59android_app_certificate {
60    name: "com.android.i18n.certificate",
61    certificate: "com.android.i18n",
62}
63
64// The com.android.i18n's contribution to the bootclasspath.
65bootclasspath_fragment {
66    name: "i18n-bootclasspath-fragment",
67    // b/191127295: keep i18n in platform's classpath config and boot image.
68    generate_classpaths_proto: false,
69    contents: [
70        "core-icu4j",
71    ],
72    apex_available: [
73        "com.android.i18n",
74    ],
75    // The bootclasspath_fragments that provide APIs on which this depends.
76    fragments: [
77        {
78            apex: "com.android.art",
79            module: "art-bootclasspath-fragment",
80        },
81    ],
82    api: {
83        stub_libs: [
84            "i18n.module.public.api",
85        ],
86    },
87    core_platform_api: {
88        stub_libs: [
89            "legacy.i18n.module.platform.api",
90        ],
91    },
92    hidden_api: {
93        max_target_o_low_priority: [
94            "hiddenapi/hiddenapi-max-target-o-low-priority.txt",
95        ],
96
97        // This module does not contain any split packages.
98        split_packages: [],
99
100        // The following packages and all their subpackages currently only
101        // contain classes from this bootclasspath_fragment. Listing a package
102        // here won't prevent other bootclasspath modules from adding classes in
103        // any of those packages but it will prevent them from adding those
104        // classes into an API surface, e.g. public, system, etc.. Doing so will
105        // result in a build failure due to inconsistent flags.
106        package_prefixes: [
107            "android.icu",
108            "com.android.i18n.system",
109            "com.android.i18n.timezone",
110            "com.android.i18n.util",
111            "com.android.icu",
112        ],
113    },
114}
115
116// SDK exposed by the ICU module.
117sdk {
118    name: "i18n-module-sdk",
119    host_supported: true,
120    target: {
121        android: {
122            apexes: [
123                // Adds exportable dependencies of the APEX to the sdk,
124                // e.g. *classpath_fragments.
125                "com.android.i18n",
126            ],
127            java_sdk_libs: [
128                "i18n.module.intra.core.api",
129                "stable.i18n.module.platform.api",
130            ],
131        },
132    },
133    native_shared_libs: [
134        "libandroidicu",
135        "libicu",
136    ],
137}
138
139module_exports {
140    name: "i18n-module-host-exports",
141    host_supported: true,
142    device_supported: false,
143    java_libs: [
144        "timezone-host",
145    ],
146}
147
148// Additional prebuilts for running ART tests on host and device.
149module_exports {
150    name: "i18n-module-test-exports",
151    host_supported: true,
152    target: {
153        android: {
154            java_libs: [
155                // For use by robolectric and ART tests.
156                "core-icu4j-for-host",
157            ],
158        },
159    },
160    native_shared_libs: [
161        "libicui18n",
162        "libicuuc",
163        "libicu_jni",
164    ],
165}
166