diff --git a/.gitignore b/.gitignore index be028964..480a2205 100644 --- a/.gitignore +++ b/.gitignore @@ -144,4 +144,5 @@ app.*.symbols !test/*.mocks.dart !test/**/*.mocks.dart screenshots/ +!mise-tasks/screenshots/ test/failures/ diff --git a/AGENTS.md b/AGENTS.md index 67b806e4..621fbdc0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -122,8 +122,11 @@ MISE_ENV=dev ./bin/mise run build:web `test` and `analyze` automatically save output to a temp file, print the path before the run starts, and print a ready-to-use grep command at the end. Run once, grep the file as many times as needed — do not re-run to grep different things. ```bash -# Run a specific test file -./bin/mise exec flutter -- flutter test test/my_test.dart +# Run a specific test file or directory +./bin/mise run test test/widgets/drink_card_test.dart + +# Run a specific analysis path +./bin/mise run analyze lib/screens/ ``` > `TEST_LOG` and `ANALYZE_LOG` env vars let you override the temp file path if you need a stable location across multiple runs. diff --git a/mise-tasks/analyze.sh b/mise-tasks/analyze.sh new file mode 100755 index 00000000..632c795d --- /dev/null +++ b/mise-tasks/analyze.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +#MISE description="Run after Dart changes — pass a path to limit scope; grep output with the path printed at start" +#MISE depends=["generate"] + +set -uo pipefail +ANALYZE_LOG="${ANALYZE_LOG:-$(mktemp /tmp/analyze-XXXXXX.log)}" +echo "ANALYZE_LOG=$ANALYZE_LOG" +flutter analyze --no-fatal-infos "$@" 2>&1 \ + | grep -v -E "Woah! You appear|superuser privileges" \ + | tee "$ANALYZE_LOG" +EXIT_CODE=${PIPESTATUS[0]} +echo "---" +echo "Grep with: grep -n 'error\|warning' $ANALYZE_LOG" +exit "$EXIT_CODE" diff --git a/mise-tasks/build/web.sh b/mise-tasks/build/web.sh new file mode 100755 index 00000000..b903b81f --- /dev/null +++ b/mise-tasks/build/web.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +#MISE description="Build Flutter web app in release mode (for local testing/e2e)" + +set -euo pipefail +echo "Building Flutter web app in release mode..." +flutter build web --release --base-href "/" +echo "" +echo "Build complete! Output at: build/web/" +echo "" +echo "To serve locally for testing:" +echo " npx http-server build/web -p 8080" diff --git a/mise-tasks/build/web/prod b/mise-tasks/build/web/prod.sh similarity index 54% rename from mise-tasks/build/web/prod rename to mise-tasks/build/web/prod.sh index 95db87b7..51de7cfd 100755 --- a/mise-tasks/build/web/prod +++ b/mise-tasks/build/web/prod.sh @@ -7,19 +7,19 @@ echo "Building Flutter web app for production..." # Get version information if [ -x "scripts/get_version_info.sh" ]; then - echo "Gathering version information..." - eval "$(scripts/get_version_info.sh export)" + echo "Gathering version information..." + eval "$(scripts/get_version_info.sh export)" else - echo "Warning: scripts/get_version_info.sh not found, building without version info" + echo "Warning: scripts/get_version_info.sh not found, building without version info" fi # Build with version information flutter build web --release --base-href "/" \ - ${GIT_TAG:+--dart-define=GIT_TAG=$GIT_TAG} \ - ${GIT_COMMIT:+--dart-define=GIT_COMMIT=$GIT_COMMIT} \ - ${GIT_BRANCH:+--dart-define=GIT_BRANCH=$GIT_BRANCH} \ - ${BUILD_VERSION:+--dart-define=BUILD_VERSION=$BUILD_VERSION} \ - ${BUILD_TIME:+--dart-define=BUILD_TIME=$BUILD_TIME} + ${GIT_TAG:+--dart-define=GIT_TAG=$GIT_TAG} \ + ${GIT_COMMIT:+--dart-define=GIT_COMMIT=$GIT_COMMIT} \ + ${GIT_BRANCH:+--dart-define=GIT_BRANCH=$GIT_BRANCH} \ + ${BUILD_VERSION:+--dart-define=BUILD_VERSION=$BUILD_VERSION} \ + ${BUILD_TIME:+--dart-define=BUILD_TIME=$BUILD_TIME} echo "" echo "✅ Production build complete! Output at: build/web/" diff --git a/mise-tasks/coverage.sh b/mise-tasks/coverage.sh new file mode 100755 index 00000000..f8c84e83 --- /dev/null +++ b/mise-tasks/coverage.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +#MISE description="Run tests with coverage reporting (output: coverage/lcov.info)" +#MISE depends=["generate"] + +set -uo pipefail +flutter test --coverage 2>&1 | grep -v -E "Woah! You appear|superuser privileges" +EXIT_CODE=${PIPESTATUS[0]} +echo "Coverage report generated at coverage/lcov.info" +echo "To view HTML report, install lcov and run: genhtml coverage/lcov.info -o coverage/html" +exit "$EXIT_CODE" diff --git a/mise-tasks/dev.sh b/mise-tasks/dev.sh new file mode 100755 index 00000000..6309cd90 --- /dev/null +++ b/mise-tasks/dev.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +#MISE description="Start Flutter dev server on localhost:8080" + +set -euo pipefail +echo "Starting Flutter dev server on http://localhost:8080" +flutter run -d web-server --web-port 8080 --pid-file flutter-dev.pid diff --git a/mise-tasks/dev/tunnel b/mise-tasks/dev/tunnel.sh similarity index 91% rename from mise-tasks/dev/tunnel rename to mise-tasks/dev/tunnel.sh index ec5bbd15..8db19fa9 100755 --- a/mise-tasks/dev/tunnel +++ b/mise-tasks/dev/tunnel.sh @@ -21,10 +21,10 @@ echo "" # Cleanup function cleanup() { - echo "" - echo "Stopping tunnel..." - kill $TUNNEL_PID 2>/dev/null - exit + echo "" + echo "Stopping tunnel..." + kill $TUNNEL_PID 2>/dev/null + exit } # Set up cleanup on exit diff --git a/mise-tasks/screenshots/batch.sh b/mise-tasks/screenshots/batch.sh new file mode 100755 index 00000000..0fc8523c --- /dev/null +++ b/mise-tasks/screenshots/batch.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +#MISE description="Capture screenshots of multiple pages from config file" +#USAGE arg "[config]" help="Config file path" default="screenshots.config.json" +#USAGE arg "[output]" help="Output directory" default="screenshots" + +set -euo pipefail +CONFIG="${usage_config:-screenshots.config.json}" +OUTPUT="${usage_output:-screenshots}" + +echo "Running batch screenshot capture..." +echo "Config: $CONFIG" +echo "Output: $OUTPUT" +node scripts/screenshot-batch.mjs -c "$CONFIG" -o "$OUTPUT" diff --git a/mise-tasks/serve/release.sh b/mise-tasks/serve/release.sh new file mode 100755 index 00000000..de681c19 --- /dev/null +++ b/mise-tasks/serve/release.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +#MISE description="Serve release build with http-server (SPA mode for deep linking)" + +set -euo pipefail +if [ ! -d "build/web" ]; then + echo "Error: build/web directory not found" + echo "Run: MISE_ENV=dev ./bin/mise run build:web first" + exit 1 +fi + +echo "Starting http-server with SPA routing..." +echo "Available at: http://localhost:8080" +echo "Press Ctrl+C to stop" +npx http-server build/web -p 8080 --proxy http://localhost:8080? diff --git a/mise-tasks/setup/playwright b/mise-tasks/setup/playwright.sh similarity index 74% rename from mise-tasks/setup/playwright rename to mise-tasks/setup/playwright.sh index 45f104d7..a1204db5 100755 --- a/mise-tasks/setup/playwright +++ b/mise-tasks/setup/playwright.sh @@ -8,19 +8,19 @@ echo "" # Install npm dependencies if needed if [ ! -d node_modules ]; then - echo "Step 1: Installing npm dependencies..." - npm install + echo "Step 1: Installing npm dependencies..." + npm install else - echo "✓ npm dependencies already installed" + echo "✓ npm dependencies already installed" fi # Check if Playwright browsers are installed if [ ! -d ~/.cache/ms-playwright ] || [ -z "$(ls -A ~/.cache/ms-playwright 2>/dev/null)" ]; then - echo "" - echo "Step 2: Installing Playwright browsers..." - npx playwright install chromium + echo "" + echo "Step 2: Installing Playwright browsers..." + npx playwright install chromium else - echo "✓ Playwright browsers already installed" + echo "✓ Playwright browsers already installed" fi # Install system dependencies (requires sudo) diff --git a/mise-tasks/setup/tunnel b/mise-tasks/setup/tunnel.sh similarity index 68% rename from mise-tasks/setup/tunnel rename to mise-tasks/setup/tunnel.sh index cf41055b..62942e2c 100755 --- a/mise-tasks/setup/tunnel +++ b/mise-tasks/setup/tunnel.sh @@ -8,19 +8,19 @@ echo "" # Check if already logged in if [ ! -f ~/.cloudflared/cert.pem ]; then - echo "Step 1: Login to Cloudflare (browser will open)..." - cloudflared tunnel login + echo "Step 1: Login to Cloudflare (browser will open)..." + cloudflared tunnel login else - echo "✓ Already logged in to Cloudflare" + echo "✓ Already logged in to Cloudflare" fi # Check if tunnel already exists if cloudflared tunnel list 2>/dev/null | grep -q "cbf-dev-tunnel"; then - echo "✓ Tunnel 'cbf-dev-tunnel' already exists" + echo "✓ Tunnel 'cbf-dev-tunnel' already exists" else - echo "" - echo "Step 2: Creating tunnel 'cbf-dev-tunnel'..." - cloudflared tunnel create cbf-dev-tunnel + echo "" + echo "Step 2: Creating tunnel 'cbf-dev-tunnel'..." + cloudflared tunnel create cbf-dev-tunnel fi # Route DNS diff --git a/mise-tasks/shell/check.sh b/mise-tasks/shell/check.sh new file mode 100755 index 00000000..240df7c4 --- /dev/null +++ b/mise-tasks/shell/check.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +#MISE description="Run after editing any .sh or mise-tasks/ file" + +set -euo pipefail + +mapfile -t ALL_FILES < <(find . -name "*.sh" -not -path "./.git/*" -not -path "./.mise/*" -not -path "*/node_modules/*" | sort) + +if [ "${#ALL_FILES[@]}" -eq 0 ]; then + echo "No shell scripts found" + exit 0 +fi + +echo "Running shellcheck on ${#ALL_FILES[@]} files..." +shellcheck "${ALL_FILES[@]}" +echo "shellcheck passed" diff --git a/mise-tasks/shell/format.sh b/mise-tasks/shell/format.sh new file mode 100755 index 00000000..585f3da4 --- /dev/null +++ b/mise-tasks/shell/format.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +#MISE description="Run after editing any .sh or mise-tasks/ file" + +set -euo pipefail + +mapfile -t ALL_FILES < <(find . -name "*.sh" -not -path "./.git/*" -not -path "./.mise/*" -not -path "*/node_modules/*" | sort) + +if [ "${#ALL_FILES[@]}" -eq 0 ]; then + echo "No shell scripts found" + exit 0 +fi + +echo "Formatting ${#ALL_FILES[@]} files with shfmt..." +shfmt -w -i 0 -ci "${ALL_FILES[@]}" +echo "shfmt complete" diff --git a/mise-tasks/test.sh b/mise-tasks/test.sh new file mode 100755 index 00000000..8863c450 --- /dev/null +++ b/mise-tasks/test.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +#MISE description="Run before committing — pass a file arg to run a subset; grep output with the path printed at start" +#MISE depends=["generate"] + +set -uo pipefail +TEST_LOG="${TEST_LOG:-$(mktemp /tmp/test-XXXXXX.log)}" +echo "TEST_LOG=$TEST_LOG" +flutter test "$@" 2>&1 \ + | grep -v -E "Woah! You appear|superuser privileges" \ + | tee "$TEST_LOG" +EXIT_CODE=${PIPESTATUS[0]} +echo "---" +echo "Grep with: grep -n 'FAILED\|ERROR' $TEST_LOG" +exit "$EXIT_CODE" diff --git a/mise-tasks/test/check-page.sh b/mise-tasks/test/check-page.sh new file mode 100755 index 00000000..0a0a8189 --- /dev/null +++ b/mise-tasks/test/check-page.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +#MISE description="Check page for console errors and take screenshot" +#USAGE arg "[url]" help="URL to check" default="http://localhost:8080" +#USAGE arg "[screenshot]" help="Screenshot output path" default="screenshot.png" + +set -euo pipefail +URL="${usage_url:-http://localhost:8080}" +SCREENSHOT="${usage_screenshot:-screenshot.png}" + +echo "Checking page: $URL" +echo "Screenshot will be saved to: $SCREENSHOT" +node scripts/check-page.mjs -u "$URL" -s "$SCREENSHOT" diff --git a/mise-tasks/test/e2e.sh b/mise-tasks/test/e2e.sh new file mode 100755 index 00000000..145937e2 --- /dev/null +++ b/mise-tasks/test/e2e.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +#MISE description="Run e2e tests with Playwright (headless mode)" + +set -euo pipefail +echo "Running e2e tests with Playwright..." +npm run test:e2e diff --git a/mise-tasks/test/e2e/headed.sh b/mise-tasks/test/e2e/headed.sh new file mode 100755 index 00000000..1de75cb6 --- /dev/null +++ b/mise-tasks/test/e2e/headed.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +#MISE description="Run e2e tests in headed mode (visible browser)" + +set -euo pipefail +echo "Running e2e tests in headed mode..." +npm run test:e2e:headed diff --git a/mise-tasks/test/e2e/ui.sh b/mise-tasks/test/e2e/ui.sh new file mode 100755 index 00000000..6b2496a6 --- /dev/null +++ b/mise-tasks/test/e2e/ui.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +#MISE description="Run e2e tests in Playwright UI mode (interactive)" + +set -euo pipefail +echo "Running e2e tests in UI mode..." +npm run test:e2e:ui diff --git a/mise.dev.toml b/mise.dev.toml index 08242763..d999c113 100644 --- a/mise.dev.toml +++ b/mise.dev.toml @@ -14,94 +14,16 @@ # Docs: https://mise.jdx.dev/tasks/task-arguments.html # https://mise.jdx.dev/tasks/file-tasks.html -[tasks.dev] -description = "Start Flutter dev server on localhost:8080" -run = ''' -echo "Starting Flutter dev server on http://localhost:8080" -flutter run -d web-server --web-port 8080 --pid-file flutter-dev.pid -''' - -# Complex tasks moved to mise-tasks/ for better maintainability: -# - setup:tunnel -> mise-tasks/setup/tunnel -# - setup:playwright -> mise-tasks/setup/playwright -# - dev:tunnel -> mise-tasks/dev/tunnel -# - build:web:prod -> mise-tasks/build/web/prod - -[tasks."test:e2e"] -description = "Run e2e tests with Playwright (headless mode)" -run = ''' -echo "Running e2e tests with Playwright..." -npm run test:e2e -''' - -[tasks."test:e2e:ui"] -description = "Run e2e tests in Playwright UI mode (interactive)" -run = ''' -echo "Running e2e tests in UI mode..." -npm run test:e2e:ui -''' - -[tasks."test:e2e:headed"] -description = "Run e2e tests in headed mode (visible browser)" -run = ''' -echo "Running e2e tests in headed mode..." -npm run test:e2e:headed -''' - -[tasks."build:web"] -description = "Build Flutter web app in release mode (for local testing/e2e)" -run = ''' -echo "Building Flutter web app in release mode..." -flutter build web --release --base-href "/" -echo "" -echo "✅ Build complete! Output at: build/web/" -echo "" -echo "To serve locally for testing:" -echo " npx http-server build/web -p 8080" -''' - -[tasks."serve:release"] -description = "Serve release build with http-server (SPA mode for deep linking)" -run = ''' -if [ ! -d "build/web" ]; then - echo "Error: build/web directory not found" - echo "Run: mise run build:web first" - exit 1 -fi - -echo "Starting http-server with SPA routing..." -echo "Available at: http://localhost:8080" -echo "Press Ctrl+C to stop" -npx http-server build/web -p 8080 --proxy http://localhost:8080? -''' - -[tasks."test:check-page"] -description = "Check page for console errors and take screenshot" -usage = ''' -arg "[url]" help="URL to check" default="http://localhost:8080" -arg "[screenshot]" help="Screenshot output path" default="screenshot.png" -''' -run = ''' -URL="${usage_url:-http://localhost:8080}" -SCREENSHOT="${usage_screenshot:-screenshot.png}" - -echo "Checking page: $URL" -echo "Screenshot will be saved to: $SCREENSHOT" -node scripts/check-page.mjs -u "$URL" -s "$SCREENSHOT" -''' - -[tasks."screenshots:batch"] -description = "Capture screenshots of multiple pages from config file" -usage = ''' -arg "[config]" help="Config file path" default="screenshots.config.json" -arg "[output]" help="Output directory" default="screenshots" -''' -run = ''' -CONFIG="${usage_config:-screenshots.config.json}" -OUTPUT="${usage_output:-screenshots}" - -echo "Running batch screenshot capture..." -echo "Config: $CONFIG" -echo "Output: $OUTPUT" -node scripts/screenshot-batch.mjs -c "$CONFIG" -o "$OUTPUT" -''' +# All tasks moved to mise-tasks/ for better maintainability and shellcheck/shfmt support: +# - dev -> mise-tasks/dev.sh +# - test:e2e -> mise-tasks/test/e2e.sh +# - test:e2e:ui -> mise-tasks/test/e2e/ui.sh +# - test:e2e:headed -> mise-tasks/test/e2e/headed.sh +# - build:web -> mise-tasks/build/web.sh +# - serve:release -> mise-tasks/serve/release.sh +# - test:check-page -> mise-tasks/test/check-page.sh +# - screenshots:batch -> mise-tasks/screenshots/batch.sh +# - setup:tunnel -> mise-tasks/setup/tunnel.sh +# - setup:playwright -> mise-tasks/setup/playwright.sh +# - dev:tunnel -> mise-tasks/dev/tunnel.sh +# - build:web:prod -> mise-tasks/build/web/prod.sh diff --git a/mise.toml b/mise.toml index dba5cfcc..125fa326 100644 --- a/mise.toml +++ b/mise.toml @@ -5,7 +5,7 @@ # - Each task can have a 'description' (short summary) # - Tasks with arguments use 'usage' field with KDL syntax for arg/flag definitions # - Arguments become available as $usage_ env vars (e.g., $usage_file) -# - For complex tasks, consider using file-tasks in .mise/tasks/ for better editing +# - Complex tasks live in mise-tasks/ as file-tasks (shellcheck + shfmt enforced) # Docs: https://mise.jdx.dev/tasks/task-arguments.html # https://mise.jdx.dev/tasks/file-tasks.html @@ -18,6 +18,8 @@ _.path = ["./bin"] [tools] flutter = "3.38.3" node = "22" # For http_server and Playwright e2e tests +shellcheck = "0.9.0" +shfmt = "3.8.0" [deps.flutter] auto = true @@ -30,20 +32,6 @@ sources = ['test/**/*_test.dart'] # Outputs: generated mock files outputs = ['test/**/*.mocks.dart'] -[tasks.test] -description = "Run all Flutter tests (output saved to $TEST_LOG, or set TEST_LOG to reuse a path)" -depends = ['generate'] -run = ''' -#!/usr/bin/env bash -set -o pipefail -TEST_LOG="${TEST_LOG:-$(mktemp /tmp/test-XXXXXX.log)}" -echo "TEST_LOG=$TEST_LOG" -flutter test 2>&1 | tee "$TEST_LOG"; EXIT_CODE=$? -echo "---" -echo "Grep with: grep -n 'FAILED\|ERROR' $TEST_LOG" -exit $EXIT_CODE -''' - [tasks."dart:format"] description = "Format all Dart code in place (depends on generate so mock files are formatted too)" depends = ['generate'] @@ -58,13 +46,13 @@ description = "Format mise.toml" run = 'mise fmt' [tasks.format] -description = "Format all code (Dart, JS/TS, mise.toml)" -depends = ['dart:format', 'prettier:format', 'mise:format'] +description = "Format all code (Dart, JS/TS, mise.toml, shell)" +depends = ['dart:format', 'prettier:format', 'mise:format', 'shell:format'] run = 'echo "All formatting complete"' [tasks.check] -description = "Pre-commit gate: generate → format + analyze + test (run before every commit)" -depends = ['format', 'analyze', 'test'] +description = "Pre-commit gate: generate → format + analyze + test + shell:check (run before every commit)" +depends = ['format', 'analyze', 'test', 'shell:check'] run = 'echo "All checks passed"' [tasks."goldens:update"] @@ -73,29 +61,6 @@ depends = ['generate'] usage = 'arg "[file]" help="Specific test file to update"' run = 'flutter test --update-goldens ${usage_file:-}' -[tasks.coverage] -description = "Run tests with coverage reporting (output: coverage/lcov.info)" -depends = ['generate'] -run = ''' -flutter test --coverage -echo "Coverage report generated at coverage/lcov.info" -echo "To view HTML report, install lcov and run: genhtml coverage/lcov.info -o coverage/html" -''' - -[tasks.analyze] -description = "Run Flutter code analysis (output saved to $ANALYZE_LOG, or set ANALYZE_LOG to reuse a path)" -depends = ['generate'] -run = ''' -#!/usr/bin/env bash -set -o pipefail -ANALYZE_LOG="${ANALYZE_LOG:-$(mktemp /tmp/analyze-XXXXXX.log)}" -echo "ANALYZE_LOG=$ANALYZE_LOG" -flutter analyze --no-fatal-infos 2>&1 | tee "$ANALYZE_LOG"; EXIT_CODE=$? -echo "---" -echo "Grep with: grep -n 'error\|warning' $ANALYZE_LOG" -exit $EXIT_CODE -''' - [tasks."validate:festivals"] description = "Validate festivals.json against schema (mirrors CI)" dir = "scripts" diff --git a/scripts/get_version_info.sh b/scripts/get_version_info.sh index 8ce29a64..0e39bd17 100755 --- a/scripts/get_version_info.sh +++ b/scripts/get_version_info.sh @@ -17,28 +17,35 @@ BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") # If we have a tag, use it as the version (strip 'v' prefix) if [ -n "$GIT_TAG" ]; then - VERSION="${GIT_TAG#v}" + VERSION="${GIT_TAG#v}" else - # Fall back to pubspec.yaml version + commit - PUBSPEC_VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: *//' | cut -d'+' -f1) - VERSION="${PUBSPEC_VERSION}+git.${GIT_COMMIT}" + # Fall back to pubspec.yaml version + commit + PUBSPEC_VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: *//' | cut -d'+' -f1) + VERSION="${PUBSPEC_VERSION}+git.${GIT_COMMIT}" fi # Output format for GitHub Actions -if [ "$1" == "github" ]; then - echo "git_tag=$GIT_TAG" - echo "git_commit=$GIT_COMMIT" - echo "git_branch=$GIT_BRANCH" - echo "version=$VERSION" - echo "build_time=$BUILD_TIME" +if [ "$1" = "github" ]; then + echo "git_tag=$GIT_TAG" + echo "git_commit=$GIT_COMMIT" + echo "git_branch=$GIT_BRANCH" + echo "version=$VERSION" + echo "build_time=$BUILD_TIME" +# Output format for eval (used by mise-tasks/build/web/prod.sh) +elif [ "$1" = "export" ]; then + printf 'export GIT_TAG=%q\n' "$GIT_TAG" + printf 'export GIT_COMMIT=%q\n' "$GIT_COMMIT" + printf 'export GIT_BRANCH=%q\n' "$GIT_BRANCH" + printf 'export BUILD_VERSION=%q\n' "$VERSION" + printf 'export BUILD_TIME=%q\n' "$BUILD_TIME" # Output format for --dart-define flags -elif [ "$1" == "dart-define" ]; then - echo "--dart-define=GIT_TAG=$GIT_TAG --dart-define=GIT_COMMIT=$GIT_COMMIT --dart-define=GIT_BRANCH=$GIT_BRANCH --dart-define=BUILD_VERSION=$VERSION --dart-define=BUILD_TIME=$BUILD_TIME" +elif [ "$1" = "dart-define" ]; then + echo "--dart-define=GIT_TAG=$GIT_TAG --dart-define=GIT_COMMIT=$GIT_COMMIT --dart-define=GIT_BRANCH=$GIT_BRANCH --dart-define=BUILD_VERSION=$VERSION --dart-define=BUILD_TIME=$BUILD_TIME" # Output format for human reading else - echo "Version: $VERSION" - echo "Git Tag: ${GIT_TAG:-none}" - echo "Git Commit: $GIT_COMMIT" - echo "Git Branch: $GIT_BRANCH" - echo "Build Time: $BUILD_TIME" + echo "Version: $VERSION" + echo "Git Tag: ${GIT_TAG:-none}" + echo "Git Commit: $GIT_COMMIT" + echo "Git Branch: $GIT_BRANCH" + echo "Build Time: $BUILD_TIME" fi