tools: Shuffle go code into an idiomatic tree
main packages usually go under a `cmd` directory. Hoist utility packages to the root `src` directroy so they can be shared. Change-Id: I0c221f6cd39980f5c202c030cd5134d775533efa Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50901 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
dc4e6c1844
commit
54f4a21ee0
|
@ -22,3 +22,4 @@ third_party/llvm-build
|
|||
third_party/spirv-headers
|
||||
third_party/spirv-tools
|
||||
tools/clang
|
||||
tools/bin
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
# See https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
|
||||
|
||||
set -e # Fail on any error.
|
||||
|
||||
if [ ! -x "$(which go)" ] ; then
|
||||
echo "error: go needs to be on \$PATH to use $0"
|
||||
exit 1
|
||||
|
@ -22,9 +24,12 @@ fi
|
|||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
|
||||
ROOT_DIR="$( cd "${SCRIPT_DIR}/.." >/dev/null 2>&1 && pwd )"
|
||||
BINARY="${SCRIPT_DIR}/bin/fix-tests"
|
||||
|
||||
TARGET_EXE="$(realpath $1)"
|
||||
# Rebuild the binary.
|
||||
# Note, go caches build artifacts, so this is quick for repeat calls
|
||||
pushd "${SCRIPT_DIR}/src/cmd/fix-tests" > /dev/null
|
||||
go build -o "${BINARY}" main.go
|
||||
popd > /dev/null
|
||||
|
||||
pushd ${SCRIPT_DIR}/src/fix-tests
|
||||
go run fix-tests.go "${TARGET_EXE}"
|
||||
popd
|
||||
"${BINARY}" "$@"
|
||||
|
|
|
@ -28,7 +28,7 @@ FILES="`find src -type f` `find samples -type f`"
|
|||
|
||||
if command -v go &> /dev/null; then
|
||||
# Go is installed. Run cpplint in parallel for speed wins
|
||||
go run $SCRIPT_DIR/src/run-parallel/main.go \
|
||||
go run $SCRIPT_DIR/src/cmd/run-parallel/main.go \
|
||||
--only-print-failures \
|
||||
cpplint.py \
|
||||
--root=$ROOT_DIR \
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"dawn.googlesource.com/tint/tools/src/fix-tests/substr"
|
||||
"dawn.googlesource.com/tint/tools/src/substr"
|
||||
)
|
||||
|
||||
func main() {
|
|
@ -35,7 +35,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"dawn.googlesource.com/tint/tools/src/trim-includes/glob"
|
||||
"dawn.googlesource.com/tint/tools/src/glob"
|
||||
)
|
||||
|
||||
var (
|
|
@ -23,7 +23,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"dawn.googlesource.com/tint/tools/src/trim-includes/match"
|
||||
"dawn.googlesource.com/tint/tools/src/match"
|
||||
)
|
||||
|
||||
// Scan walks all files and subdirectories from root, returning those
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e # Fail on any error.
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
|
||||
ROOT_DIR="$( cd "${SCRIPT_DIR}/../.." >/dev/null 2>&1 && pwd )"
|
||||
|
||||
cd $ROOT_DIR
|
||||
autoninja -C out/Debug
|
||||
cd $ROOT_DIR/build
|
||||
ninja
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright 2021 The Tint Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -e # Fail on any error.
|
||||
|
||||
if [ ! -x "$(which go)" ] ; then
|
||||
echo "error: go needs to be on \$PATH to use $0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
|
||||
ROOT_DIR="$( cd "${SCRIPT_DIR}/.." >/dev/null 2>&1 && pwd )"
|
||||
BINARY="${SCRIPT_DIR}/bin/trim-includes"
|
||||
|
||||
# Rebuild the binary.
|
||||
# Note, go caches build artifacts, so this is quick for repeat calls
|
||||
pushd "${SCRIPT_DIR}/src/cmd/trim-includes" > /dev/null
|
||||
go build -o "${BINARY}" main.go
|
||||
popd > /dev/null
|
||||
|
||||
"${BINARY}" "$@"
|
Loading…
Reference in New Issue