Merge pull request #80 from colincross/optionalremove

Make removing abandoned files optional
This commit is contained in:
colincross 2015-11-18 16:21:06 -08:00
commit 5c11f817e1
2 changed files with 12 additions and 4 deletions

View file

@ -161,10 +161,12 @@ func Main(ctx *blueprint.Context, config interface{}, extraNinjaFileDeps ...stri
}
}
srcDir := filepath.Dir(bootstrapConfig.topLevelBlueprintsFile)
err = removeAbandonedFiles(ctx, bootstrapConfig, srcDir, manifestFile)
if err != nil {
fatalf("error removing abandoned files: %s", err)
if c, ok := config.(ConfigRemoveAbandonedFiles); !ok || c.RemoveAbandonedFiles() {
srcDir := filepath.Dir(bootstrapConfig.topLevelBlueprintsFile)
err := removeAbandonedFiles(ctx, bootstrapConfig, srcDir, manifestFile)
if err != nil {
fatalf("error removing abandoned files: %s", err)
}
}
}

View file

@ -38,6 +38,12 @@ type ConfigInterface interface {
GeneratingPrimaryBuilder() bool
}
type ConfigRemoveAbandonedFiles interface {
// RemoveAbandonedFiles should return true if files listed in the
// .ninja_log but not the output build.ninja file should be deleted.
RemoveAbandonedFiles() bool
}
type Stage int
const (