Handle bad rename
Cleanspec wasn't working, so let's handle it in Soong Test: create an invalid file, run m nothing, verify it is removed Change-Id: I55d3c9344541b8e504887225a660044e14204427
This commit is contained in:
parent
5d982b398e
commit
00543dc61c
1 changed files with 26 additions and 0 deletions
|
@ -289,12 +289,38 @@ func logAndSymlinkSetup(buildCtx build.Context, config build.Config) {
|
|||
}
|
||||
}
|
||||
|
||||
removeBadTargetRename(buildCtx, config)
|
||||
|
||||
// Create a source finder.
|
||||
f := build.NewSourceFinder(buildCtx, config)
|
||||
defer f.Shutdown()
|
||||
build.FindSources(buildCtx, config, f)
|
||||
}
|
||||
|
||||
func removeBadTargetRename(ctx build.Context, config build.Config) {
|
||||
log := ctx.ContextImpl.Logger
|
||||
// find bad paths
|
||||
m, err := filepath.Glob(filepath.Join(config.OutDir(), "bazel", "output", "execroot", "__main__", "bazel-out", "mixed_builds_product-*", "bin", "tools", "metalava", "metalava"))
|
||||
if err != nil {
|
||||
log.Fatalf("Glob for invalid file failed %s", err)
|
||||
}
|
||||
for _, f := range m {
|
||||
info, err := os.Stat(f)
|
||||
if err != nil {
|
||||
log.Fatalf("Stat of invalid file %q failed %s", f, err)
|
||||
}
|
||||
// if it's a directory, leave it, but remove the files
|
||||
if !info.IsDir() {
|
||||
err = os.Remove(f)
|
||||
if err != nil {
|
||||
log.Fatalf("Remove of invalid file %q failed %s", f, err)
|
||||
} else {
|
||||
log.Verbosef("Removed %q", f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func dumpVar(ctx build.Context, config build.Config, args []string) {
|
||||
logAndSymlinkSetup(ctx, config)
|
||||
flags := flag.NewFlagSet("dumpvar", flag.ExitOnError)
|
||||
|
|
Loading…
Reference in a new issue