Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ec2d5833
Commit
ec2d5833
authored
Jan 10, 2020
by
Emmanuel Garcia
Committed by
Flutter GitHub Bot
Jan 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make subcommands return success instead of null (#48100)
parent
a8c5f4e8
Changes
48
Hide whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
165 additions
and
83 deletions
+165
-83
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+1
-2
assemble.dart
packages/flutter_tools/lib/src/commands/assemble.dart
+1
-1
attach.dart
packages/flutter_tools/lib/src/commands/attach.dart
+1
-1
build_aar.dart
packages/flutter_tools/lib/src/commands/build_aar.dart
+1
-1
build_aot.dart
packages/flutter_tools/lib/src/commands/build_aot.dart
+1
-1
build_apk.dart
packages/flutter_tools/lib/src/commands/build_apk.dart
+1
-1
build_appbundle.dart
packages/flutter_tools/lib/src/commands/build_appbundle.dart
+1
-1
build_bundle.dart
packages/flutter_tools/lib/src/commands/build_bundle.dart
+1
-1
build_fuchsia.dart
packages/flutter_tools/lib/src/commands/build_fuchsia.dart
+1
-1
build_ios.dart
packages/flutter_tools/lib/src/commands/build_ios.dart
+1
-1
build_ios_framework.dart
...s/flutter_tools/lib/src/commands/build_ios_framework.dart
+1
-2
build_linux.dart
packages/flutter_tools/lib/src/commands/build_linux.dart
+1
-1
build_macos.dart
packages/flutter_tools/lib/src/commands/build_macos.dart
+1
-1
build_web.dart
packages/flutter_tools/lib/src/commands/build_web.dart
+1
-1
build_windows.dart
packages/flutter_tools/lib/src/commands/build_windows.dart
+1
-1
channel.dart
packages/flutter_tools/lib/src/commands/channel.dart
+2
-2
config.dart
packages/flutter_tools/lib/src/commands/config.dart
+3
-3
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+2
-3
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+1
-1
devices.dart
packages/flutter_tools/lib/src/commands/devices.dart
+1
-1
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+1
-1
emulators.dart
packages/flutter_tools/lib/src/commands/emulators.dart
+1
-1
format.dart
packages/flutter_tools/lib/src/commands/format.dart
+1
-1
generate.dart
packages/flutter_tools/lib/src/commands/generate.dart
+3
-3
ide_config.dart
packages/flutter_tools/lib/src/commands/ide_config.dart
+2
-2
inject_plugins.dart
packages/flutter_tools/lib/src/commands/inject_plugins.dart
+1
-1
install.dart
packages/flutter_tools/lib/src/commands/install.dart
+1
-1
logs.dart
packages/flutter_tools/lib/src/commands/logs.dart
+1
-1
make_host_app_editable.dart
...lutter_tools/lib/src/commands/make_host_app_editable.dart
+1
-1
packages.dart
packages/flutter_tools/lib/src/commands/packages.dart
+5
-5
precache.dart
packages/flutter_tools/lib/src/commands/precache.dart
+1
-1
screenshot.dart
packages/flutter_tools/lib/src/commands/screenshot.dart
+4
-4
shell_completion.dart
...ages/flutter_tools/lib/src/commands/shell_completion.dart
+2
-2
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+1
-1
train.dart
packages/flutter_tools/lib/src/commands/train.dart
+1
-1
unpack.dart
packages/flutter_tools/lib/src/commands/unpack.dart
+1
-1
update_packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+4
-4
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+3
-4
version.dart
packages/flutter_tools/lib/src/commands/version.dart
+1
-1
events.dart
packages/flutter_tools/lib/src/reporting/events.dart
+3
-1
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+20
-8
upgrade_test.dart
...ter_tools/test/commands.shard/permeable/upgrade_test.dart
+4
-4
build_aar_test.dart
...ter_tools/test/general.shard/commands/build_aar_test.dart
+23
-1
build_apk_test.dart
...ter_tools/test/general.shard/commands/build_apk_test.dart
+22
-1
build_appbundle_test.dart
...ols/test/general.shard/commands/build_appbundle_test.dart
+22
-1
crash_reporting_test.dart
...lutter_tools/test/general.shard/crash_reporting_test.dart
+1
-1
flutter_command_test.dart
...tools/test/general.shard/runner/flutter_command_test.dart
+10
-2
utils.dart
packages/flutter_tools/test/general.shard/runner/utils.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
ec2d5833
...
@@ -88,7 +88,6 @@ class AnalyzeCommand extends FlutterCommand {
...
@@ -88,7 +88,6 @@ class AnalyzeCommand extends FlutterCommand {
runner
.
getRepoRoots
(),
runner
.
getRepoRoots
(),
runner
.
getRepoPackages
(),
runner
.
getRepoPackages
(),
).
analyze
();
).
analyze
();
return
null
;
}
else
{
}
else
{
await
AnalyzeOnce
(
await
AnalyzeOnce
(
argResults
,
argResults
,
...
@@ -96,7 +95,7 @@ class AnalyzeCommand extends FlutterCommand {
...
@@ -96,7 +95,7 @@ class AnalyzeCommand extends FlutterCommand {
runner
.
getRepoPackages
(),
runner
.
getRepoPackages
(),
workingDirectory:
workingDirectory
,
workingDirectory:
workingDirectory
,
).
analyze
();
).
analyze
();
return
null
;
}
}
return
FlutterCommandResult
.
success
();
}
}
}
}
packages/flutter_tools/lib/src/commands/assemble.dart
View file @
ec2d5833
...
@@ -200,7 +200,7 @@ class AssembleCommand extends FlutterCommand {
...
@@ -200,7 +200,7 @@ class AssembleCommand extends FlutterCommand {
final
Depfile
depfile
=
Depfile
(
result
.
inputFiles
,
result
.
outputFiles
);
final
Depfile
depfile
=
Depfile
(
result
.
inputFiles
,
result
.
outputFiles
);
depfile
.
writeToFile
(
globals
.
fs
.
file
(
depfileFile
));
depfile
.
writeToFile
(
globals
.
fs
.
file
(
depfileFile
));
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
...
...
packages/flutter_tools/lib/src/commands/attach.dart
View file @
ec2d5833
...
@@ -178,7 +178,7 @@ class AttachCommand extends FlutterCommand {
...
@@ -178,7 +178,7 @@ class AttachCommand extends FlutterCommand {
Artifacts:
()
=>
overrideArtifacts
,
Artifacts:
()
=>
overrideArtifacts
,
});
});
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
Future
<
void
>
_attachToDevice
(
Device
device
)
async
{
Future
<
void
>
_attachToDevice
(
Device
device
)
async
{
...
...
packages/flutter_tools/lib/src/commands/build_aar.dart
View file @
ec2d5833
...
@@ -119,7 +119,7 @@ class BuildAarCommand extends BuildSubCommand {
...
@@ -119,7 +119,7 @@ class BuildAarCommand extends BuildSubCommand {
outputDirectoryPath:
stringArg
(
'output-dir'
),
outputDirectoryPath:
stringArg
(
'output-dir'
),
buildNumber:
buildNumber
,
buildNumber:
buildNumber
,
);
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
/// Returns the [FlutterProject] which is determined from the remaining command-line
/// Returns the [FlutterProject] which is determined from the remaining command-line
...
...
packages/flutter_tools/lib/src/commands/build_aot.dart
View file @
ec2d5833
...
@@ -89,6 +89,6 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
...
@@ -89,6 +89,6 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
extraGenSnapshotOptions:
stringsArg
(
FlutterOptions
.
kExtraGenSnapshotOptions
),
extraGenSnapshotOptions:
stringsArg
(
FlutterOptions
.
kExtraGenSnapshotOptions
),
dartDefines:
dartDefines
,
dartDefines:
dartDefines
,
);
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/build_apk.dart
View file @
ec2d5833
...
@@ -112,6 +112,6 @@ class BuildApkCommand extends BuildSubCommand {
...
@@ -112,6 +112,6 @@ class BuildApkCommand extends BuildSubCommand {
target:
targetFile
,
target:
targetFile
,
androidBuildInfo:
androidBuildInfo
,
androidBuildInfo:
androidBuildInfo
,
);
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/build_appbundle.dart
View file @
ec2d5833
...
@@ -83,6 +83,6 @@ class BuildAppBundleCommand extends BuildSubCommand {
...
@@ -83,6 +83,6 @@ class BuildAppBundleCommand extends BuildSubCommand {
target:
targetFile
,
target:
targetFile
,
androidBuildInfo:
androidBuildInfo
,
androidBuildInfo:
androidBuildInfo
,
);
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/build_bundle.dart
View file @
ec2d5833
...
@@ -139,6 +139,6 @@ class BuildBundleCommand extends BuildSubCommand {
...
@@ -139,6 +139,6 @@ class BuildBundleCommand extends BuildSubCommand {
fileSystemScheme:
stringArg
(
'filesystem-scheme'
),
fileSystemScheme:
stringArg
(
'filesystem-scheme'
),
fileSystemRoots:
stringsArg
(
'filesystem-root'
),
fileSystemRoots:
stringsArg
(
'filesystem-root'
),
);
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/build_fuchsia.dart
View file @
ec2d5833
...
@@ -69,6 +69,6 @@ class BuildFuchsiaCommand extends BuildSubCommand {
...
@@ -69,6 +69,6 @@ class BuildFuchsiaCommand extends BuildSubCommand {
buildInfo:
buildInfo
,
buildInfo:
buildInfo
,
runnerPackageSource:
stringArg
(
'runner-source'
),
runnerPackageSource:
stringArg
(
'runner-source'
),
);
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/build_ios.dart
View file @
ec2d5833
...
@@ -92,6 +92,6 @@ class BuildIOSCommand extends BuildSubCommand {
...
@@ -92,6 +92,6 @@ class BuildIOSCommand extends BuildSubCommand {
globals
.
printStatus
(
'Built
${result.output}
.'
);
globals
.
printStatus
(
'Built
${result.output}
.'
);
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
View file @
ec2d5833
...
@@ -204,8 +204,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
...
@@ -204,8 +204,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
}
}
globals
.
printStatus
(
'Frameworks written to
${outputDirectory.path}
.'
);
globals
.
printStatus
(
'Frameworks written to
${outputDirectory.path}
.'
);
return
FlutterCommandResult
.
success
();
return
null
;
}
}
/// Create podspec that will download and unzip remote engine assets so host apps can leverage CocoaPods
/// Create podspec that will download and unzip remote engine assets so host apps can leverage CocoaPods
...
...
packages/flutter_tools/lib/src/commands/build_linux.dart
View file @
ec2d5833
...
@@ -47,6 +47,6 @@ class BuildLinuxCommand extends BuildSubCommand {
...
@@ -47,6 +47,6 @@ class BuildLinuxCommand extends BuildSubCommand {
throwToolExit
(
'"build linux" only supported on Linux hosts.'
);
throwToolExit
(
'"build linux" only supported on Linux hosts.'
);
}
}
await
buildLinux
(
flutterProject
.
linux
,
buildInfo
,
target:
targetFile
);
await
buildLinux
(
flutterProject
.
linux
,
buildInfo
,
target:
targetFile
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/build_macos.dart
View file @
ec2d5833
...
@@ -51,6 +51,6 @@ class BuildMacosCommand extends BuildSubCommand {
...
@@ -51,6 +51,6 @@ class BuildMacosCommand extends BuildSubCommand {
buildInfo:
buildInfo
,
buildInfo:
buildInfo
,
targetOverride:
targetFile
,
targetOverride:
targetFile
,
);
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/build_web.dart
View file @
ec2d5833
...
@@ -67,6 +67,6 @@ class BuildWebCommand extends BuildSubCommand {
...
@@ -67,6 +67,6 @@ class BuildWebCommand extends BuildSubCommand {
dartDefines
,
dartDefines
,
boolArg
(
'csp'
)
boolArg
(
'csp'
)
);
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/build_windows.dart
View file @
ec2d5833
...
@@ -47,6 +47,6 @@ class BuildWindowsCommand extends BuildSubCommand {
...
@@ -47,6 +47,6 @@ class BuildWindowsCommand extends BuildSubCommand {
throwToolExit
(
'"build windows" only supported on Windows hosts.'
);
throwToolExit
(
'"build windows" only supported on Windows hosts.'
);
}
}
await
buildWindows
(
flutterProject
.
windows
,
buildInfo
,
target:
targetFile
);
await
buildWindows
(
flutterProject
.
windows
,
buildInfo
,
target:
targetFile
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/channel.dart
View file @
ec2d5833
...
@@ -42,10 +42,10 @@ class ChannelCommand extends FlutterCommand {
...
@@ -42,10 +42,10 @@ class ChannelCommand extends FlutterCommand {
showAll:
boolArg
(
'all'
),
showAll:
boolArg
(
'all'
),
verbose:
globalResults
[
'verbose'
]
as
bool
,
verbose:
globalResults
[
'verbose'
]
as
bool
,
);
);
return
null
;
return
FlutterCommandResult
.
success
()
;
case
1
:
case
1
:
await
_switchChannel
(
argResults
.
rest
[
0
]);
await
_switchChannel
(
argResults
.
rest
[
0
]);
return
null
;
return
FlutterCommandResult
.
success
()
;
default
:
default
:
throw
ToolExit
(
'Too many arguments.
\n
$usage
'
);
throw
ToolExit
(
'Too many arguments.
\n
$usage
'
);
}
}
...
...
packages/flutter_tools/lib/src/commands/config.dart
View file @
ec2d5833
...
@@ -101,7 +101,7 @@ class ConfigCommand extends FlutterCommand {
...
@@ -101,7 +101,7 @@ class ConfigCommand extends FlutterCommand {
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
boolArg
(
'machine'
))
{
if
(
boolArg
(
'machine'
))
{
await
handleMachine
();
await
handleMachine
();
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
if
(
boolArg
(
'clear-features'
))
{
if
(
boolArg
(
'clear-features'
))
{
...
@@ -110,7 +110,7 @@ class ConfigCommand extends FlutterCommand {
...
@@ -110,7 +110,7 @@ class ConfigCommand extends FlutterCommand {
globals
.
config
.
removeValue
(
feature
.
configSetting
);
globals
.
config
.
removeValue
(
feature
.
configSetting
);
}
}
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
if
(
argResults
.
wasParsed
(
'analytics'
))
{
if
(
argResults
.
wasParsed
(
'analytics'
))
{
...
@@ -157,7 +157,7 @@ class ConfigCommand extends FlutterCommand {
...
@@ -157,7 +157,7 @@ class ConfigCommand extends FlutterCommand {
globals
.
printStatus
(
'
\n
You may need to restart any open editors for them to read new settings.'
);
globals
.
printStatus
(
'
\n
You may need to restart any open editors for them to read new settings.'
);
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
Future
<
void
>
handleMachine
()
async
{
Future
<
void
>
handleMachine
()
async
{
...
...
packages/flutter_tools/lib/src/commands/create.dart
View file @
ec2d5833
...
@@ -297,7 +297,7 @@ class CreateCommand extends FlutterCommand {
...
@@ -297,7 +297,7 @@ class CreateCommand extends FlutterCommand {
Cache
.
releaseLockEarly
();
Cache
.
releaseLockEarly
();
await
_writeSamplesJson
(
stringArg
(
'list-samples'
));
await
_writeSamplesJson
(
stringArg
(
'list-samples'
));
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
if
(
argResults
.
rest
.
isEmpty
)
{
if
(
argResults
.
rest
.
isEmpty
)
{
...
@@ -482,8 +482,7 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
...
@@ -482,8 +482,7 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
globals
.
printStatus
(
'Your
$application
code is in
$relativeAppMain
'
);
globals
.
printStatus
(
'Your
$application
code is in
$relativeAppMain
'
);
}
}
}
}
return
FlutterCommandResult
.
success
();
return
null
;
}
}
Future
<
int
>
_generateModule
(
Directory
directory
,
Map
<
String
,
dynamic
>
templateContext
,
{
bool
overwrite
=
false
})
async
{
Future
<
int
>
_generateModule
(
Directory
directory
,
Map
<
String
,
dynamic
>
templateContext
,
{
bool
overwrite
=
false
})
async
{
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
ec2d5833
...
@@ -74,7 +74,7 @@ class DaemonCommand extends FlutterCommand {
...
@@ -74,7 +74,7 @@ class DaemonCommand extends FlutterCommand {
Logger:
()
=>
notifyingLogger
,
Logger:
()
=>
notifyingLogger
,
},
},
);
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
...
...
packages/flutter_tools/lib/src/commands/devices.dart
View file @
ec2d5833
...
@@ -47,6 +47,6 @@ class DevicesCommand extends FlutterCommand {
...
@@ -47,6 +47,6 @@ class DevicesCommand extends FlutterCommand {
await
Device
.
printDevices
(
devices
);
await
Device
.
printDevices
(
devices
);
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/drive.dart
View file @
ec2d5833
...
@@ -185,7 +185,7 @@ class DriveCommand extends RunCommandBase {
...
@@ -185,7 +185,7 @@ class DriveCommand extends RunCommandBase {
}
}
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
String
_getTestFile
()
{
String
_getTestFile
()
{
...
...
packages/flutter_tools/lib/src/commands/emulators.dart
View file @
ec2d5833
...
@@ -54,7 +54,7 @@ class EmulatorsCommand extends FlutterCommand {
...
@@ -54,7 +54,7 @@ class EmulatorsCommand extends FlutterCommand {
await
_listEmulators
(
searchText
);
await
_listEmulators
(
searchText
);
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
Future
<
void
>
_launchEmulator
(
String
id
)
async
{
Future
<
void
>
_launchEmulator
(
String
id
)
async
{
...
...
packages/flutter_tools/lib/src/commands/format.dart
View file @
ec2d5833
...
@@ -76,6 +76,6 @@ class FormatCommand extends FlutterCommand {
...
@@ -76,6 +76,6 @@ class FormatCommand extends FlutterCommand {
throwToolExit
(
'Formatting failed:
$result
'
,
exitCode:
result
);
throwToolExit
(
'Formatting failed:
$result
'
,
exitCode:
result
);
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/generate.dart
View file @
ec2d5833
...
@@ -31,7 +31,7 @@ class GenerateCommand extends FlutterCommand {
...
@@ -31,7 +31,7 @@ class GenerateCommand extends FlutterCommand {
globals
.
printError
(
'Code generation failed.'
);
globals
.
printError
(
'Code generation failed.'
);
break
;
break
;
}
}
if
(
codegenStatus
==
CodegenStatus
.
Succeeded
)
{
if
(
codegenStatus
==
CodegenStatus
.
Succeeded
)
{
break
;
break
;
}
}
}
}
...
@@ -41,7 +41,7 @@ class GenerateCommand extends FlutterCommand {
...
@@ -41,7 +41,7 @@ class GenerateCommand extends FlutterCommand {
return
dir
.
childDirectory
(
'error_cache'
).
existsSync
();
return
dir
.
childDirectory
(
'error_cache'
).
existsSync
();
},
orElse:
()
=>
null
);
},
orElse:
()
=>
null
);
if
(
errorCacheParent
==
null
)
{
if
(
errorCacheParent
==
null
)
{
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
final
Directory
errorCache
=
errorCacheParent
.
childDirectory
(
'error_cache'
);
final
Directory
errorCache
=
errorCacheParent
.
childDirectory
(
'error_cache'
);
for
(
final
File
errorFile
in
errorCache
.
listSync
(
recursive:
true
).
whereType
<
File
>())
{
for
(
final
File
errorFile
in
errorCache
.
listSync
(
recursive:
true
).
whereType
<
File
>())
{
...
@@ -56,6 +56,6 @@ class GenerateCommand extends FlutterCommand {
...
@@ -56,6 +56,6 @@ class GenerateCommand extends FlutterCommand {
globals
.
printError
(
'Error reading error in
${errorFile.path}
'
);
globals
.
printError
(
'Error reading error in
${errorFile.path}
'
);
}
}
}
}
return
const
FlutterCommandResult
(
ExitStatus
.
fail
);
return
FlutterCommandResult
.
fail
(
);
}
}
}
}
packages/flutter_tools/lib/src/commands/ide_config.dart
View file @
ec2d5833
...
@@ -219,7 +219,7 @@ class IdeConfigCommand extends FlutterCommand {
...
@@ -219,7 +219,7 @@ class IdeConfigCommand extends FlutterCommand {
if
(
boolArg
(
'update-templates'
))
{
if
(
boolArg
(
'update-templates'
))
{
_handleTemplateUpdate
();
_handleTemplateUpdate
();
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
final
String
flutterRoot
=
globals
.
fs
.
path
.
absolute
(
Cache
.
flutterRoot
);
final
String
flutterRoot
=
globals
.
fs
.
path
.
absolute
(
Cache
.
flutterRoot
);
...
@@ -243,7 +243,7 @@ class IdeConfigCommand extends FlutterCommand {
...
@@ -243,7 +243,7 @@ class IdeConfigCommand extends FlutterCommand {
globals
.
printStatus
(
'Your IntelliJ configuration is now up to date. It is prudent to '
globals
.
printStatus
(
'Your IntelliJ configuration is now up to date. It is prudent to '
'restart IntelliJ, if running.'
);
'restart IntelliJ, if running.'
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
int
_renderTemplate
(
String
templateName
,
String
dirPath
,
Map
<
String
,
dynamic
>
context
)
{
int
_renderTemplate
(
String
templateName
,
String
dirPath
,
Map
<
String
,
dynamic
>
context
)
{
...
...
packages/flutter_tools/lib/src/commands/inject_plugins.dart
View file @
ec2d5833
...
@@ -38,6 +38,6 @@ class InjectPluginsCommand extends FlutterCommand {
...
@@ -38,6 +38,6 @@ class InjectPluginsCommand extends FlutterCommand {
globals
.
printStatus
(
'This project does not use plugins, no GeneratedPluginRegistrants have been created.'
);
globals
.
printStatus
(
'This project does not use plugins, no GeneratedPluginRegistrants have been created.'
);
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/install.dart
View file @
ec2d5833
...
@@ -45,7 +45,7 @@ class InstallCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts
...
@@ -45,7 +45,7 @@ class InstallCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts
throwToolExit
(
'Install failed'
);
throwToolExit
(
'Install failed'
);
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
...
...
packages/flutter_tools/lib/src/commands/logs.dart
View file @
ec2d5833
...
@@ -83,6 +83,6 @@ class LogsCommand extends FlutterCommand {
...
@@ -83,6 +83,6 @@ class LogsCommand extends FlutterCommand {
throwToolExit
(
'Error listening to
$logReader
logs.'
);
throwToolExit
(
'Error listening to
$logReader
logs.'
);
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/make_host_app_editable.dart
View file @
ec2d5833
...
@@ -60,6 +60,6 @@ class MakeHostAppEditableCommand extends FlutterCommand {
...
@@ -60,6 +60,6 @@ class MakeHostAppEditableCommand extends FlutterCommand {
await
_project
.
ios
.
makeHostAppEditable
();
await
_project
.
ios
.
makeHostAppEditable
();
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/packages.dart
View file @
ec2d5833
...
@@ -131,7 +131,7 @@ class PackagesGetCommand extends FlutterCommand {
...
@@ -131,7 +131,7 @@ class PackagesGetCommand extends FlutterCommand {
await
exampleProject
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
true
);
await
exampleProject
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
true
);
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
...
@@ -162,7 +162,7 @@ class PackagesTestCommand extends FlutterCommand {
...
@@ -162,7 +162,7 @@ class PackagesTestCommand extends FlutterCommand {
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Cache
.
releaseLockEarly
();
Cache
.
releaseLockEarly
();
await
pub
.
batch
(<
String
>[
'run'
,
'test'
,
...
argResults
.
rest
],
context:
PubContext
.
runTest
,
retry:
false
);
await
pub
.
batch
(<
String
>[
'run'
,
'test'
,
...
argResults
.
rest
],
context:
PubContext
.
runTest
,
retry:
false
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
...
@@ -203,7 +203,7 @@ class PackagesPublishCommand extends FlutterCommand {
...
@@ -203,7 +203,7 @@ class PackagesPublishCommand extends FlutterCommand {
];
];
Cache
.
releaseLockEarly
();
Cache
.
releaseLockEarly
();
await
pub
.
interactively
(<
String
>[
'publish'
,
...
args
]);
await
pub
.
interactively
(<
String
>[
'publish'
,
...
args
]);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
...
@@ -234,7 +234,7 @@ class PackagesForwardCommand extends FlutterCommand {
...
@@ -234,7 +234,7 @@ class PackagesForwardCommand extends FlutterCommand {
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Cache
.
releaseLockEarly
();
Cache
.
releaseLockEarly
();
await
pub
.
interactively
(<
String
>[
_commandName
,
...
argResults
.
rest
]);
await
pub
.
interactively
(<
String
>[
_commandName
,
...
argResults
.
rest
]);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
...
@@ -262,6 +262,6 @@ class PackagesPassthroughCommand extends FlutterCommand {
...
@@ -262,6 +262,6 @@ class PackagesPassthroughCommand extends FlutterCommand {
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Cache
.
releaseLockEarly
();
Cache
.
releaseLockEarly
();
await
pub
.
interactively
(
argResults
.
rest
);
await
pub
.
interactively
(
argResults
.
rest
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/precache.dart
View file @
ec2d5833
...
@@ -88,6 +88,6 @@ class PrecacheCommand extends FlutterCommand {
...
@@ -88,6 +88,6 @@ class PrecacheCommand extends FlutterCommand {
}
else
{
}
else
{
globals
.
printStatus
(
'Already up-to-date.'
);
globals
.
printStatus
(
'Already up-to-date.'
);
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/screenshot.dart
View file @
ec2d5833
...
@@ -97,16 +97,16 @@ class ScreenshotCommand extends FlutterCommand {
...
@@ -97,16 +97,16 @@ class ScreenshotCommand extends FlutterCommand {
switch
(
stringArg
(
_kType
))
{
switch
(
stringArg
(
_kType
))
{
case
_kDeviceType:
case
_kDeviceType:
await
runScreenshot
(
outputFile
);
await
runScreenshot
(
outputFile
);
return
null
;
return
FlutterCommandResult
.
success
()
;
case
_kSkiaType:
case
_kSkiaType:
await
runSkia
(
outputFile
);
await
runSkia
(
outputFile
);
return
null
;
return
FlutterCommandResult
.
success
()
;
case
_kRasterizerType:
case
_kRasterizerType:
await
runRasterizer
(
outputFile
);
await
runRasterizer
(
outputFile
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
Future
<
void
>
runScreenshot
(
File
outputFile
)
async
{
Future
<
void
>
runScreenshot
(
File
outputFile
)
async
{
...
...
packages/flutter_tools/lib/src/commands/shell_completion.dart
View file @
ec2d5833
...
@@ -50,7 +50,7 @@ class ShellCompletionCommand extends FlutterCommand {
...
@@ -50,7 +50,7 @@ class ShellCompletionCommand extends FlutterCommand {
if
(
argResults
.
rest
.
isEmpty
||
argResults
.
rest
.
first
==
'-'
)
{
if
(
argResults
.
rest
.
isEmpty
||
argResults
.
rest
.
first
==
'-'
)
{
stdout
.
write
(
generateCompletionScript
(<
String
>[
'flutter'
]));
stdout
.
write
(
generateCompletionScript
(<
String
>[
'flutter'
]));
return
null
;
return
FlutterCommandResult
.
warning
()
;
}
}
final
File
outputFile
=
globals
.
fs
.
file
(
argResults
.
rest
.
first
);
final
File
outputFile
=
globals
.
fs
.
file
(
argResults
.
rest
.
first
);
...
@@ -67,6 +67,6 @@ class ShellCompletionCommand extends FlutterCommand {
...
@@ -67,6 +67,6 @@ class ShellCompletionCommand extends FlutterCommand {
throwToolExit
(
'Unable to write shell completion setup script.
\n
$error
'
,
exitCode:
1
);
throwToolExit
(
'Unable to write shell completion setup script.
\n
$error
'
,
exitCode:
1
);
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/test.dart
View file @
ec2d5833
...
@@ -270,7 +270,7 @@ class TestCommand extends FastFlutterCommand {
...
@@ -270,7 +270,7 @@ class TestCommand extends FastFlutterCommand {
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
throwToolExit
(
null
);
throwToolExit
(
null
);
}
}
return
const
FlutterCommandResult
(
ExitStatus
.
success
);
return
FlutterCommandResult
.
success
(
);
}
}
Future
<
void
>
_buildTestAsset
()
async
{
Future
<
void
>
_buildTestAsset
()
async
{
...
...
packages/flutter_tools/lib/src/commands/train.dart
View file @
ec2d5833
...
@@ -22,6 +22,6 @@ class TrainingCommand extends FlutterCommand {
...
@@ -22,6 +22,6 @@ class TrainingCommand extends FlutterCommand {
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
// This command does not do anything yet :).
// This command does not do anything yet :).
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
packages/flutter_tools/lib/src/commands/unpack.dart
View file @
ec2d5833
...
@@ -93,7 +93,7 @@ class UnpackCommand extends FlutterCommand {
...
@@ -93,7 +93,7 @@ class UnpackCommand extends FlutterCommand {
if
(!
success
)
{
if
(!
success
)
{
throwToolExit
(
'Failed to unpack desktop artifacts.'
);
throwToolExit
(
'Failed to unpack desktop artifacts.'
);
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
...
...
packages/flutter_tools/lib/src/commands/update_packages.dart
View file @
ec2d5833
...
@@ -180,7 +180,7 @@ class UpdatePackagesCommand extends FlutterCommand {
...
@@ -180,7 +180,7 @@ class UpdatePackagesCommand extends FlutterCommand {
);
);
}
}
globals
.
printStatus
(
'All pubspecs were up to date.'
);
globals
.
printStatus
(
'All pubspecs were up to date.'
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
if
(
upgrade
||
isPrintPaths
||
isPrintTransitiveClosure
)
{
if
(
upgrade
||
isPrintPaths
||
isPrintTransitiveClosure
)
{
...
@@ -289,12 +289,12 @@ class UpdatePackagesCommand extends FlutterCommand {
...
@@ -289,12 +289,12 @@ class UpdatePackagesCommand extends FlutterCommand {
tree
.
_dependencyTree
.
forEach
((
String
from
,
Set
<
String
>
to
)
{
tree
.
_dependencyTree
.
forEach
((
String
from
,
Set
<
String
>
to
)
{
globals
.
printStatus
(
'
$from
->
$to
'
);
globals
.
printStatus
(
'
$from
->
$to
'
);
});
});
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
if
(
isPrintPaths
)
{
if
(
isPrintPaths
)
{
showDependencyPaths
(
from:
stringArg
(
'from'
),
to:
stringArg
(
'to'
),
tree:
tree
);
showDependencyPaths
(
from:
stringArg
(
'from'
),
to:
stringArg
(
'to'
),
tree:
tree
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
// Now that we have collected all the data, we can apply our dependency
// Now that we have collected all the data, we can apply our dependency
...
@@ -328,7 +328,7 @@ class UpdatePackagesCommand extends FlutterCommand {
...
@@ -328,7 +328,7 @@ class UpdatePackagesCommand extends FlutterCommand {
final
double
seconds
=
timer
.
elapsedMilliseconds
/
1000.0
;
final
double
seconds
=
timer
.
elapsedMilliseconds
/
1000.0
;
globals
.
printStatus
(
'
\n
Ran
\'
pub
\'
$count
time
${count == 1 ? "" : "s"}
and fetched coverage data in
${seconds.toStringAsFixed(1)}
s.'
);
globals
.
printStatus
(
'
\n
Ran
\'
pub
\'
$count
time
${count == 1 ? "" : "s"}
and fetched coverage data in
${seconds.toStringAsFixed(1)}
s.'
);
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
void
showDependencyPaths
({
void
showDependencyPaths
({
...
...
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
ec2d5833
...
@@ -50,14 +50,13 @@ class UpgradeCommand extends FlutterCommand {
...
@@ -50,14 +50,13 @@ class UpgradeCommand extends FlutterCommand {
bool
get
shouldUpdateCache
=>
false
;
bool
get
shouldUpdateCache
=>
false
;
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
{
await
_commandRunner
.
runCommand
(
return
_commandRunner
.
runCommand
(
boolArg
(
'force'
),
boolArg
(
'force'
),
boolArg
(
'continue'
),
boolArg
(
'continue'
),
GitTagVersion
.
determine
(),
GitTagVersion
.
determine
(),
FlutterVersion
.
instance
,
FlutterVersion
.
instance
,
);
);
return
null
;
}
}
}
}
...
@@ -74,7 +73,7 @@ class UpgradeCommandRunner {
...
@@ -74,7 +73,7 @@ class UpgradeCommandRunner {
}
else
{
}
else
{
await
runCommandSecondHalf
(
flutterVersion
);
await
runCommandSecondHalf
(
flutterVersion
);
}
}
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
Future
<
void
>
runCommandFirstHalf
(
Future
<
void
>
runCommandFirstHalf
(
...
...
packages/flutter_tools/lib/src/commands/version.dart
View file @
ec2d5833
...
@@ -143,6 +143,6 @@ class VersionCommand extends FlutterCommand {
...
@@ -143,6 +143,6 @@ class VersionCommand extends FlutterCommand {
throwToolExit
(
null
,
exitCode:
code
);
throwToolExit
(
null
,
exitCode:
code
);
}
}
return
const
FlutterCommandResult
(
ExitStatus
.
success
);
return
FlutterCommandResult
.
success
(
);
}
}
}
}
packages/flutter_tools/lib/src/reporting/events.dart
View file @
ec2d5833
...
@@ -171,7 +171,9 @@ class BuildEvent extends UsageEvent {
...
@@ -171,7 +171,9 @@ class BuildEvent extends UsageEvent {
/// An event that reports the result of a top-level command.
/// An event that reports the result of a top-level command.
class
CommandResultEvent
extends
UsageEvent
{
class
CommandResultEvent
extends
UsageEvent
{
CommandResultEvent
(
String
commandPath
,
FlutterCommandResult
result
)
CommandResultEvent
(
String
commandPath
,
FlutterCommandResult
result
)
:
super
(
commandPath
,
result
?.
toString
()
??
'unspecified'
);
:
assert
(
commandPath
!=
null
),
assert
(
result
!=
null
),
super
(
commandPath
,
result
.
toString
());
@override
@override
void
send
()
{
void
send
()
{
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
ec2d5833
...
@@ -50,6 +50,21 @@ class FlutterCommandResult {
...
@@ -50,6 +50,21 @@ class FlutterCommandResult {
this
.
endTimeOverride
,
this
.
endTimeOverride
,
});
});
/// A command that succeeded. It is used to log the result of a command invocation.
factory
FlutterCommandResult
.
success
()
{
return
const
FlutterCommandResult
(
ExitStatus
.
success
);
}
/// A command that exited with a warning. It is used to log the result of a command invocation.
factory
FlutterCommandResult
.
warning
()
{
return
const
FlutterCommandResult
(
ExitStatus
.
warning
);
}
/// A command that failed. It is used to log the result of a command invocation.
factory
FlutterCommandResult
.
fail
()
{
return
const
FlutterCommandResult
(
ExitStatus
.
fail
);
}
final
ExitStatus
exitStatus
;
final
ExitStatus
exitStatus
;
/// Optional data that can be appended to the timing event.
/// Optional data that can be appended to the timing event.
...
@@ -516,12 +531,9 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -516,12 +531,9 @@ abstract class FlutterCommand extends Command<void> {
flutterUsage
.
printWelcome
();
flutterUsage
.
printWelcome
();
final
String
commandPath
=
await
usagePath
;
final
String
commandPath
=
await
usagePath
;
_registerSignalHandlers
(
commandPath
,
startTime
);
_registerSignalHandlers
(
commandPath
,
startTime
);
FlutterCommandResult
commandResult
;
FlutterCommandResult
commandResult
=
FlutterCommandResult
.
fail
()
;
try
{
try
{
commandResult
=
await
verifyThenRunCommand
(
commandPath
);
commandResult
=
await
verifyThenRunCommand
(
commandPath
);
}
on
ToolExit
{
commandResult
=
const
FlutterCommandResult
(
ExitStatus
.
fail
);
rethrow
;
}
finally
{
}
finally
{
final
DateTime
endTime
=
systemClock
.
now
();
final
DateTime
endTime
=
systemClock
.
now
();
globals
.
printTrace
(
userMessages
.
flutterElapsedTime
(
name
,
getElapsedAsMilliseconds
(
endTime
.
difference
(
startTime
))));
globals
.
printTrace
(
userMessages
.
flutterElapsedTime
(
name
,
getElapsedAsMilliseconds
(
endTime
.
difference
(
startTime
))));
...
@@ -557,15 +569,15 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -557,15 +569,15 @@ abstract class FlutterCommand extends Command<void> {
if
(
commandPath
==
null
)
{
if
(
commandPath
==
null
)
{
return
;
return
;
}
}
assert
(
commandResult
!=
null
);
// Send command result.
// Send command result.
CommandResultEvent
(
commandPath
,
commandResult
).
send
();
CommandResultEvent
(
commandPath
,
commandResult
).
send
();
// Send timing.
// Send timing.
final
List
<
String
>
labels
=
<
String
>[
final
List
<
String
>
labels
=
<
String
>[
if
(
commandResult
?
.
exitStatus
!=
null
)
if
(
commandResult
.
exitStatus
!=
null
)
getEnumName
(
commandResult
.
exitStatus
),
getEnumName
(
commandResult
.
exitStatus
),
if
(
commandResult
?
.
timingLabelParts
?.
isNotEmpty
??
false
)
if
(
commandResult
.
timingLabelParts
?.
isNotEmpty
??
false
)
...
commandResult
.
timingLabelParts
,
...
commandResult
.
timingLabelParts
,
];
];
...
@@ -577,7 +589,7 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -577,7 +589,7 @@ abstract class FlutterCommand extends Command<void> {
name
,
name
,
// If the command provides its own end time, use it. Otherwise report
// If the command provides its own end time, use it. Otherwise report
// the duration of the entire execution.
// the duration of the entire execution.
(
commandResult
?
.
endTimeOverride
??
endTime
).
difference
(
startTime
),
(
commandResult
.
endTimeOverride
??
endTime
).
difference
(
startTime
),
// Report in the form of `success-[parameter1-parameter2]`, all of which
// Report in the form of `success-[parameter1-parameter2]`, all of which
// can be null if the command doesn't provide a FlutterCommandResult.
// can be null if the command doesn't provide a FlutterCommandResult.
label:
label
==
''
?
null
:
label
,
label:
label
==
''
?
null
:
label
,
...
...
packages/flutter_tools/test/commands.shard/permeable/upgrade_test.dart
View file @
ec2d5833
...
@@ -75,7 +75,7 @@ void main() {
...
@@ -75,7 +75,7 @@ void main() {
const
GitTagVersion
.
unknown
(),
const
GitTagVersion
.
unknown
(),
flutterVersion
,
flutterVersion
,
);
);
expect
(
await
result
,
null
);
expect
(
await
result
,
FlutterCommandResult
.
success
()
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
Platform:
()
=>
fakePlatform
,
Platform:
()
=>
fakePlatform
,
...
@@ -103,7 +103,7 @@ void main() {
...
@@ -103,7 +103,7 @@ void main() {
gitTagVersion
,
gitTagVersion
,
flutterVersion
,
flutterVersion
,
);
);
expect
(
await
result
,
null
);
expect
(
await
result
,
FlutterCommandResult
.
success
()
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
Platform:
()
=>
fakePlatform
,
Platform:
()
=>
fakePlatform
,
...
@@ -116,7 +116,7 @@ void main() {
...
@@ -116,7 +116,7 @@ void main() {
gitTagVersion
,
gitTagVersion
,
flutterVersion
,
flutterVersion
,
);
);
expect
(
await
result
,
null
);
expect
(
await
result
,
FlutterCommandResult
.
success
()
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
Platform:
()
=>
fakePlatform
,
Platform:
()
=>
fakePlatform
,
...
@@ -130,7 +130,7 @@ void main() {
...
@@ -130,7 +130,7 @@ void main() {
gitTagVersion
,
gitTagVersion
,
flutterVersion
,
flutterVersion
,
);
);
expect
(
await
result
,
null
);
expect
(
await
result
,
FlutterCommandResult
.
success
()
);
verifyNever
(
globals
.
processManager
.
start
(
verifyNever
(
globals
.
processManager
.
start
(
<
String
>[
<
String
>[
globals
.
fs
.
path
.
join
(
'bin'
,
'flutter'
),
globals
.
fs
.
path
.
join
(
'bin'
,
'flutter'
),
...
...
packages/flutter_tools/test/general.shard/commands/build_aar_test.dart
View file @
ec2d5833
...
@@ -24,10 +24,12 @@ import '../../src/mocks.dart';
...
@@ -24,10 +24,12 @@ import '../../src/mocks.dart';
void
main
(
)
{
void
main
(
)
{
Cache
.
disableLocking
();
Cache
.
disableLocking
();
group
(
'
get
Usage'
,
()
{
group
(
'Usage'
,
()
{
Directory
tempDir
;
Directory
tempDir
;
Usage
mockUsage
;
setUp
(()
{
setUp
(()
{
mockUsage
=
MockUsage
();
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_packages_test.'
);
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_packages_test.'
);
});
});
...
@@ -83,6 +85,26 @@ void main() {
...
@@ -83,6 +85,26 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
AndroidBuilder:
()
=>
FakeAndroidBuilder
(),
AndroidBuilder:
()
=>
FakeAndroidBuilder
(),
});
});
testUsingContext
(
'logs success'
,
()
async
{
final
String
projectPath
=
await
createProject
(
tempDir
,
arguments:
<
String
>[
'--no-pub'
,
'--template=module'
]);
await
runCommandIn
(
projectPath
,
arguments:
<
String
>[
'--target-platform=android-arm'
]);
verify
(
mockUsage
.
sendEvent
(
'tool-command-result'
,
'aar'
,
label:
'success'
,
value:
anyNamed
(
'value'
),
parameters:
anyNamed
(
'parameters'
),
)).
called
(
1
);
},
overrides:
<
Type
,
Generator
>{
AndroidBuilder:
()
=>
FakeAndroidBuilder
(),
Usage:
()
=>
mockUsage
,
});
});
});
group
(
'Gradle'
,
()
{
group
(
'Gradle'
,
()
{
...
...
packages/flutter_tools/test/general.shard/commands/build_apk_test.dart
View file @
ec2d5833
...
@@ -26,10 +26,12 @@ import '../../src/mocks.dart';
...
@@ -26,10 +26,12 @@ import '../../src/mocks.dart';
void
main
(
)
{
void
main
(
)
{
Cache
.
disableLocking
();
Cache
.
disableLocking
();
group
(
'
get
Usage'
,
()
{
group
(
'Usage'
,
()
{
Directory
tempDir
;
Directory
tempDir
;
Usage
mockUsage
;
setUp
(()
{
setUp
(()
{
mockUsage
=
MockUsage
();
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_packages_test.'
);
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_packages_test.'
);
});
});
...
@@ -92,6 +94,25 @@ void main() {
...
@@ -92,6 +94,25 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
AndroidBuilder:
()
=>
FakeAndroidBuilder
(),
AndroidBuilder:
()
=>
FakeAndroidBuilder
(),
});
});
testUsingContext
(
'logs success'
,
()
async
{
final
String
projectPath
=
await
createProject
(
tempDir
,
arguments:
<
String
>[
'--no-pub'
,
'--template=app'
]);
await
runBuildApkCommand
(
projectPath
);
verify
(
mockUsage
.
sendEvent
(
'tool-command-result'
,
'apk'
,
label:
'success'
,
value:
anyNamed
(
'value'
),
parameters:
anyNamed
(
'parameters'
),
)).
called
(
1
);
},
overrides:
<
Type
,
Generator
>{
AndroidBuilder:
()
=>
FakeAndroidBuilder
(),
Usage:
()
=>
mockUsage
,
});
});
});
group
(
'Gradle'
,
()
{
group
(
'Gradle'
,
()
{
...
...
packages/flutter_tools/test/general.shard/commands/build_appbundle_test.dart
View file @
ec2d5833
...
@@ -26,11 +26,13 @@ import '../../src/mocks.dart';
...
@@ -26,11 +26,13 @@ import '../../src/mocks.dart';
void
main
(
)
{
void
main
(
)
{
Cache
.
disableLocking
();
Cache
.
disableLocking
();
group
(
'
get
Usage'
,
()
{
group
(
'Usage'
,
()
{
Directory
tempDir
;
Directory
tempDir
;
Usage
mockUsage
;
setUp
(()
{
setUp
(()
{
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_packages_test.'
);
tempDir
=
globals
.
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_packages_test.'
);
mockUsage
=
MockUsage
();
});
});
tearDown
(()
{
tearDown
(()
{
...
@@ -75,6 +77,25 @@ void main() {
...
@@ -75,6 +77,25 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
AndroidBuilder:
()
=>
FakeAndroidBuilder
(),
AndroidBuilder:
()
=>
FakeAndroidBuilder
(),
});
});
testUsingContext
(
'logs success'
,
()
async
{
final
String
projectPath
=
await
createProject
(
tempDir
,
arguments:
<
String
>[
'--no-pub'
,
'--template=app'
]);
await
runBuildAppBundleCommand
(
projectPath
);
verify
(
mockUsage
.
sendEvent
(
'tool-command-result'
,
'appbundle'
,
label:
'success'
,
value:
anyNamed
(
'value'
),
parameters:
anyNamed
(
'parameters'
),
)).
called
(
1
);
},
overrides:
<
Type
,
Generator
>{
AndroidBuilder:
()
=>
FakeAndroidBuilder
(),
Usage:
()
=>
mockUsage
,
});
});
});
group
(
'Gradle'
,
()
{
group
(
'Gradle'
,
()
{
...
...
packages/flutter_tools/test/general.shard/crash_reporting_test.dart
View file @
ec2d5833
...
@@ -342,7 +342,7 @@ class _CrashCommand extends FlutterCommand {
...
@@ -342,7 +342,7 @@ class _CrashCommand extends FlutterCommand {
fn3
();
fn3
();
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
...
...
packages/flutter_tools/test/general.shard/runner/flutter_command_test.dart
View file @
ec2d5833
...
@@ -217,6 +217,14 @@ void main() {
...
@@ -217,6 +217,14 @@ void main() {
}
}
});
});
test
(
'FlutterCommandResult.success()'
,
()
async
{
expect
(
FlutterCommandResult
.
success
().
exitStatus
,
ExitStatus
.
success
);
});
test
(
'FlutterCommandResult.warning()'
,
()
async
{
expect
(
FlutterCommandResult
.
warning
().
exitStatus
,
ExitStatus
.
warning
);
});
group
(
'signals tests'
,
()
{
group
(
'signals tests'
,
()
{
MockIoProcessSignal
mockSignal
;
MockIoProcessSignal
mockSignal
;
ProcessSignal
signalUnderTest
;
ProcessSignal
signalUnderTest
;
...
@@ -297,7 +305,7 @@ void main() {
...
@@ -297,7 +305,7 @@ void main() {
'flutter'
,
'flutter'
,
'dummy'
,
'dummy'
,
const
Duration
(
milliseconds:
1000
),
const
Duration
(
milliseconds:
1000
),
null
,
'fail'
,
],
],
);
);
});
});
...
@@ -388,7 +396,7 @@ class FakeCommand extends FlutterCommand {
...
@@ -388,7 +396,7 @@ class FakeCommand extends FlutterCommand {
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
return
null
;
return
FlutterCommandResult
.
success
()
;
}
}
}
}
...
...
packages/flutter_tools/test/general.shard/runner/utils.dart
View file @
ec2d5833
...
@@ -36,7 +36,7 @@ class DummyFlutterCommand extends FlutterCommand {
...
@@ -36,7 +36,7 @@ class DummyFlutterCommand extends FlutterCommand {
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
return
commandFunction
==
null
?
null
:
await
commandFunction
();
return
commandFunction
==
null
?
FlutterCommandResult
.
fail
()
:
await
commandFunction
();
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment