Merge "Show error message when Android.mk files are found in directories in the deny list." into main am: 070e4d47d2

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2954227

Change-Id: Iac58c8fdaf2c54cbd6ccaee31558fe12062c76b7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Wei Li 2024-02-07 23:30:25 +00:00 committed by Automerger Merge Worker
commit 82e557e5e3
2 changed files with 7 additions and 9 deletions

View file

@ -16,8 +16,6 @@ package build
import (
"strings"
"android/soong/android"
)
var androidmk_denylist []string = []string{
@ -35,13 +33,13 @@ var androidmk_denylist []string = []string{
"toolchain/",
}
func blockAndroidMks(androidMks []string) []string {
return android.FilterListPred(androidMks, func(s string) bool {
func blockAndroidMks(ctx Context, androidMks []string) {
for _, mkFile := range androidMks {
for _, d := range androidmk_denylist {
if strings.HasPrefix(s, d) {
return false
if strings.HasPrefix(mkFile, d) {
ctx.Fatalf("Found blocked Android.mk file: %s. "+
"Please see androidmk_denylist.go for the blocked directories and contact build system team if the file should not be blocked.", mkFile)
}
}
return true
})
}
}

View file

@ -128,7 +128,7 @@ func FindSources(ctx Context, config Config, f *finder.Finder) {
// Stop searching a subdirectory recursively after finding an Android.mk.
androidMks := f.FindFirstNamedAt(".", "Android.mk")
androidMks = blockAndroidMks(androidMks)
blockAndroidMks(ctx, androidMks)
err := dumpListToFile(ctx, config, androidMks, filepath.Join(dumpDir, "Android.mk.list"))
if err != nil {
ctx.Fatalf("Could not export module list: %v", err)