Sanity check the tree before building.

Check for the presence of Android.mk or CleanSpec.mk, which
are somewhat common problems.

Bug: 113147143
Test: m (with and without files present)
Change-Id: I31cf60c325e7f6c6fce7aec54712c1cb802055c2
This commit is contained in:
Anton Hansson
2018-09-19 22:14:17 +01:00
parent 5d45c6f6f8
commit ecf0f10d3d

View File

@@ -71,6 +71,17 @@ const (
BuildAll = BuildProductConfig | BuildSoong | BuildKati | BuildNinja
)
func checkProblematicFiles(ctx Context) {
files := []string{"Android.mk", "CleanSpec.mk"}
for _, file := range files {
if _, err := os.Stat(file); !os.IsNotExist(err) {
absolute := absPath(ctx, file)
ctx.Printf("Found %s in tree root. This file needs to be removed to build.\n", file)
ctx.Fatalf(" rm %s\n", absolute)
}
}
}
func checkCaseSensitivity(ctx Context, config Config) {
outDir := config.OutDir()
lowerCase := filepath.Join(outDir, "casecheck.txt")
@@ -131,6 +142,8 @@ func Build(ctx Context, config Config, what int) {
buildLock := BecomeSingletonOrFail(ctx, config)
defer buildLock.Unlock()
checkProblematicFiles(ctx)
SetupOutDir(ctx, config)
checkCaseSensitivity(ctx, config)