blob: e7896ab2901bd3dbfc873d9838da84aa0c606e98 [file] [log] [blame]
Wei Li0d723112024-01-02 17:56:51 -08001// Copyright 2024 Google Inc. All rights reserved.
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 build
16
17import (
18 "strings"
Wei Li0d723112024-01-02 17:56:51 -080019)
20
21var androidmk_denylist []string = []string{
22 "chained_build_config/",
23 "cts/",
24 "dalvik/",
25 "developers/",
Wei Lia2924462024-01-11 12:04:40 -080026 // Do not block other directories in kernel/, see b/319658303.
27 "kernel/configs/",
28 "kernel/prebuilts/",
29 "kernel/tests/",
Wei Li0d723112024-01-02 17:56:51 -080030 "libcore/",
31 "libnativehelper/",
32 "pdk/",
Stephen Hines728bb712024-02-08 01:37:34 -080033 // Add back toolchain/ once defensive Android.mk files are removed
34 //"toolchain/",
Wei Li0d723112024-01-02 17:56:51 -080035}
36
Wei Lid0a2e322024-02-06 11:54:55 -080037func blockAndroidMks(ctx Context, androidMks []string) {
38 for _, mkFile := range androidMks {
Wei Li0d723112024-01-02 17:56:51 -080039 for _, d := range androidmk_denylist {
Wei Lid0a2e322024-02-06 11:54:55 -080040 if strings.HasPrefix(mkFile, d) {
41 ctx.Fatalf("Found blocked Android.mk file: %s. "+
42 "Please see androidmk_denylist.go for the blocked directories and contact build system team if the file should not be blocked.", mkFile)
Wei Li0d723112024-01-02 17:56:51 -080043 }
44 }
Wei Lid0a2e322024-02-06 11:54:55 -080045 }
Wei Li0d723112024-01-02 17:56:51 -080046}