|
| 1 | +#!/bin/bash |
| 2 | +# Copyright 2026 Google LLC |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +set -euo pipefail |
| 17 | + |
| 18 | +CHECK_ONLY=false |
| 19 | +if [[ "${1:-}" == "--check" ]]; then |
| 20 | + CHECK_ONLY=true |
| 21 | +fi |
| 22 | + |
| 23 | +# Get repo root |
| 24 | +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" |
| 25 | +cd "$REPO_ROOT" |
| 26 | + |
| 27 | +echo "Running Prettier..." |
| 28 | +if [ "$CHECK_ONLY" = true ]; then |
| 29 | + npx -y prettier --config .prettierrc --check . |
| 30 | +else |
| 31 | + npx -y prettier --config .prettierrc --write . |
| 32 | +fi |
| 33 | + |
| 34 | +echo "Running Pyink for Python..." |
| 35 | +cd "$REPO_ROOT/agent_sdks/python" |
| 36 | +if [ "$CHECK_ONLY" = true ]; then |
| 37 | + uv run pyink --check src tests |
| 38 | +else |
| 39 | + uv run pyink src tests |
| 40 | +fi |
| 41 | + |
| 42 | +echo "Running Dart format..." |
| 43 | +cd "$REPO_ROOT" |
| 44 | +# Check if dart is available before running |
| 45 | +if command -v dart >/dev/null 2>&1; then |
| 46 | + if [ "$CHECK_ONLY" = true ]; then |
| 47 | + dart format --output=none --set-exit-if-changed . |
| 48 | + else |
| 49 | + dart format . |
| 50 | + fi |
| 51 | +else |
| 52 | + echo "Warning: dart command not found. Skipping Dart formatting." |
| 53 | +fi |
| 54 | + |
| 55 | +echo "Done." |
0 commit comments