diff options
| author | 2024-02-06 11:54:55 -0800 | |
|---|---|---|
| committer | 2024-02-06 11:54:55 -0800 | |
| commit | d0a2e324df5d15ede907040bdabf25905bf15ebc (patch) | |
| tree | 606be52709f22e929645b405b0db3acccebfde80 | |
| parent | 7870d329a5c21132adc16a5974f66839c1422c16 (diff) | |
Show error message when Android.mk files are found in directories in the deny list.
Bug: 318567881
Test: CIs
Test: add a Android.mk file in a blocked directory(e.g. cts/) and 'm nothing', an error message should be displayed and build process is stopped.
Change-Id: I3e1f63a13a20f77576b0e7424304a661f144df53
| -rw-r--r-- | ui/build/androidmk_denylist.go | 14 | ||||
| -rw-r--r-- | ui/build/finder.go | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/ui/build/androidmk_denylist.go b/ui/build/androidmk_denylist.go index e004cdcdf..9aeaf9d8e 100644 --- a/ui/build/androidmk_denylist.go +++ b/ui/build/androidmk_denylist.go @@ -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 - }) + } } diff --git a/ui/build/finder.go b/ui/build/finder.go index a114079ff..573df21d9 100644 --- a/ui/build/finder.go +++ b/ui/build/finder.go @@ -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) |