Ben Clayton 95e9bf2a15 tools/run: Remove 'bin' cache
People keep on running the executable from the bin cache, wondering why stuff is out of date.

`go run` has pretty decent builtin caching, so just use that.

Change-Id: I6305a222f3f6b5b0b1ce23d7a89227aea96b9ef4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118720
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-02-04 16:15:54 +00:00

51 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2022 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.
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
TOOL="$1"
if [ ! -x "$(which go)" ] ; then
echo "error: go needs to be on \$PATH to use $0"
exit 1
fi
function list_tools() {
echo "Available tools:"
ls "${SCRIPT_DIR}/src/cmd"
}
function show_usage() {
echo "run <tool> <args>"
echo
echo "builds and runs the go tool in <dawn>/tools/src/cmd"
echo
list_tools
exit 1
}
if [ -z "${TOOL}" ]; then
show_usage
fi
if [ ! -d "${SCRIPT_DIR}/src/cmd/${TOOL}" ]; then
show_usage
fi
pushd "${SCRIPT_DIR}/src" > /dev/null
go run "./cmd/${TOOL}" "${@:2}"
popd > /dev/null