xref: /aosp_15_r20/external/icu/build/icu.go (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker// Copyright (C) 2019 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 icu
16*0e209d39SAndroid Build Coastguard Worker
17*0e209d39SAndroid Build Coastguard Workerimport (
18*0e209d39SAndroid Build Coastguard Worker	"android/soong/android"
19*0e209d39SAndroid Build Coastguard Worker)
20*0e209d39SAndroid Build Coastguard Worker
21*0e209d39SAndroid Build Coastguard Workerfunc init() {
22*0e209d39SAndroid Build Coastguard Worker	host_allowlist := []string{
23*0e209d39SAndroid Build Coastguard Worker		"device/google/cuttlefish/host/commands/",
24*0e209d39SAndroid Build Coastguard Worker		"external/icu/",
25*0e209d39SAndroid Build Coastguard Worker		"external/skia",
26*0e209d39SAndroid Build Coastguard Worker		"frameworks/base/libs/hwui",
27*0e209d39SAndroid Build Coastguard Worker		"packages/modules/RuntimeI18n/apex/",
28*0e209d39SAndroid Build Coastguard Worker	}
29*0e209d39SAndroid Build Coastguard Worker
30*0e209d39SAndroid Build Coastguard Worker	device_allowlist := []string{
31*0e209d39SAndroid Build Coastguard Worker		"external/chromium-libpac",
32*0e209d39SAndroid Build Coastguard Worker		"external/icu/",
33*0e209d39SAndroid Build Coastguard Worker		"external/v8/",
34*0e209d39SAndroid Build Coastguard Worker		"packages/modules/RuntimeI18n/",
35*0e209d39SAndroid Build Coastguard Worker		// TODO(b/155921753): Restrict this when prebuilts are in their proper
36*0e209d39SAndroid Build Coastguard Worker		// locations.
37*0e209d39SAndroid Build Coastguard Worker		"prebuilts/",
38*0e209d39SAndroid Build Coastguard Worker	}
39*0e209d39SAndroid Build Coastguard Worker
40*0e209d39SAndroid Build Coastguard Worker	android.AddNeverAllowRules(
41*0e209d39SAndroid Build Coastguard Worker		android.NeverAllow().
42*0e209d39SAndroid Build Coastguard Worker			InDirectDeps("libandroidicu").
43*0e209d39SAndroid Build Coastguard Worker			WithOsClass(android.Host).
44*0e209d39SAndroid Build Coastguard Worker			NotIn(host_allowlist...).
45*0e209d39SAndroid Build Coastguard Worker			Because("libandroidicu is not intended to be used on host"),
46*0e209d39SAndroid Build Coastguard Worker		android.NeverAllow().
47*0e209d39SAndroid Build Coastguard Worker			InDirectDeps("libicuuc").
48*0e209d39SAndroid Build Coastguard Worker			WithOsClass(android.Device).
49*0e209d39SAndroid Build Coastguard Worker			NotIn(device_allowlist...).
50*0e209d39SAndroid Build Coastguard Worker			Because("libicuuc is not intended to be used on device"),
51*0e209d39SAndroid Build Coastguard Worker		android.NeverAllow().
52*0e209d39SAndroid Build Coastguard Worker			InDirectDeps("libicui18n").
53*0e209d39SAndroid Build Coastguard Worker			WithOsClass(android.Device).
54*0e209d39SAndroid Build Coastguard Worker			NotIn(device_allowlist...).
55*0e209d39SAndroid Build Coastguard Worker			Because("libicui18n is not intended to be used on device"),
56*0e209d39SAndroid Build Coastguard Worker	)
57*0e209d39SAndroid Build Coastguard Worker}
58