xref: /aosp_15_r20/external/icu/build/icu.go (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1// Copyright (C) 2019 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package icu
16
17import (
18	"android/soong/android"
19)
20
21func init() {
22	host_allowlist := []string{
23		"device/google/cuttlefish/host/commands/",
24		"external/icu/",
25		"external/skia",
26		"frameworks/base/libs/hwui",
27		"packages/modules/RuntimeI18n/apex/",
28	}
29
30	device_allowlist := []string{
31		"external/chromium-libpac",
32		"external/icu/",
33		"external/v8/",
34		"packages/modules/RuntimeI18n/",
35		// TODO(b/155921753): Restrict this when prebuilts are in their proper
36		// locations.
37		"prebuilts/",
38	}
39
40	android.AddNeverAllowRules(
41		android.NeverAllow().
42			InDirectDeps("libandroidicu").
43			WithOsClass(android.Host).
44			NotIn(host_allowlist...).
45			Because("libandroidicu is not intended to be used on host"),
46		android.NeverAllow().
47			InDirectDeps("libicuuc").
48			WithOsClass(android.Device).
49			NotIn(device_allowlist...).
50			Because("libicuuc is not intended to be used on device"),
51		android.NeverAllow().
52			InDirectDeps("libicui18n").
53			WithOsClass(android.Device).
54			NotIn(device_allowlist...).
55			Because("libicui18n is not intended to be used on device"),
56	)
57}
58