1+ #! /usr/bin/env bash
2+
3+ set -e
4+
5+ echo " === Flutter Structurizr Development Environment Setup ==="
6+
7+ # 1. Check for Flutter installation
8+ if ! command -v flutter & > /dev/null; then
9+ echo " Flutter is not installed. Please install Flutter SDK 3.10.0+ and ensure it's in your PATH."
10+ exit 1
11+ fi
12+
13+ # 2. Check for Dart installation (should be included with Flutter)
14+ if ! command -v dart & > /dev/null; then
15+ echo " Dart is not installed. Please install Dart SDK (comes with Flutter) and ensure it's in your PATH."
16+ exit 1
17+ fi
18+
19+ # 3. Install Flutter dependencies
20+ echo " Running flutter pub get..."
21+ flutter pub get
22+
23+ # 4. Install dependencies for demo_app, example, and test_app if present
24+ for dir in demo_app example test_app; do
25+ if [ -d " $dir " ]; then
26+ echo " Running flutter pub get in $dir /..."
27+ (cd " $dir " && flutter pub get)
28+ fi
29+ done
30+
31+ # 5. Install any additional tools (e.g., lcov for coverage reports)
32+ if ! command -v lcov & > /dev/null; then
33+ echo " lcov not found. Installing lcov (for coverage reports)..."
34+ if [[ " $OSTYPE " == " linux-gnu" * ]]; then
35+ sudo apt-get update && sudo apt-get install -y lcov
36+ elif [[ " $OSTYPE " == " darwin" * ]]; then
37+ brew install lcov
38+ else
39+ echo " Please install lcov manually for your OS."
40+ fi
41+ fi
42+
43+ # 6. Run code generation (build_runner)
44+ echo " Running code generation (build_runner)..."
45+ flutter pub run build_runner build --delete-conflicting-outputs
46+
47+ # 7. (Optional) Run analyzer and tests to verify setup
48+ echo " Running flutter analyze..."
49+ flutter analyze
50+
51+ echo " Running flutter test (smoke test)..."
52+ flutter test
53+
54+ echo " === Setup complete! ==="
55+ echo " You can now start developing or running the application."
0 commit comments