Wei Li | 0d72311 | 2024-01-02 17:56:51 -0800 | [diff] [blame] | 1 | // 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 | |
| 15 | package build |
| 16 | |
| 17 | import ( |
| 18 | "strings" |
Wei Li | 0d72311 | 2024-01-02 17:56:51 -0800 | [diff] [blame] | 19 | ) |
| 20 | |
| 21 | var androidmk_denylist []string = []string{ |
| 22 | "chained_build_config/", |
| 23 | "cts/", |
| 24 | "dalvik/", |
| 25 | "developers/", |
Wei Li | a292446 | 2024-01-11 12:04:40 -0800 | [diff] [blame] | 26 | // Do not block other directories in kernel/, see b/319658303. |
| 27 | "kernel/configs/", |
| 28 | "kernel/prebuilts/", |
| 29 | "kernel/tests/", |
Wei Li | 0d72311 | 2024-01-02 17:56:51 -0800 | [diff] [blame] | 30 | "libcore/", |
| 31 | "libnativehelper/", |
| 32 | "pdk/", |
Stephen Hines | 728bb71 | 2024-02-08 01:37:34 -0800 | [diff] [blame] | 33 | // Add back toolchain/ once defensive Android.mk files are removed |
| 34 | //"toolchain/", |
Wei Li | 0d72311 | 2024-01-02 17:56:51 -0800 | [diff] [blame] | 35 | } |
| 36 | |
Wei Li | d0a2e32 | 2024-02-06 11:54:55 -0800 | [diff] [blame] | 37 | func blockAndroidMks(ctx Context, androidMks []string) { |
| 38 | for _, mkFile := range androidMks { |
Wei Li | 0d72311 | 2024-01-02 17:56:51 -0800 | [diff] [blame] | 39 | for _, d := range androidmk_denylist { |
Wei Li | d0a2e32 | 2024-02-06 11:54:55 -0800 | [diff] [blame] | 40 | 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 Li | 0d72311 | 2024-01-02 17:56:51 -0800 | [diff] [blame] | 43 | } |
| 44 | } |
Wei Li | d0a2e32 | 2024-02-06 11:54:55 -0800 | [diff] [blame] | 45 | } |
Wei Li | 0d72311 | 2024-01-02 17:56:51 -0800 | [diff] [blame] | 46 | } |