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    generate_hashtree: false,
52}
53
54apex_key {
55    name: "com.android.i18n.key",
56    public_key: "com.android.i18n.avbpubkey",
57    private_key: "com.android.i18n.pem",
58}
59
60android_app_certificate {
61    name: "com.android.i18n.certificate",
62    certificate: "com.android.i18n",
63}
64
65// The com.android.i18n's contribution to the bootclasspath.
66bootclasspath_fragment {
67    name: "i18n-bootclasspath-fragment",
68    contents: [
69        "core-icu4j",
70    ],
71    apex_available: [
72        "com.android.i18n",
73    ],
74    // The bootclasspath_fragments that provide APIs on which this depends.
75    fragments: [
76        {
77            apex: "com.android.art",
78            module: "art-bootclasspath-fragment",
79        },
80    ],
81    api: {
82        stub_libs: [
83            "i18n.module.public.api",
84        ],
85    },
86    core_platform_api: {
87        stub_libs: [
88            "legacy.i18n.module.platform.api",
89        ],
90    },
91    hidden_api: {
92        max_target_o_low_priority: [
93            "hiddenapi/hiddenapi-max-target-o-low-priority.txt",
94        ],
95    },
96}
97
98// SDK exposed by the ICU module.
99sdk {
100    name: "i18n-module-sdk",
101    host_supported: true,
102    target: {
103        android: {
104            bootclasspath_fragments: ["i18n-bootclasspath-fragment"],
105            java_sdk_libs: [
106                "i18n.module.intra.core.api",
107                "legacy.i18n.module.platform.api",
108                "stable.i18n.module.platform.api",
109                "i18n.module.public.api",
110            ],
111        },
112    },
113    native_header_libs: [
114        "libandroidicu_headers",
115        "libicuuc_headers",
116    ],
117    native_shared_libs: [
118        "libandroidicu",
119        "libicu",
120    ],
121}
122
123module_exports {
124    name: "i18n-module-host-exports",
125    host_supported: true,
126    device_supported: false,
127    java_libs: [
128        "timezone-host",
129    ],
130}
131
132// Additional prebuilts for running ART tests on host and device.
133module_exports {
134    name: "i18n-module-test-exports",
135    host_supported: true,
136    target: {
137        android: {
138            java_libs: [
139                // For use by robolectric and ART tests.
140                "core-icu4j-for-host",
141            ],
142        },
143    },
144    native_shared_libs: [
145        "libicui18n",
146        "libicuuc",
147        "libicu_jni",
148    ],
149}
150