Flutter for Azure DevOps
Flutter build task for Azure DevOps.
All credit goes to the original author for his awesome work.
This extension is a personal fork of fork of Hey24sheep.flutter on Github which is itself a fork of Alois Deniel's extension on Github.
Installation
Do not install this version. Instead, use the supported and maintained version provided by Hey24sheep at
https://marketplace.visualstudio.com/items?itemName=hey24sheep.flutter
Source Code
Source code can be found on Github.
Original repo : Github.
Thes version forked from: Github.
Usage
Add the tasks to your build definition.
Install
Installs the Flutter SDK onto the running agent if not already installed. Then uses it for following tasks.
- Select the
channel
: stable
(default), beta
, or dev
.
- Select the
version
of the SDK to install: latest
(default), custom
. If custom
is specified, a customVersion
must be set.
- (Optional). Set the
customVersion
(in a <M>.<m>.<p>
semver format) if needed.
Build
Build the given mobile application project. You must call the Flutter Install
task or use the optional flutterDirectory
task input that points to your flutter/bin
folder before execution. All application bundles are created in the build/outputs
folder of your project.
- Select the
projectDirectory
that contains the pubspec.yaml
file.
- Select the
target
platform. Options are: apk
(default), aab
, ios
, web
, all mobile
(all mobile platforms only), desktop (windows)
, desktop (macos)
, desktop (linux)
, all desktop
(all desktop platforms only) , all
(all platforms).
- (Optional). Set
flutterDirectory
to set path to the Flutter SDK if you were not using Flutter Install
task before this one
- (Optional). Set
buildName
(like 1.2.3
) that will override the manifest's one.
- (Optional). Set
buildNumber
(like 12
) that will override the manifest's one.
- (Optional). Set
buildFlavour
(like development
) to specify a build flavour. Must match Android Gradle flavor definition or XCode scheme.
- (Optional). Set
entryPoint
to override the main entry point file of the application. Default is 'lib/main.dart'.
- (Optional). Set
verboseMode
if you wish to get detailed verbose log output for diagnoses purposes. Default is false
.
- (Optional). Set
debugMode
if you wish to override the default release mode for the build. Default is false
.
- (Optional). Set
dartDefine
compile-time variables. Example: "Some_Var=Some_val --dart-define=Some_Var2=Val"
- (Optional). Set
extraArgs
if you want to pass more official/custom command arguments. Example: "--no-tree-shake-icons --publish-to-play"
- (Android).(Optional). Set
apkTargetPlatform
for the Android platform architecture target: android-arm
(default), android-arm64
.
- (Android).(Optional). Set the build mode
splitPerAbi
to compile the code into an APK per target ABI. Otherwise the build will result in a single APK.
- (iOS).(Optional). Set
iosTargetPlatform
for the iOS target: device
(default), simulator
.
- (iOS).(Optional). Set
iosCodesign
to configure whenever the bundle odesign the application bundle (only available on device builds, and activated by default). Warning: you must install a valid certificate before build with the Install an Apple Certificate
task
Test
Launch tests and publish a report as build test results.
- Select the
projectDirectory
that contains to pubspec.yaml
file.
- (Optional). Set
testName
as a regular expression matching substrings of the names of tests to run.
- (Optional). Set
testPlainName
as a plain-text substring of the names of tests to run.
- (Optional). Set
updateGoldens
: whether matchesGoldenFile()
calls within your test methods should update the golden files rather than test for an existing match.
- (Optional). Set
generateCodeCoverageReport
to generate code coverage report based on tests in the project. The report file is located in the specified projectDirectory
in coverage/lcov.info
.
- (Optional). Set
concurrency
to specify the number of concurrent test processes to run. Default is 6
.
Analyze
Launch analyze on flutter directory.
- Select the
projectDirectory
that contains the pubspec.yaml
file.
- (Optional). Set
pubGet
if you wish to run pub get
command before analyze. Default is true
.
Command
Launch a Flutter command with custom arguments.
- Set
arguments
to the argument string to pass to the flutter command.
- (Optional). Set flutterDirectory to set path to the Flutter SDK if you were not using Flutter Install task before this one
- (Optional). Select the
projectDirectory
that contains the pubspec.yaml
file.
e.g. to analyze dependencies to find which ones can be upgraded:
- task: FlutterCommand@0
displayName: 'Get packages in a Flutter project.'
inputs:
arguments: 'packages get'
FAQ
Flutter command isn't recognized ?
Make sure that you have a Flutter Install
at the beginning of your definition.
Can I run a custom Flutter command ?
Yes, right after the Flutter Install
task, a FlutterToolPath
environment variable points to the bin
of the Flutter SDK directory. You just have to use $(FlutterToolPath)
in your following tasks. Example: "$(FlutterToolPath)/flutter packages get"
Can I run Dart program ?
Yes, actually a Dart runtime is embedded with Flutter tools (in the /cache/dart-sdk/bin
subdirectory).
A task example :
- task: CmdLine@2
displayName: 'Execute Dart program'
inputs:
script: '$(FlutterToolPath)/cache/dart-sdk/bin/dart program.dart arg1 arg2'
workingDirectory: 'src'
License
MIT