Merge pull request #306 from danw/globs

Stop writing depfiles from Glob singleton
This commit is contained in:
Dan Willemsen 2020-06-24 14:35:11 -07:00 committed by GitHub
commit fe13954f3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,7 +21,6 @@ import (
"strings"
"github.com/google/blueprint"
"github.com/google/blueprint/deptools"
"github.com/google/blueprint/pathtools"
)
@ -130,15 +129,18 @@ func (s *globSingleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
if s.writeRule {
depFile := fileListFile + ".d"
// We need to write the file list here so that it has an older modified date
// than the build.ninja (otherwise we'd run the primary builder twice on
// every new glob)
//
// We don't need to write the depfile because we're guaranteed that ninja
// will run the command at least once (to record it into the ninja_log), so
// the depfile will be loaded from that execution.
fileList := strings.Join(g.Files, "\n") + "\n"
err := pathtools.WriteFileIfChanged(absolutePath(fileListFile), []byte(fileList), 0666)
if err != nil {
panic(fmt.Errorf("error writing %s: %s", fileListFile, err))
}
err = deptools.WriteDepFile(absolutePath(depFile), fileListFile, g.Deps)
if err != nil {
panic(fmt.Errorf("error writing %s: %s", depFile, err))
}
GlobFile(ctx, g.Pattern, g.Excludes, fileListFile, depFile)
} else {