How hey24sheep/azure-flutter-tasks works
Project Type and Purpose
• This is an Azure DevOps extension (VSS/Marketplace) that provides a set of pipeline “tasks” to install, build, test, analyze, and run arbitrary Flutter commands on a build agent.
• It bundles several Node.js/TypeScript task implementations, a sample Flutter project for testing, CI definitions for itself, and metadata (vss-extension.json) to publish to the Marketplace.
Top-Level Components
a. Developer & CI Environment
• Source Code Repository (GitHub)
• Azure Pipelines (CI): uses azure-pipelines.yml to compile TypeScript, run unit tests in tasks/*/tests, bundle the extension, and publish to Marketplace.
b. Azure DevOps Marketplace
• Hosts the packaged .vsix extension defined by vss-extension.json.
c. Pipeline Agent
• Hosted or self-hosted machine that runs your Flutter build pipeline.
• Installs and executes the tasks delivered by the extension.
d. Flutter Tasks (each in tasks/{install,build,test,analyze,command,env})
• Node.js/TypeScript code that leverages the Azure DevOps Task SDK.
• Exposes inputs/outputs, performs CLI invocations (flutter, dart), sets environment variables, parses logs, and publishes reports.
e. Flutter SDK & Dart SDK
• Installed via the Install task (or provided by the agent).
• Made available to subsequent tasks via environment variables (FlutterToolPath, DartToolPath, FlutterPubCachePath).
f. Sample Flutter Project (sample_project)
• A reference project used by CI tests to validate tasks (e.g., running tasks/test against sample_project).
Relationships & Data Flows
1. Developer → GitHub
• Commits code, pushes to repo.
2. GitHub → Azure Pipelines CI
• Web-hook triggers CI defined in azure-pipelines.yml.
3. CI Agent
• Runs tsc-build-with-npm.sh / publish-build-with-npm.sh to compile TS to JS.
• Executes unit tests under tasks/*/tests using Node.
• Packages the extension via vss-extension.json and publishes to Marketplace (using tfx CLI).
4. Azure DevOps Marketplace
• Stores extension package.
5. User Pipeline Definition
• A consumer adds the “Flutter” tasks into their build pipeline via the Marketplace.
6. Pipeline Agent (customer)
• Downloads the extension tasks.
• Runs Install task to fetch or reuse Flutter SDK.
• Sets env-vars (FlutterToolPath, etc.) via Env task.
• Runs Build, Test, Analyze, or Command tasks in sequence, each:
• Receiving inputs (projectDirectory, target, extraArgs, etc.)
• Invoking $(FlutterToolPath)/flutter ... or $(DartToolPath)/dart ...
• Parsing output, publishing test reports, coverage, or build artifacts.
Architectural Patterns & Design Principles
• Modular Tasks: Each feature (install, build, test, analyze, command, env) is a separate module under tasks/, allowing independent versioning and testing.
• CI-driven Packaging: TypeScript sources are compiled and unit-tested in CI, ensuring integrity before publishing.
• Env Injection: Use of a dedicated Env task to set reusable env-vars for later tasks, reducing duplication.
• Sample Project Validation: A “canary” Flutter project tests the tasks end-to-end.