bpfmt: Process all blueprint files when a directory is specified am: a29ee638ea

Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2694306

Change-Id: I7ca72d73c24d2221176998d3d4b08b51d167887a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Rashid Zaman 2023-08-22 21:51:17 +00:00 committed by Automerger Merge Worker
commit c72a75269d

View file

@ -14,6 +14,7 @@ import (
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/google/blueprint/parser"
)
@ -110,9 +111,14 @@ func processReader(filename string, in io.Reader, out io.Writer) error {
return err
}
func isBlueprintFile(f os.FileInfo) bool {
name := f.Name()
return !f.IsDir() && (name == "Blueprints" || (!strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".bp")))
}
func walkDir(path string) {
visitFile := func(path string, f os.FileInfo, err error) error {
if err == nil && f.Name() == "Blueprints" {
if err == nil && isBlueprintFile(f) {
err = processFile(path, os.Stdout)
}
if err != nil {