tools/gen: Add flags for explicit output

`-o` will emit the files to the given root output directory
`--verbose` will print what's going on, to help with debugging

Omitting these flags will behave as before.

Also consolidate the utils package into fileutils. These were two packages with near identical functionality.

Change-Id: I855dd4b57807fb9239a52e7f357842d4ba2517ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107687
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton
2022-10-31 18:28:22 +00:00
committed by Dawn LUCI CQ
parent 6dbb463f1d
commit 68ed8d92d3
17 changed files with 192 additions and 234 deletions

View File

@@ -39,7 +39,7 @@ import (
"time"
"unicode/utf8"
"dawn.googlesource.com/dawn/tools/src/utils"
"dawn.googlesource.com/dawn/tools/src/fileutils"
"github.com/mattn/go-colorable"
"github.com/mattn/go-isatty"
)
@@ -1174,7 +1174,7 @@ func saveExpectations(path string, ex testcaseStatuses) error {
// directory, falling back to PATH. This is used as the default for the --node
// command line flag.
func defaultNodePath() string {
if dawnRoot := utils.DawnRoot(); dawnRoot != "" {
if dawnRoot := fileutils.DawnRoot(); dawnRoot != "" {
node := filepath.Join(dawnRoot, "third_party/node")
if info, err := os.Stat(node); err == nil && info.IsDir() {
path := ""
@@ -1204,7 +1204,7 @@ func defaultNodePath() string {
// defaultCtsPath looks for the webgpu-cts directory in dawn's third_party
// directory. This is used as the default for the --cts command line flag.
func defaultCtsPath() string {
if dawnRoot := utils.DawnRoot(); dawnRoot != "" {
if dawnRoot := fileutils.DawnRoot(); dawnRoot != "" {
cts := filepath.Join(dawnRoot, "third_party/webgpu-cts")
if info, err := os.Stat(cts); err == nil && info.IsDir() {
return cts