xref: /aosp_15_r20/external/icu/Android.bp (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker// Copyright (C) 2020 The Android Open Source Project
2*0e209d39SAndroid Build Coastguard Worker//
3*0e209d39SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*0e209d39SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*0e209d39SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*0e209d39SAndroid Build Coastguard Worker//
7*0e209d39SAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
8*0e209d39SAndroid Build Coastguard Worker//
9*0e209d39SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*0e209d39SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*0e209d39SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*0e209d39SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*0e209d39SAndroid Build Coastguard Worker// limitations under the License.
14*0e209d39SAndroid Build Coastguard Worker
15*0e209d39SAndroid Build Coastguard Workerpackage {
16*0e209d39SAndroid Build Coastguard Worker    default_team: "trendy_team_java_core_libraries",
17*0e209d39SAndroid Build Coastguard Worker    default_applicable_licenses: ["external_icu_license"],
18*0e209d39SAndroid Build Coastguard Worker}
19*0e209d39SAndroid Build Coastguard Worker
20*0e209d39SAndroid Build Coastguard Worker// Added automatically by a large-scale-change that took the approach of
21*0e209d39SAndroid Build Coastguard Worker// 'apply every license found to every target'. While this makes sure we respect
22*0e209d39SAndroid Build Coastguard Worker// every license restriction, it may not be entirely correct.
23*0e209d39SAndroid Build Coastguard Worker//
24*0e209d39SAndroid Build Coastguard Worker// e.g. GPL in an MIT project might only apply to the contrib/ directory.
25*0e209d39SAndroid Build Coastguard Worker//
26*0e209d39SAndroid Build Coastguard Worker// Please consider splitting the single license below into multiple licenses,
27*0e209d39SAndroid Build Coastguard Worker// taking care not to lose any license_kind information, and overriding the
28*0e209d39SAndroid Build Coastguard Worker// default license using the 'licenses: [...]' property on targets as needed.
29*0e209d39SAndroid Build Coastguard Worker//
30*0e209d39SAndroid Build Coastguard Worker// For unused files, consider creating a 'fileGroup' with "//visibility:private"
31*0e209d39SAndroid Build Coastguard Worker// to attach the license to, and including a comment whether the files may be
32*0e209d39SAndroid Build Coastguard Worker// used in the current project.
33*0e209d39SAndroid Build Coastguard Worker// See: http://go/android-license-faq
34*0e209d39SAndroid Build Coastguard Workerlicense {
35*0e209d39SAndroid Build Coastguard Worker    name: "external_icu_license",
36*0e209d39SAndroid Build Coastguard Worker    visibility: [":__subpackages__"],
37*0e209d39SAndroid Build Coastguard Worker    license_kinds: [
38*0e209d39SAndroid Build Coastguard Worker        "SPDX-license-identifier-Apache-2.0",
39*0e209d39SAndroid Build Coastguard Worker        "SPDX-license-identifier-BSD",
40*0e209d39SAndroid Build Coastguard Worker        "SPDX-license-identifier-EPL",
41*0e209d39SAndroid Build Coastguard Worker        "SPDX-license-identifier-ICU",
42*0e209d39SAndroid Build Coastguard Worker        "SPDX-license-identifier-ISC",
43*0e209d39SAndroid Build Coastguard Worker        "SPDX-license-identifier-MIT",
44*0e209d39SAndroid Build Coastguard Worker        "SPDX-license-identifier-Unicode-3.0",
45*0e209d39SAndroid Build Coastguard Worker        "legacy_unencumbered",
46*0e209d39SAndroid Build Coastguard Worker    ],
47*0e209d39SAndroid Build Coastguard Worker    license_text: [
48*0e209d39SAndroid Build Coastguard Worker        "LICENSE",
49*0e209d39SAndroid Build Coastguard Worker    ],
50*0e209d39SAndroid Build Coastguard Worker}
51*0e209d39SAndroid Build Coastguard Worker
52*0e209d39SAndroid Build Coastguard Workerfilegroup {
53*0e209d39SAndroid Build Coastguard Worker    name: "icu_license",
54*0e209d39SAndroid Build Coastguard Worker    visibility: [
55*0e209d39SAndroid Build Coastguard Worker        "//external/icu:__subpackages__",
56*0e209d39SAndroid Build Coastguard Worker    ],
57*0e209d39SAndroid Build Coastguard Worker    srcs: ["LICENSE"],
58*0e209d39SAndroid Build Coastguard Worker}
59*0e209d39SAndroid Build Coastguard Worker
60*0e209d39SAndroid Build Coastguard Workercc_defaults {
61*0e209d39SAndroid Build Coastguard Worker    name: "icu4c_defaults",
62*0e209d39SAndroid Build Coastguard Worker    cflags: [
63*0e209d39SAndroid Build Coastguard Worker        "-Wall",
64*0e209d39SAndroid Build Coastguard Worker        "-Werror",
65*0e209d39SAndroid Build Coastguard Worker        // Make all warnings into errors, but ignore a set of warnings used in headers by default.
66*0e209d39SAndroid Build Coastguard Worker        "-Wno-ambiguous-reversed-operator",
67*0e209d39SAndroid Build Coastguard Worker        "-Wno-deprecated-declarations",
68*0e209d39SAndroid Build Coastguard Worker        "-Wno-unused-parameter",
69*0e209d39SAndroid Build Coastguard Worker        "-Wno-unused-const-variable",
70*0e209d39SAndroid Build Coastguard Worker        "-Wno-unneeded-internal-declaration",
71*0e209d39SAndroid Build Coastguard Worker        "-DUCONFIG_USE_ML_PHRASE_BREAKING=1",
72*0e209d39SAndroid Build Coastguard Worker    ],
73*0e209d39SAndroid Build Coastguard Worker    target: {
74*0e209d39SAndroid Build Coastguard Worker        android: {
75*0e209d39SAndroid Build Coastguard Worker            cflags: [
76*0e209d39SAndroid Build Coastguard Worker                // Require this flag to compile against libicuuc and libicui18n
77*0e209d39SAndroid Build Coastguard Worker                "-DANDROID_LINK_SHARED_ICU4C",
78*0e209d39SAndroid Build Coastguard Worker            ],
79*0e209d39SAndroid Build Coastguard Worker        },
80*0e209d39SAndroid Build Coastguard Worker        // Windows build required by layoutlib
81*0e209d39SAndroid Build Coastguard Worker        windows: {
82*0e209d39SAndroid Build Coastguard Worker            enabled: true,
83*0e209d39SAndroid Build Coastguard Worker        },
84*0e209d39SAndroid Build Coastguard Worker    },
85*0e209d39SAndroid Build Coastguard Worker}
86*0e209d39SAndroid Build Coastguard Worker
87*0e209d39SAndroid Build Coastguard Workeraconfig_declarations {
88*0e209d39SAndroid Build Coastguard Worker    name: "icu_aconfig_flags",
89*0e209d39SAndroid Build Coastguard Worker    package: "com.android.icu",
90*0e209d39SAndroid Build Coastguard Worker    container: "system",
91*0e209d39SAndroid Build Coastguard Worker    srcs: [
92*0e209d39SAndroid Build Coastguard Worker        "icu.aconfig",
93*0e209d39SAndroid Build Coastguard Worker    ],
94*0e209d39SAndroid Build Coastguard Worker}
95*0e209d39SAndroid Build Coastguard Worker
96*0e209d39SAndroid Build Coastguard Workerjava_aconfig_library {
97*0e209d39SAndroid Build Coastguard Worker    name: "icu_aconfig_flags_lib",
98*0e209d39SAndroid Build Coastguard Worker    aconfig_declarations: "icu_aconfig_flags",
99*0e209d39SAndroid Build Coastguard Worker    host_supported: true,
100*0e209d39SAndroid Build Coastguard Worker    // "fake_device_config" is needed for the host.
101*0e209d39SAndroid Build Coastguard Worker    libs: [
102*0e209d39SAndroid Build Coastguard Worker        "fake_device_config",
103*0e209d39SAndroid Build Coastguard Worker        "aconfig-annotations-lib-sdk-none",
104*0e209d39SAndroid Build Coastguard Worker        "aconfig_storage_stub_none",
105*0e209d39SAndroid Build Coastguard Worker        "unsupportedappusage-sdk-none",
106*0e209d39SAndroid Build Coastguard Worker    ],
107*0e209d39SAndroid Build Coastguard Worker    apex_available: [
108*0e209d39SAndroid Build Coastguard Worker        "//apex_available:platform",
109*0e209d39SAndroid Build Coastguard Worker        "com.android.i18n",
110*0e209d39SAndroid Build Coastguard Worker    ],
111*0e209d39SAndroid Build Coastguard Worker    sdk_version: "none",
112*0e209d39SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
113*0e209d39SAndroid Build Coastguard Worker}
114