| # Copyright lowRISC contributors. |
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| # SPDX-License-Identifier: Apache-2.0 |
| CLANG_FORMAT=@@CLANG_FORMAT@@ |
| WORKSPACE="@@WORKSPACE@@" |
| clang_format=$(realpath "$CLANG_FORMAT") |
| if [[ ! -z "${WORKSPACE}" ]]; then |
| REPO="$(dirname "$(realpath ${WORKSPACE})")" |
| elif [[ ! -z "${BUILD_WORKSPACE_DIRECTORY+is_set}" ]]; then |
| cd ${BUILD_WORKSPACE_DIRECTORY} || exit 1 |
| echo "Neither WORKSPACE nor BUILD_WORKSPACE_DIRECTORY were set." |
| echo "If this is a test rule, add 'workspace = \"//:WORKSPACE\"' to your rule." |
| \( @@INCLUDE_PATTERNS@@ \) \ |
| diff -Naur "$f" <(${clang_format} ${f}) |
| echo "$FILES" | xargs ${clang_format} -i |
| echo "Unknown mode: $MODE" |