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
f86dfdd2
Unverified
Commit
f86dfdd2
authored
May 10, 2022
by
Aman Verma
Committed by
GitHub
May 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] boolArg refactor (#102088)
parent
90a8b056
Changes
32
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
200 additions
and
167 deletions
+200
-167
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+2
-2
attach.dart
packages/flutter_tools/lib/src/commands/attach.dart
+4
-4
build_aar.dart
packages/flutter_tools/lib/src/commands/build_aar.dart
+1
-1
build_apk.dart
packages/flutter_tools/lib/src/commands/build_apk.dart
+7
-7
build_appbundle.dart
packages/flutter_tools/lib/src/commands/build_appbundle.dart
+8
-8
build_bundle.dart
packages/flutter_tools/lib/src/commands/build_bundle.dart
+1
-1
build_ios.dart
packages/flutter_tools/lib/src/commands/build_ios.dart
+3
-3
build_ios_framework.dart
...s/flutter_tools/lib/src/commands/build_ios_framework.dart
+7
-7
build_web.dart
packages/flutter_tools/lib/src/commands/build_web.dart
+3
-3
channel.dart
packages/flutter_tools/lib/src/commands/channel.dart
+1
-1
config.dart
packages/flutter_tools/lib/src/commands/config.dart
+4
-4
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+11
-11
create_base.dart
packages/flutter_tools/lib/src/commands/create_base.dart
+3
-3
custom_devices.dart
packages/flutter_tools/lib/src/commands/custom_devices.dart
+3
-3
debug_adapter.dart
packages/flutter_tools/lib/src/commands/debug_adapter.dart
+1
-1
devices.dart
packages/flutter_tools/lib/src/commands/devices.dart
+1
-1
doctor.dart
packages/flutter_tools/lib/src/commands/doctor.dart
+1
-1
downgrade.dart
packages/flutter_tools/lib/src/commands/downgrade.dart
+1
-1
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+5
-5
generate_localizations.dart
...lutter_tools/lib/src/commands/generate_localizations.dart
+4
-4
ide_config.dart
packages/flutter_tools/lib/src/commands/ide_config.dart
+5
-5
install.dart
packages/flutter_tools/lib/src/commands/install.dart
+1
-1
logs.dart
packages/flutter_tools/lib/src/commands/logs.dart
+1
-1
packages.dart
packages/flutter_tools/lib/src/commands/packages.dart
+1
-1
precache.dart
packages/flutter_tools/lib/src/commands/precache.dart
+5
-5
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+38
-38
shell_completion.dart
...ages/flutter_tools/lib/src/commands/shell_completion.dart
+1
-1
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+11
-11
update_packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+10
-10
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+3
-3
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+29
-20
args_test.dart
packages/flutter_tools/test/general.shard/args_test.dart
+24
-0
No files found.
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
f86dfdd2
...
...
@@ -105,7 +105,7 @@ class AnalyzeCommand extends FlutterCommand {
@override
bool
get
shouldRunPub
{
// If they're not analyzing the current project.
if
(!
boolArg
(
'current-package'
))
{
if
(!
boolArg
Deprecated
(
'current-package'
))
{
return
false
;
}
...
...
@@ -119,7 +119,7 @@ class AnalyzeCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
boolArg
(
'watch'
))
{
if
(
boolArg
Deprecated
(
'watch'
))
{
await
AnalyzeContinuously
(
argResults
!,
runner
!.
getRepoRoots
(),
...
...
packages/flutter_tools/lib/src/commands/attach.dart
View file @
f86dfdd2
...
...
@@ -234,7 +234,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
Future
<
void
>
_attachToDevice
(
Device
device
)
async
{
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
Daemon
daemon
=
boolArg
(
'machine'
)
final
Daemon
daemon
=
boolArg
Deprecated
(
'machine'
)
?
Daemon
(
DaemonConnection
(
daemonStreams:
DaemonStreams
.
fromStdio
(
globals
.
stdio
,
logger:
globals
.
logger
),
...
...
@@ -336,7 +336,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
connectionInfoCompleter:
connectionInfoCompleter
,
appStartedCompleter:
appStartedCompleter
,
allowExistingDdsInstance:
true
,
enableDevTools:
boolArg
(
FlutterCommand
.
kEnableDevTools
),
enableDevTools:
boolArg
Deprecated
(
FlutterCommand
.
kEnableDevTools
),
);
},
device
,
...
...
@@ -369,7 +369,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
terminal:
globals
.
terminal
,
signals:
globals
.
signals
,
processInfo:
globals
.
processInfo
,
reportReady:
boolArg
(
'report-ready'
),
reportReady:
boolArg
Deprecated
(
'report-ready'
),
pidFile:
stringArgDeprecated
(
'pid-file'
),
)
..
registerSignalHandlers
()
...
...
@@ -378,7 +378,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
result
=
await
runner
.
attach
(
appStartedCompleter:
onAppStart
,
allowExistingDdsInstance:
true
,
enableDevTools:
boolArg
(
FlutterCommand
.
kEnableDevTools
),
enableDevTools:
boolArg
Deprecated
(
FlutterCommand
.
kEnableDevTools
),
);
if
(
result
!=
0
)
{
throwToolExit
(
null
,
exitCode:
result
);
...
...
packages/flutter_tools/lib/src/commands/build_aar.dart
View file @
f86dfdd2
...
...
@@ -121,7 +121,7 @@ class BuildAarCommand extends BuildSubCommand {
final
File
targetFile
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
));
for
(
final
String
buildMode
in
const
<
String
>[
'debug'
,
'profile'
,
'release'
])
{
if
(
boolArg
(
buildMode
))
{
if
(
boolArg
Deprecated
(
buildMode
))
{
androidBuildInfo
.
add
(
AndroidBuildInfo
(
await
getBuildInfo
(
...
...
packages/flutter_tools/lib/src/commands/build_apk.dart
View file @
f86dfdd2
...
...
@@ -53,7 +53,7 @@ class BuildApkCommand extends BuildSubCommand {
final
String
name
=
'apk'
;
@override
DeprecationBehavior
get
deprecationBehavior
=>
boolArg
(
'ignore-deprecation'
)
?
DeprecationBehavior
.
ignore
:
DeprecationBehavior
.
exit
;
DeprecationBehavior
get
deprecationBehavior
=>
boolArg
Deprecated
(
'ignore-deprecation'
)
?
DeprecationBehavior
.
ignore
:
DeprecationBehavior
.
exit
;
@override
Future
<
Set
<
DevelopmentArtifact
>>
get
requiredArtifacts
async
=>
<
DevelopmentArtifact
>{
...
...
@@ -73,11 +73,11 @@ class BuildApkCommand extends BuildSubCommand {
Future
<
CustomDimensions
>
get
usageValues
async
{
String
buildMode
;
if
(
boolArg
(
'release'
))
{
if
(
boolArg
Deprecated
(
'release'
))
{
buildMode
=
'release'
;
}
else
if
(
boolArg
(
'debug'
))
{
}
else
if
(
boolArg
Deprecated
(
'debug'
))
{
buildMode
=
'debug'
;
}
else
if
(
boolArg
(
'profile'
))
{
}
else
if
(
boolArg
Deprecated
(
'profile'
))
{
buildMode
=
'profile'
;
}
else
{
// The build defaults to release.
...
...
@@ -87,7 +87,7 @@ class BuildApkCommand extends BuildSubCommand {
return
CustomDimensions
(
commandBuildApkTargetPlatform:
stringsArg
(
'target-platform'
).
join
(
','
),
commandBuildApkBuildMode:
buildMode
,
commandBuildApkSplitPerAbi:
boolArg
(
'split-per-abi'
),
commandBuildApkSplitPerAbi:
boolArg
Deprecated
(
'split-per-abi'
),
);
}
...
...
@@ -99,9 +99,9 @@ class BuildApkCommand extends BuildSubCommand {
final
BuildInfo
buildInfo
=
await
getBuildInfo
();
final
AndroidBuildInfo
androidBuildInfo
=
AndroidBuildInfo
(
buildInfo
,
splitPerAbi:
boolArg
(
'split-per-abi'
),
splitPerAbi:
boolArg
Deprecated
(
'split-per-abi'
),
targetArchs:
stringsArg
(
'target-platform'
).
map
<
AndroidArch
>(
getAndroidArchForName
),
multidexEnabled:
boolArg
(
'multidex'
),
multidexEnabled:
boolArg
Deprecated
(
'multidex'
),
);
validateBuild
(
androidBuildInfo
);
displayNullSafetyMode
(
androidBuildInfo
.
buildInfo
);
...
...
packages/flutter_tools/lib/src/commands/build_appbundle.dart
View file @
f86dfdd2
...
...
@@ -69,7 +69,7 @@ class BuildAppBundleCommand extends BuildSubCommand {
final
String
name
=
'appbundle'
;
@override
DeprecationBehavior
get
deprecationBehavior
=>
boolArg
(
'ignore-deprecation'
)
?
DeprecationBehavior
.
ignore
:
DeprecationBehavior
.
exit
;
DeprecationBehavior
get
deprecationBehavior
=>
boolArg
Deprecated
(
'ignore-deprecation'
)
?
DeprecationBehavior
.
ignore
:
DeprecationBehavior
.
exit
;
@override
Future
<
Set
<
DevelopmentArtifact
>>
get
requiredArtifacts
async
=>
<
DevelopmentArtifact
>{
...
...
@@ -87,11 +87,11 @@ class BuildAppBundleCommand extends BuildSubCommand {
Future
<
CustomDimensions
>
get
usageValues
async
{
String
buildMode
;
if
(
boolArg
(
'release'
))
{
if
(
boolArg
Deprecated
(
'release'
))
{
buildMode
=
'release'
;
}
else
if
(
boolArg
(
'debug'
))
{
}
else
if
(
boolArg
Deprecated
(
'debug'
))
{
buildMode
=
'debug'
;
}
else
if
(
boolArg
(
'profile'
))
{
}
else
if
(
boolArg
Deprecated
(
'profile'
))
{
buildMode
=
'profile'
;
}
else
{
// The build defaults to release.
...
...
@@ -112,12 +112,12 @@ class BuildAppBundleCommand extends BuildSubCommand {
final
AndroidBuildInfo
androidBuildInfo
=
AndroidBuildInfo
(
await
getBuildInfo
(),
targetArchs:
stringsArg
(
'target-platform'
).
map
<
AndroidArch
>(
getAndroidArchForName
),
multidexEnabled:
boolArg
(
'multidex'
),
multidexEnabled:
boolArg
Deprecated
(
'multidex'
),
);
// Do all setup verification that doesn't involve loading units. Checks that
// require generated loading units are done after gen_snapshot in assemble.
final
List
<
DeferredComponent
>?
deferredComponents
=
FlutterProject
.
current
().
manifest
.
deferredComponents
;
if
(
deferredComponents
!=
null
&&
boolArg
(
'deferred-components'
)
&&
boolArg
(
'validate-deferred-components'
)
&&
!
boolArg
(
'debug'
))
{
if
(
deferredComponents
!=
null
&&
boolArg
Deprecated
(
'deferred-components'
)
&&
boolArgDeprecated
(
'validate-deferred-components'
)
&&
!
boolArgDeprecated
(
'debug'
))
{
final
DeferredComponentsPrebuildValidator
validator
=
DeferredComponentsPrebuildValidator
(
FlutterProject
.
current
().
directory
,
globals
.
logger
,
...
...
@@ -153,8 +153,8 @@ class BuildAppBundleCommand extends BuildSubCommand {
project:
FlutterProject
.
current
(),
target:
targetFile
,
androidBuildInfo:
androidBuildInfo
,
validateDeferredComponents:
boolArg
(
'validate-deferred-components'
),
deferredComponentsEnabled:
boolArg
(
'deferred-components'
)
&&
!
boolArg
(
'debug'
),
validateDeferredComponents:
boolArg
Deprecated
(
'validate-deferred-components'
),
deferredComponentsEnabled:
boolArg
Deprecated
(
'deferred-components'
)
&&
!
boolArgDeprecated
(
'debug'
),
);
return
FlutterCommandResult
.
success
();
}
...
...
packages/flutter_tools/lib/src/commands/build_bundle.dart
View file @
f86dfdd2
...
...
@@ -87,7 +87,7 @@ class BuildBundleCommand extends BuildSubCommand {
@override
Future
<
void
>
validateCommand
()
async
{
if
(
boolArg
(
'tree-shake-icons'
))
{
if
(
boolArg
Deprecated
(
'tree-shake-icons'
))
{
throwToolExit
(
'The "--tree-shake-icons" flag is deprecated for "build bundle" and will be removed in a future version of Flutter.'
);
}
return
super
.
validateCommand
();
...
...
packages/flutter_tools/lib/src/commands/build_ios.dart
View file @
f86dfdd2
...
...
@@ -44,10 +44,10 @@ class BuildIOSCommand extends _BuildIOSSubCommand {
final
XcodeBuildAction
xcodeBuildAction
=
XcodeBuildAction
.
build
;
@override
EnvironmentType
get
environmentType
=>
boolArg
(
'simulator'
)
?
EnvironmentType
.
simulator
:
EnvironmentType
.
physical
;
EnvironmentType
get
environmentType
=>
boolArg
Deprecated
(
'simulator'
)
?
EnvironmentType
.
simulator
:
EnvironmentType
.
physical
;
@override
bool
get
configOnly
=>
boolArg
(
'config-only'
);
bool
get
configOnly
=>
boolArg
Deprecated
(
'config-only'
);
@override
Directory
_outputAppDirectory
(
String
xcodeResultOutput
)
=>
globals
.
fs
.
directory
(
xcodeResultOutput
).
parent
;
...
...
@@ -305,7 +305,7 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
EnvironmentType
get
environmentType
;
bool
get
configOnly
;
bool
get
shouldCodesign
=>
boolArg
(
'codesign'
);
bool
get
shouldCodesign
=>
boolArg
Deprecated
(
'codesign'
);
late
final
Future
<
BuildInfo
>
cachedBuildInfo
=
getBuildInfo
();
...
...
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
View file @
f86dfdd2
...
...
@@ -126,13 +126,13 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
Future
<
List
<
BuildInfo
>>
getBuildInfos
()
async
{
final
List
<
BuildInfo
>
buildInfos
=
<
BuildInfo
>[];
if
(
boolArg
(
'debug'
))
{
if
(
boolArg
Deprecated
(
'debug'
))
{
buildInfos
.
add
(
await
getBuildInfo
(
forcedBuildMode:
BuildMode
.
debug
));
}
if
(
boolArg
(
'profile'
))
{
if
(
boolArg
Deprecated
(
'profile'
))
{
buildInfos
.
add
(
await
getBuildInfo
(
forcedBuildMode:
BuildMode
.
profile
));
}
if
(
boolArg
(
'release'
))
{
if
(
boolArg
Deprecated
(
'release'
))
{
buildInfos
.
add
(
await
getBuildInfo
(
forcedBuildMode:
BuildMode
.
release
));
}
...
...
@@ -149,7 +149,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
throwToolExit
(
'Building frameworks for iOS is only supported on the Mac.'
);
}
if
(
boolArg
(
'universal'
))
{
if
(
boolArg
Deprecated
(
'universal'
))
{
throwToolExit
(
'--universal has been deprecated, only XCFrameworks are supported.'
);
}
if
((
await
getBuildInfos
()).
isEmpty
)
{
...
...
@@ -183,8 +183,8 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
modeDirectory
.
deleteSync
(
recursive:
true
);
}
if
(
boolArg
(
'cocoapods'
))
{
produceFlutterPodspec
(
buildInfo
.
mode
,
modeDirectory
,
force:
boolArg
(
'force'
));
if
(
boolArg
Deprecated
(
'cocoapods'
))
{
produceFlutterPodspec
(
buildInfo
.
mode
,
modeDirectory
,
force:
boolArg
Deprecated
(
'force'
));
}
else
{
// Copy Flutter.xcframework.
await
_produceFlutterFramework
(
buildInfo
,
modeDirectory
);
...
...
@@ -503,7 +503,7 @@ end
Future<void> _produceXCFramework(Iterable<Directory> frameworks,
String frameworkBinaryName, Directory outputDirectory) async {
if (!boolArg('
xcframework
')) {
if (!boolArg
Deprecated
('
xcframework
')) {
return;
}
final List<String> xcframeworkCommand = <String>[
...
...
packages/flutter_tools/lib/src/commands/build_web.dart
View file @
f86dfdd2
...
...
@@ -118,10 +118,10 @@ class BuildWebCommand extends BuildSubCommand {
flutterProject
,
target
,
buildInfo
,
boolArg
(
'csp'
),
boolArg
Deprecated
(
'csp'
),
stringArgDeprecated
(
'pwa-strategy'
)!,
boolArg
(
'source-maps'
),
boolArg
(
'native-null-assertions'
),
boolArg
Deprecated
(
'source-maps'
),
boolArg
Deprecated
(
'native-null-assertions'
),
baseHref
,
stringArgDeprecated
(
'dart2js-optimization'
),
);
...
...
packages/flutter_tools/lib/src/commands/channel.dart
View file @
f86dfdd2
...
...
@@ -39,7 +39,7 @@ class ChannelCommand extends FlutterCommand {
switch
(
rest
.
length
)
{
case
0
:
await
_listChannels
(
showAll:
boolArg
(
'all'
),
showAll:
boolArg
Deprecated
(
'all'
),
verbose:
globalResults
?[
'verbose'
]
==
true
,
);
return
FlutterCommandResult
.
success
();
...
...
packages/flutter_tools/lib/src/commands/config.dart
View file @
f86dfdd2
...
...
@@ -101,12 +101,12 @@ class ConfigCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
boolArg
(
'machine'
))
{
if
(
boolArg
Deprecated
(
'machine'
))
{
await
handleMachine
();
return
FlutterCommandResult
.
success
();
}
if
(
boolArg
(
'clear-features'
))
{
if
(
boolArg
Deprecated
(
'clear-features'
))
{
for
(
final
Feature
feature
in
allFeatures
)
{
final
String
?
configSetting
=
feature
.
configSetting
;
if
(
configSetting
!=
null
)
{
...
...
@@ -117,7 +117,7 @@ class ConfigCommand extends FlutterCommand {
}
if
(
argResults
?.
wasParsed
(
'analytics'
)
??
false
)
{
final
bool
value
=
boolArg
(
'analytics'
);
final
bool
value
=
boolArg
Deprecated
(
'analytics'
);
// The tool sends the analytics event *before* toggling the flag
// intentionally to be sure that opt-out events are sent correctly.
AnalyticsConfigEvent
(
enabled:
value
).
send
();
...
...
@@ -157,7 +157,7 @@ class ConfigCommand extends FlutterCommand {
continue
;
}
if
(
argResults
?.
wasParsed
(
configSetting
)
??
false
)
{
final
bool
keyValue
=
boolArg
(
configSetting
);
final
bool
keyValue
=
boolArg
Deprecated
(
configSetting
);
globals
.
config
.
setValue
(
configSetting
,
keyValue
);
globals
.
printStatus
(
'Setting "
$configSetting
" value to "
$keyValue
".'
);
}
...
...
packages/flutter_tools/lib/src/commands/create.dart
View file @
f86dfdd2
...
...
@@ -245,10 +245,10 @@ class CreateCommand extends CreateBase {
final
String
organization
=
await
getOrganization
();
final
bool
overwrite
=
boolArg
(
'overwrite'
);
final
bool
overwrite
=
boolArg
Deprecated
(
'overwrite'
);
validateProjectDir
(
overwrite:
overwrite
);
if
(
boolArg
(
'with-driver-test'
))
{
if
(
boolArg
Deprecated
(
'with-driver-test'
))
{
globals
.
printWarning
(
'The "--with-driver-test" argument has been deprecated and will no longer add a flutter '
'driver template. Instead, learn how to use package:integration_test by '
...
...
@@ -291,7 +291,7 @@ class CreateCommand extends CreateBase {
windows:
featureFlags
.
isWindowsEnabled
&&
platforms
.
contains
(
'windows'
),
// Enable null safety everywhere.
dartSdkVersionBounds:
"'>=
$dartSdk
<3.0.0'"
,
implementationTests:
boolArg
(
'implementation-tests'
),
implementationTests:
boolArg
Deprecated
(
'implementation-tests'
),
agpVersion:
gradle
.
templateAndroidGradlePluginVersion
,
kotlinVersion:
gradle
.
templateKotlinGradlePluginVersion
,
gradleVersion:
gradle
.
templateDefaultGradleVersion
,
...
...
@@ -448,11 +448,11 @@ Your $application code is in $relativeAppMain.
overwrite:
overwrite
,
printStatusWhenWriting:
printStatusWhenWriting
,
);
if
(
boolArg
(
'pub'
))
{
if
(
boolArg
Deprecated
(
'pub'
))
{
await
pub
.
get
(
context:
PubContext
.
create
,
directory:
directory
.
path
,
offline:
boolArg
(
'offline'
),
offline:
boolArg
Deprecated
(
'offline'
),
generateSyntheticPackage:
false
,
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
directory
);
...
...
@@ -482,11 +482,11 @@ Your $application code is in $relativeAppMain.
overwrite:
overwrite
,
printStatusWhenWriting:
printStatusWhenWriting
,
);
if
(
boolArg
(
'pub'
))
{
if
(
boolArg
Deprecated
(
'pub'
))
{
await
pub
.
get
(
context:
PubContext
.
createPackage
,
directory:
directory
.
path
,
offline:
boolArg
(
'offline'
),
offline:
boolArg
Deprecated
(
'offline'
),
generateSyntheticPackage:
false
,
);
}
...
...
@@ -529,11 +529,11 @@ Your $application code is in $relativeAppMain.
printStatusWhenWriting:
printStatusWhenWriting
,
);
if
(
boolArg
(
'pub'
))
{
if
(
boolArg
Deprecated
(
'pub'
))
{
await
pub
.
get
(
context:
PubContext
.
createPlugin
,
directory:
directory
.
path
,
offline:
boolArg
(
'offline'
),
offline:
boolArg
Deprecated
(
'offline'
),
generateSyntheticPackage:
false
,
);
}
...
...
@@ -608,11 +608,11 @@ Your $application code is in $relativeAppMain.
printStatusWhenWriting:
printStatusWhenWriting
,
);
if
(
boolArg
(
'pub'
))
{
if
(
boolArg
Deprecated
(
'pub'
))
{
await
pub
.
get
(
context:
PubContext
.
createPlugin
,
directory:
directory
.
path
,
offline:
boolArg
(
'offline'
),
offline:
boolArg
Deprecated
(
'offline'
),
generateSyntheticPackage:
false
,
);
}
...
...
packages/flutter_tools/lib/src/commands/create_base.dart
View file @
f86dfdd2
...
...
@@ -316,7 +316,7 @@ abstract class CreateBase extends FlutterCommand {
String
get
projectName
{
final
String
projectName
=
stringArgDeprecated
(
'project-name'
)
??
globals
.
fs
.
path
.
basename
(
projectDirPath
);
if
(!
boolArg
(
'skip-name-checks'
))
{
if
(!
boolArg
Deprecated
(
'skip-name-checks'
))
{
final
String
error
=
_validateProjectName
(
projectName
);
if
(
error
!=
null
)
{
throwToolExit
(
error
);
...
...
@@ -515,7 +515,7 @@ abstract class CreateBase extends FlutterCommand {
final
bool
windowsPlatform
=
templateContext
[
'windows'
]
as
bool
??
false
;
final
bool
webPlatform
=
templateContext
[
'web'
]
as
bool
??
false
;
if
(
boolArg
(
'pub'
))
{
if
(
boolArg
Deprecated
(
'pub'
))
{
final
Environment
environment
=
Environment
(
artifacts:
globals
.
artifacts
,
logger:
globals
.
logger
,
...
...
@@ -540,7 +540,7 @@ abstract class CreateBase extends FlutterCommand {
await
pub
.
get
(
context:
PubContext
.
create
,
directory:
directory
.
path
,
offline:
boolArg
(
'offline'
),
offline:
boolArg
Deprecated
(
'offline'
),
// For templates that use the l10n localization tooling, make sure
// importing the generated package works right after `flutter create`.
generateSyntheticPackage:
true
,
...
...
packages/flutter_tools/lib/src/commands/custom_devices.dart
View file @
f86dfdd2
...
...
@@ -483,7 +483,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
/// Only check if `--check` is explicitly specified. (Don't check by default)
Future
<
FlutterCommandResult
>
runNonInteractively
()
async
{
final
String
jsonStr
=
stringArgDeprecated
(
_kJson
);
final
bool
shouldCheck
=
boolArg
(
_kCheck
)
??
false
;
final
bool
shouldCheck
=
boolArg
Deprecated
(
_kCheck
)
??
false
;
dynamic
json
;
try
{
...
...
@@ -591,7 +591,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
/// Run interactively (with user prompts), the target device should be
/// connected to via ssh.
Future
<
FlutterCommandResult
>
runInteractivelySsh
()
async
{
final
bool
shouldCheck
=
boolArg
(
_kCheck
)
??
true
;
final
bool
shouldCheck
=
boolArg
Deprecated
(
_kCheck
)
??
true
;
// Listen to the keystrokes stream as late as possible, since it's a
// single-subscription stream apparently.
...
...
@@ -806,7 +806,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
if
(
stringArgDeprecated
(
_kJson
)
!=
null
)
{
return
runNonInteractively
();
}
if
(
boolArg
(
_kSsh
)
==
true
)
{
if
(
boolArg
Deprecated
(
_kSsh
)
==
true
)
{
return
runInteractivelySsh
();
}
throw
FallThroughError
();
...
...
packages/flutter_tools/lib/src/commands/debug_adapter.dart
View file @
f86dfdd2
...
...
@@ -58,7 +58,7 @@ class DebugAdapterCommand extends FlutterCommand {
platform:
globals
.
platform
,
ipv6:
ipv6
??
false
,
enableDds:
enableDds
,
test:
boolArg
(
'test'
),
test:
boolArg
Deprecated
(
'test'
),
);
await
server
.
channel
.
closed
;
...
...
packages/flutter_tools/lib/src/commands/devices.dart
View file @
f86dfdd2
...
...
@@ -64,7 +64,7 @@ class DevicesCommand extends FlutterCommand {
final
List
<
Device
>
devices
=
await
globals
.
deviceManager
?.
refreshAllConnectedDevices
(
timeout:
deviceDiscoveryTimeout
)
??
<
Device
>[];
if
(
boolArg
(
'machine'
))
{
if
(
boolArg
Deprecated
(
'machine'
))
{
await
printDevicesAsJson
(
devices
);
}
else
{
if
(
devices
.
isEmpty
)
{
...
...
packages/flutter_tools/lib/src/commands/doctor.dart
View file @
f86dfdd2
...
...
@@ -48,7 +48,7 @@ class DoctorCommand extends FlutterCommand {
}
}
final
bool
success
=
await
globals
.
doctor
?.
diagnose
(
androidLicenses:
boolArg
(
'android-licenses'
),
androidLicenses:
boolArg
Deprecated
(
'android-licenses'
),
verbose:
verbose
,
androidLicenseValidator:
androidLicenseValidator
,
)
??
false
;
...
...
packages/flutter_tools/lib/src/commands/downgrade.dart
View file @
f86dfdd2
...
...
@@ -129,7 +129,7 @@ class DowngradeCommand extends FlutterCommand {
final
Stdio
stdio
=
_stdio
!;
final
Terminal
terminal
=
_terminal
!;
final
Logger
logger
=
_logger
!;
if
(
stdio
.
hasTerminal
&&
boolArg
(
'prompt'
))
{
if
(
stdio
.
hasTerminal
&&
boolArg
Deprecated
(
'prompt'
))
{
terminal
.
usesTerminalUi
=
true
;
final
String
result
=
await
terminal
.
promptForCharInput
(
const
<
String
>[
'y'
,
'n'
],
...
...
packages/flutter_tools/lib/src/commands/drive.dart
View file @
f86dfdd2
...
...
@@ -156,7 +156,7 @@ class DriveCommand extends RunCommandBase {
// specified not to.
@override
bool
get
shouldRunPub
{
if
(
argResults
.
wasParsed
(
'pub'
)
&&
!
boolArg
(
'pub'
))
{
if
(
argResults
.
wasParsed
(
'pub'
)
&&
!
boolArg
Deprecated
(
'pub'
))
{
return
false
;
}
return
true
;
...
...
@@ -255,7 +255,7 @@ class DriveCommand extends RunCommandBase {
'trace-startup'
:
traceStartup
,
if
(
web
)
'--no-launch-chrome'
:
true
,
if
(
boolArg
(
'multidex'
))
if
(
boolArg
Deprecated
(
'multidex'
))
'multidex'
:
true
,
}
);
...
...
@@ -278,13 +278,13 @@ class DriveCommand extends RunCommandBase {
<
String
,
String
>{},
packageConfig
,
chromeBinary:
stringArgDeprecated
(
'chrome-binary'
),
headless:
boolArg
(
'headless'
),
headless:
boolArg
Deprecated
(
'headless'
),
browserDimension:
stringArgDeprecated
(
'browser-dimension'
).
split
(
','
),
browserName:
stringArgDeprecated
(
'browser-name'
),
driverPort:
stringArgDeprecated
(
'driver-port'
)
!=
null
?
int
.
tryParse
(
stringArgDeprecated
(
'driver-port'
))
:
null
,
androidEmulator:
boolArg
(
'android-emulator'
),
androidEmulator:
boolArg
Deprecated
(
'android-emulator'
),
profileMemory:
stringArgDeprecated
(
'profile-memory'
),
);
if
(
testResult
!=
0
&&
screenshot
!=
null
)
{
...
...
@@ -293,7 +293,7 @@ class DriveCommand extends RunCommandBase {
screenshotTaken
=
true
;
}
if
(
boolArg
(
'keep-app-running'
)
??
(
argResults
[
'use-existing-app'
]
!=
null
))
{
if
(
boolArg
Deprecated
(
'keep-app-running'
)
??
(
argResults
[
'use-existing-app'
]
!=
null
))
{
_logger
.
printStatus
(
'Leaving the application running.'
);
}
else
{
final
File
skslFile
=
stringArgDeprecated
(
'write-sksl-on-exit'
)
!=
null
...
...
packages/flutter_tools/lib/src/commands/generate_localizations.dart
View file @
f86dfdd2
...
...
@@ -225,12 +225,12 @@ class GenerateLocalizationsCommand extends FlutterCommand {
final
List
<
String
>
preferredSupportedLocales
=
stringsArg
(
'preferred-supported-locales'
);
final
String
?
headerString
=
stringArgDeprecated
(
'header'
);
final
String
?
headerFile
=
stringArgDeprecated
(
'header-file'
);
final
bool
useDeferredLoading
=
boolArg
(
'use-deferred-loading'
);
final
bool
useDeferredLoading
=
boolArg
Deprecated
(
'use-deferred-loading'
);
final
String
?
inputsAndOutputsListPath
=
stringArgDeprecated
(
'gen-inputs-and-outputs-list'
);
final
bool
useSyntheticPackage
=
boolArg
(
'synthetic-package'
);
final
bool
useSyntheticPackage
=
boolArg
Deprecated
(
'synthetic-package'
);
final
String
?
projectPathString
=
stringArgDeprecated
(
'project-dir'
);
final
bool
areResourceAttributesRequired
=
boolArg
(
'required-resource-attributes'
);
final
bool
usesNullableGetter
=
boolArg
(
'nullable-getter'
);
final
bool
areResourceAttributesRequired
=
boolArg
Deprecated
(
'required-resource-attributes'
);
final
bool
usesNullableGetter
=
boolArg
Deprecated
(
'nullable-getter'
);
precacheLanguageAndRegionTags
();
...
...
packages/flutter_tools/lib/src/commands/ide_config.dart
View file @
f86dfdd2
...
...
@@ -153,7 +153,7 @@ class IdeConfigCommand extends FlutterCommand {
manifest
.
add
(
'
$relativePath${Template.copyTemplateExtension}
'
);
continue
;
}
if
(
boolArg
(
'overwrite'
))
{
if
(
boolArg
Deprecated
(
'overwrite'
))
{
finalDestinationFile
.
deleteSync
();
globals
.
printStatus
(
'
$relativeDestination
(overwritten)'
);
}
else
{
...
...
@@ -174,7 +174,7 @@ class IdeConfigCommand extends FlutterCommand {
}
// If we're not overwriting, then we're not going to remove missing items either.
if
(!
boolArg
(
'overwrite'
))
{
if
(!
boolArg
Deprecated
(
'overwrite'
))
{
return
;
}
...
...
@@ -213,7 +213,7 @@ class IdeConfigCommand extends FlutterCommand {
throwToolExit
(
'Currently, the only supported IDE is IntelliJ
\n
$usage
'
,
exitCode:
2
);
}
if
(
boolArg
(
'update-templates'
))
{
if
(
boolArg
Deprecated
(
'update-templates'
))
{
_handleTemplateUpdate
();
return
FlutterCommandResult
.
success
();
}
...
...
@@ -231,7 +231,7 @@ class IdeConfigCommand extends FlutterCommand {
globals
.
printStatus
(
'Updating IDE configuration for Flutter tree at
$dirPath
...'
);
int
generatedCount
=
0
;
generatedCount
+=
_renderTemplate
(
_ideName
,
dirPath
,
<
String
,
Object
>{
'withRootModule'
:
boolArg
(
'with-root-module'
),
'withRootModule'
:
boolArg
Deprecated
(
'with-root-module'
),
'android'
:
true
,
});
...
...
@@ -254,7 +254,7 @@ class IdeConfigCommand extends FlutterCommand {
return
template
.
render
(
globals
.
fs
.
directory
(
dirPath
),
context
,
overwriteExisting:
boolArg
(
'overwrite'
),
overwriteExisting:
boolArg
Deprecated
(
'overwrite'
),
);
}
}
...
...
packages/flutter_tools/lib/src/commands/install.dart
View file @
f86dfdd2
...
...
@@ -33,7 +33,7 @@ class InstallCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts
Device
?
device
;
bool
get
uninstallOnly
=>
boolArg
(
'uninstall-only'
);
bool
get
uninstallOnly
=>
boolArg
Deprecated
(
'uninstall-only'
);
String
?
get
userIdentifier
=>
stringArgDeprecated
(
FlutterOptions
.
kDeviceUser
);
String
?
get
_applicationBinaryPath
=>
stringArgDeprecated
(
FlutterOptions
.
kUseApplicationBinary
);
...
...
packages/flutter_tools/lib/src/commands/logs.dart
View file @
f86dfdd2
...
...
@@ -46,7 +46,7 @@ class LogsCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
Device
cachedDevice
=
device
!;
if
(
boolArg
(
'clear'
))
{
if
(
boolArg
Deprecated
(
'clear'
))
{
cachedDevice
.
clearLogs
();
}
...
...
packages/flutter_tools/lib/src/commands/packages.dart
View file @
f86dfdd2
...
...
@@ -143,7 +143,7 @@ class PackagesGetCommand extends FlutterCommand {
directory:
directory
,
upgrade:
upgrade
,
shouldSkipThirdPartyGenerator:
false
,
offline:
boolArg
(
'offline'
),
offline:
boolArg
Deprecated
(
'offline'
),
generateSyntheticPackage:
flutterProject
.
manifest
.
generateSyntheticPackage
,
);
pubGetTimer
.
stop
();
...
...
packages/flutter_tools/lib/src/commands/precache.dart
View file @
f86dfdd2
...
...
@@ -106,7 +106,7 @@ class PrecacheCommand extends FlutterCommand {
Set
<
String
>
_explicitArtifactSelections
()
{
final
Map
<
String
,
String
>
umbrellaForArtifact
=
_umbrellaForArtifactMap
();
final
Set
<
String
>
selections
=
<
String
>{};
bool
explicitlySelected
(
String
name
)
=>
boolArg
(
name
)
&&
argResults
.
wasParsed
(
name
);
bool
explicitlySelected
(
String
name
)
=>
boolArg
Deprecated
(
name
)
&&
argResults
.
wasParsed
(
name
);
for
(
final
DevelopmentArtifact
artifact
in
DevelopmentArtifact
.
values
)
{
final
String
umbrellaName
=
umbrellaForArtifact
[
artifact
.
name
];
if
(
explicitlySelected
(
artifact
.
name
)
||
...
...
@@ -139,15 +139,15 @@ class PrecacheCommand extends FlutterCommand {
if
(
_platform
.
environment
[
'FLUTTER_ALREADY_LOCKED'
]
!=
'true'
)
{
await
_cache
.
lock
();
}
if
(
boolArg
(
'force'
))
{
if
(
boolArg
Deprecated
(
'force'
))
{
_cache
.
clearStampFiles
();
}
final
bool
includeAllPlatforms
=
boolArg
(
'all-platforms'
);
final
bool
includeAllPlatforms
=
boolArg
Deprecated
(
'all-platforms'
);
if
(
includeAllPlatforms
)
{
_cache
.
includeAllPlatforms
=
true
;
}
if
(
boolArg
(
'use-unsigned-mac-binaries'
))
{
if
(
boolArg
Deprecated
(
'use-unsigned-mac-binaries'
))
{
_cache
.
useUnsignedMacBinaries
=
true
;
}
final
Set
<
String
>
explicitlyEnabled
=
_explicitArtifactSelections
();
...
...
@@ -164,7 +164,7 @@ class PrecacheCommand extends FlutterCommand {
}
final
String
argumentName
=
umbrellaForArtifact
[
artifact
.
name
]
??
artifact
.
name
;
if
(
includeAllPlatforms
||
boolArg
(
argumentName
)
||
downloadDefaultArtifacts
)
{
if
(
includeAllPlatforms
||
boolArg
Deprecated
(
argumentName
)
||
downloadDefaultArtifacts
)
{
requiredArtifacts
.
add
(
artifact
);
}
}
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
f86dfdd2
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/shell_completion.dart
View file @
f86dfdd2
...
...
@@ -54,7 +54,7 @@ class ShellCompletionCommand extends FlutterCommand {
}
final
File
outputFile
=
globals
.
fs
.
file
(
rest
.
first
);
if
(
outputFile
.
existsSync
()
&&
!
boolArg
(
'overwrite'
))
{
if
(
outputFile
.
existsSync
()
&&
!
boolArg
Deprecated
(
'overwrite'
))
{
throwToolExit
(
'Output file
${outputFile.path}
already exists, will not overwrite. '
'Use --overwrite to force overwriting existing output file.'
,
...
...
packages/flutter_tools/lib/src/commands/test.dart
View file @
f86dfdd2
...
...
@@ -302,7 +302,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
'directory (or one of its subdirectories).'
);
}
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
bool
buildTestAssets
=
boolArg
(
'test-assets'
);
final
bool
buildTestAssets
=
boolArg
Deprecated
(
'test-assets'
);
final
List
<
String
>
names
=
stringsArg
(
'name'
);
final
List
<
String
>
plainNames
=
stringsArg
(
'plain-name'
);
final
String
tags
=
stringArgDeprecated
(
'tags'
);
...
...
@@ -324,7 +324,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
await
_buildTestAsset
();
}
final
bool
startPaused
=
boolArg
(
'start-paused'
);
final
bool
startPaused
=
boolArg
Deprecated
(
'start-paused'
);
if
(
startPaused
&&
_testFiles
.
length
!=
1
)
{
throwToolExit
(
'When using --start-paused, you must specify a single test file to run.'
,
...
...
@@ -371,9 +371,9 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
'If you set --shard-index you need to also set --total-shards.'
);
}
final
bool
machine
=
boolArg
(
'machine'
);
final
bool
machine
=
boolArg
Deprecated
(
'machine'
);
CoverageCollector
collector
;
if
(
boolArg
(
'coverage'
)
||
boolArg
(
'merge-coverage'
))
{
if
(
boolArg
Deprecated
(
'coverage'
)
||
boolArgDeprecated
(
'merge-coverage'
))
{
final
String
projectName
=
flutterProject
.
manifest
.
appName
;
collector
=
CoverageCollector
(
verbose:
!
machine
,
...
...
@@ -392,11 +392,11 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
final
DebuggingOptions
debuggingOptions
=
DebuggingOptions
.
enabled
(
buildInfo
,
startPaused:
startPaused
,
disableServiceAuthCodes:
boolArg
(
'disable-service-auth-codes'
),
disableServiceAuthCodes:
boolArg
Deprecated
(
'disable-service-auth-codes'
),
// On iOS >=14, keeping this enabled will leave a prompt on the screen.
disablePortPublication:
true
,
enableDds:
enableDds
,
nullAssertions:
boolArg
(
FlutterOptions
.
kNullAssertions
),
nullAssertions:
boolArg
Deprecated
(
FlutterOptions
.
kNullAssertions
),
);
Device
integrationTestDevice
;
...
...
@@ -439,10 +439,10 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
tags:
tags
,
excludeTags:
excludeTags
,
watcher:
watcher
,
enableObservatory:
collector
!=
null
||
startPaused
||
boolArg
(
'enable-vmservice'
),
ipv6:
boolArg
(
'ipv6'
),
enableObservatory:
collector
!=
null
||
startPaused
||
boolArg
Deprecated
(
'enable-vmservice'
),
ipv6:
boolArg
Deprecated
(
'ipv6'
),
machine:
machine
,
updateGoldens:
boolArg
(
'update-goldens'
),
updateGoldens:
boolArg
Deprecated
(
'update-goldens'
),
concurrency:
jobs
,
buildTestAssets:
buildTestAssets
,
flutterProject:
flutterProject
,
...
...
@@ -450,7 +450,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
randomSeed:
stringArgDeprecated
(
'test-randomize-ordering-seed'
),
reporter:
stringArgDeprecated
(
'reporter'
),
timeout:
stringArgDeprecated
(
'timeout'
),
runSkipped:
boolArg
(
'run-skipped'
),
runSkipped:
boolArg
Deprecated
(
'run-skipped'
),
shardIndex:
shardIndex
,
totalShards:
totalShards
,
integrationTestDevice:
integrationTestDevice
,
...
...
@@ -460,7 +460,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
if
(
collector
!=
null
)
{
final
bool
collectionResult
=
collector
.
collectCoverageData
(
stringArgDeprecated
(
'coverage-path'
),
mergeCoverageData:
boolArg
(
'merge-coverage'
),
mergeCoverageData:
boolArg
Deprecated
(
'merge-coverage'
),
);
if
(!
collectionResult
)
{
throwToolExit
(
null
);
...
...
packages/flutter_tools/lib/src/commands/update_packages.dart
View file @
f86dfdd2
...
...
@@ -145,15 +145,15 @@ class UpdatePackagesCommand extends FlutterCommand {
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
List
<
Directory
>
packages
=
runner
!.
getRepoPackages
();
final
bool
forceUpgrade
=
boolArg
(
'force-upgrade'
);
final
bool
isPrintPaths
=
boolArg
(
'paths'
);
final
bool
isPrintTransitiveClosure
=
boolArg
(
'transitive-closure'
);
final
bool
isVerifyOnly
=
boolArg
(
'verify-only'
);
final
bool
isConsumerOnly
=
boolArg
(
'consumer-only'
);
final
bool
offline
=
boolArg
(
'offline'
);
final
bool
forceUpgrade
=
boolArg
Deprecated
(
'force-upgrade'
);
final
bool
isPrintPaths
=
boolArg
Deprecated
(
'paths'
);
final
bool
isPrintTransitiveClosure
=
boolArg
Deprecated
(
'transitive-closure'
);
final
bool
isVerifyOnly
=
boolArg
Deprecated
(
'verify-only'
);
final
bool
isConsumerOnly
=
boolArg
Deprecated
(
'consumer-only'
);
final
bool
offline
=
boolArg
Deprecated
(
'offline'
);
final
bool
doUpgrade
=
forceUpgrade
||
isPrintPaths
||
isPrintTransitiveClosure
;
if
(
boolArg
(
'crash'
))
{
if
(
boolArg
Deprecated
(
'crash'
))
{
throw
StateError
(
'test crash please ignore.'
);
}
...
...
@@ -403,7 +403,7 @@ class UpdatePackagesCommand extends FlutterCommand {
context:
PubContext
.
updatePackages
,
directory:
tempDir
.
path
,
upgrade:
doUpgrade
,
offline:
boolArg
(
'offline'
),
offline:
boolArg
Deprecated
(
'offline'
),
flutterRootOverride:
temporaryFlutterSdk
?.
path
,
);
// Cleanup the temporary SDK
...
...
@@ -454,14 +454,14 @@ class UpdatePackagesCommand extends FlutterCommand {
}
}
if
(
boolArg
(
'transitive-closure'
))
{
if
(
boolArg
Deprecated
(
'transitive-closure'
))
{
tree
.
_dependencyTree
.
forEach
((
String
from
,
Set
<
String
>
to
)
{
globals
.
printStatus
(
'
$from
->
$to
'
);
});
return
true
;
}
if
(
boolArg
(
'paths'
))
{
if
(
boolArg
Deprecated
(
'paths'
))
{
showDependencyPaths
(
from:
stringArgDeprecated
(
'from'
)!,
to:
stringArgDeprecated
(
'to'
)!,
tree:
tree
);
return
true
;
}
...
...
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
f86dfdd2
...
...
@@ -72,14 +72,14 @@ class UpgradeCommand extends FlutterCommand {
Future
<
FlutterCommandResult
>
runCommand
()
{
_commandRunner
.
workingDirectory
=
stringArgDeprecated
(
'working-directory'
)
??
Cache
.
flutterRoot
!;
return
_commandRunner
.
runCommand
(
force:
boolArg
(
'force'
),
continueFlow:
boolArg
(
'continue'
),
force:
boolArg
Deprecated
(
'force'
),
continueFlow:
boolArg
Deprecated
(
'continue'
),
testFlow:
stringArgDeprecated
(
'working-directory'
)
!=
null
,
gitTagVersion:
GitTagVersion
.
determine
(
globals
.
processUtils
,
globals
.
platform
),
flutterVersion:
stringArgDeprecated
(
'working-directory'
)
==
null
?
globals
.
flutterVersion
:
FlutterVersion
(
workingDirectory:
_commandRunner
.
workingDirectory
),
verifyOnly:
boolArg
(
'verify-only'
),
verifyOnly:
boolArg
Deprecated
(
'verify-only'
),
);
}
}
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
f86dfdd2
...
...
@@ -185,7 +185,7 @@ abstract class FlutterCommand extends Command<void> {
DeprecationBehavior
get
deprecationBehavior
=>
DeprecationBehavior
.
none
;
bool
get
shouldRunPub
=>
_usesPubOption
&&
boolArg
(
'pub'
);
bool
get
shouldRunPub
=>
_usesPubOption
&&
boolArg
Deprecated
(
'pub'
);
bool
get
shouldUpdateCache
=>
true
;
...
...
@@ -429,7 +429,7 @@ abstract class FlutterCommand extends Command<void> {
throwToolExit
(
'The "--[no-]dds" and "--[no-]disable-dds" arguments are mutually exclusive. Only specify "--[no-]dds".'
);
}
ddsEnabled
=
!
boolArg
(
'disable-dds'
);
ddsEnabled
=
!
boolArg
Deprecated
(
'disable-dds'
);
// TODO(ianh): enable the following code once google3 is migrated away from --disable-dds (and add test to flutter_command_test.dart)
if
(
false
)
{
// ignore: dead_code
if
(
ddsEnabled
)
{
...
...
@@ -441,7 +441,7 @@ abstract class FlutterCommand extends Command<void> {
}
}
}
else
{
ddsEnabled
=
boolArg
(
'dds'
);
ddsEnabled
=
boolArg
Deprecated
(
'dds'
);
}
return
ddsEnabled
;
}();
...
...
@@ -533,7 +533,7 @@ abstract class FlutterCommand extends Command<void> {
);
}
bool
get
disablePortPublication
=>
!
boolArg
(
'publish-port'
);
bool
get
disablePortPublication
=>
!
boolArg
Deprecated
(
'publish-port'
);
void
usesIpv6Flag
({
required
bool
verboseHelp
})
{
argParser
.
addFlag
(
ipv6Flag
,
...
...
@@ -546,7 +546,7 @@ abstract class FlutterCommand extends Command<void> {
_usesIpv6Flag
=
true
;
}
bool
?
get
ipv6
=>
_usesIpv6Flag
?
boolArg
(
'ipv6'
)
:
null
;
bool
?
get
ipv6
=>
_usesIpv6Flag
?
boolArg
Deprecated
(
'ipv6'
)
:
null
;
void
usesBuildNumberOption
()
{
argParser
.
addOption
(
'build-number'
,
...
...
@@ -893,13 +893,13 @@ abstract class FlutterCommand extends Command<void> {
BuildMode
getBuildMode
()
{
// No debug when _excludeDebug is true.
// If debug is not excluded, then take the command line flag.
final
bool
debugResult
=
!
_excludeDebug
&&
boolArg
(
'debug'
);
final
bool
jitReleaseResult
=
!
_excludeRelease
&&
boolArg
(
'jit-release'
);
final
bool
releaseResult
=
!
_excludeRelease
&&
boolArg
(
'release'
);
final
bool
debugResult
=
!
_excludeDebug
&&
boolArg
Deprecated
(
'debug'
);
final
bool
jitReleaseResult
=
!
_excludeRelease
&&
boolArg
Deprecated
(
'jit-release'
);
final
bool
releaseResult
=
!
_excludeRelease
&&
boolArg
Deprecated
(
'release'
);
final
List
<
bool
>
modeFlags
=
<
bool
>[
debugResult
,
jitReleaseResult
,
boolArg
(
'profile'
),
boolArg
Deprecated
(
'profile'
),
releaseResult
,
];
if
(
modeFlags
.
where
((
bool
flag
)
=>
flag
).
length
>
1
)
{
...
...
@@ -909,7 +909,7 @@ abstract class FlutterCommand extends Command<void> {
if
(
debugResult
)
{
return
BuildMode
.
debug
;
}
if
(
boolArg
(
'profile'
))
{
if
(
boolArg
Deprecated
(
'profile'
))
{
return
BuildMode
.
profile
;
}
if
(
releaseResult
)
{
...
...
@@ -977,7 +977,7 @@ abstract class FlutterCommand extends Command<void> {
/// each other.
Future
<
BuildInfo
>
getBuildInfo
({
BuildMode
?
forcedBuildMode
,
File
?
forcedTargetFile
})
async
{
final
bool
trackWidgetCreation
=
argParser
.
options
.
containsKey
(
'track-widget-creation'
)
&&
boolArg
(
'track-widget-creation'
);
boolArg
Deprecated
(
'track-widget-creation'
);
final
String
?
buildNumber
=
argParser
.
options
.
containsKey
(
'build-number'
)
?
stringArgDeprecated
(
'build-number'
)
...
...
@@ -1010,7 +1010,7 @@ abstract class FlutterCommand extends Command<void> {
}
String
?
codeSizeDirectory
;
if
(
argParser
.
options
.
containsKey
(
FlutterOptions
.
kAnalyzeSize
)
&&
boolArg
(
FlutterOptions
.
kAnalyzeSize
))
{
if
(
argParser
.
options
.
containsKey
(
FlutterOptions
.
kAnalyzeSize
)
&&
boolArg
Deprecated
(
FlutterOptions
.
kAnalyzeSize
))
{
Directory
directory
=
globals
.
fsUtils
.
getUniqueDirectory
(
globals
.
fs
.
directory
(
getBuildDirectory
()),
'flutter_size'
,
...
...
@@ -1046,7 +1046,7 @@ abstract class FlutterCommand extends Command<void> {
// This mode is only used for commands which do not build a single target like
// 'flutter test'.
nullSafetyMode
=
NullSafetyMode
.
autodetect
;
}
else
if
(
boolArg
(
FlutterOptions
.
kNullSafety
))
{
}
else
if
(
boolArg
Deprecated
(
FlutterOptions
.
kNullSafety
))
{
nullSafetyMode
=
NullSafetyMode
.
sound
;
extraFrontEndOptions
.
add
(
'--sound-null-safety'
);
}
else
{
...
...
@@ -1056,14 +1056,14 @@ abstract class FlutterCommand extends Command<void> {
}
final
bool
dartObfuscation
=
argParser
.
options
.
containsKey
(
FlutterOptions
.
kDartObfuscationOption
)
&&
boolArg
(
FlutterOptions
.
kDartObfuscationOption
);
&&
boolArg
Deprecated
(
FlutterOptions
.
kDartObfuscationOption
);
final
String
?
splitDebugInfoPath
=
argParser
.
options
.
containsKey
(
FlutterOptions
.
kSplitDebugInfoOption
)
?
stringArgDeprecated
(
FlutterOptions
.
kSplitDebugInfoOption
)
:
null
;
final
bool
androidGradleDaemon
=
!
argParser
.
options
.
containsKey
(
FlutterOptions
.
kAndroidGradleDaemon
)
||
boolArg
(
FlutterOptions
.
kAndroidGradleDaemon
);
||
boolArg
Deprecated
(
FlutterOptions
.
kAndroidGradleDaemon
);
final
List
<
String
>
androidProjectArgs
=
argParser
.
options
.
containsKey
(
FlutterOptions
.
kAndroidProjectArgs
)
?
stringsArg
(
FlutterOptions
.
kAndroidProjectArgs
)
...
...
@@ -1085,7 +1085,7 @@ abstract class FlutterCommand extends Command<void> {
final
bool
treeShakeIcons
=
argParser
.
options
.
containsKey
(
'tree-shake-icons'
)
&&
buildMode
.
isPrecompiled
==
true
&&
boolArg
(
'tree-shake-icons'
);
&&
boolArg
Deprecated
(
'tree-shake-icons'
);
final
String
?
bundleSkSLPath
=
argParser
.
options
.
containsKey
(
FlutterOptions
.
kBundleSkSLPathOption
)
?
stringArgDeprecated
(
FlutterOptions
.
kBundleSkSLPathOption
)
...
...
@@ -1141,7 +1141,7 @@ abstract class FlutterCommand extends Command<void> {
?
stringArgDeprecated
(
FlutterOptions
.
kInitializeFromDill
)
:
null
,
assumeInitializeFromDillUpToDate:
argParser
.
options
.
containsKey
(
FlutterOptions
.
kAssumeInitializeFromDillUpToDate
)
&&
boolArg
(
FlutterOptions
.
kAssumeInitializeFromDillUpToDate
),
&&
boolArg
Deprecated
(
FlutterOptions
.
kAssumeInitializeFromDillUpToDate
),
);
}
...
...
@@ -1180,7 +1180,7 @@ abstract class FlutterCommand extends Command<void> {
overrides:
<
Type
,
Generator
>{
FlutterCommand:
()
=>
this
},
body:
()
async
{
if
(
_usesFatalWarnings
)
{
globals
.
logger
.
fatalWarnings
=
boolArg
(
FlutterOptions
.
kFatalWarnings
);
globals
.
logger
.
fatalWarnings
=
boolArg
Deprecated
(
FlutterOptions
.
kFatalWarnings
);
}
// Prints the welcome message if needed.
globals
.
flutterUsage
.
printWelcome
();
...
...
@@ -1303,7 +1303,7 @@ abstract class FlutterCommand extends Command<void> {
// ios-deploy on macOS) are required to determine `requiredArtifacts`.
final
bool
offline
;
if
(
argParser
.
options
.
containsKey
(
'offline'
))
{
offline
=
boolArg
(
'offline'
);
offline
=
boolArg
Deprecated
(
'offline'
);
}
else
{
offline
=
false
;
}
...
...
@@ -1519,7 +1519,16 @@ abstract class FlutterCommand extends Command<void> {
ApplicationPackageFactory
?
applicationPackages
;
/// Gets the parsed command-line option named [name] as a `bool`.
bool
boolArg
(
String
name
)
=>
argResults
?[
name
]
as
bool
?
??
false
;
/// This has been deprecated, use [boolArgDeprecated] instead.
bool
boolArgDeprecated
(
String
name
)
=>
argResults
?[
name
]
as
bool
?
??
false
;
/// Gets the parsed command-line option named [name] as a `bool?`.
bool
?
boolArg
(
String
name
)
{
if
(
argResults
==
null
||
!
argParser
.
options
.
containsKey
(
name
))
{
return
null
;
}
return
argResults
?[
name
]
as
bool
?;
}
/// Gets the parsed command-line option named [name] as a `String`.
String
?
stringArgDeprecated
(
String
name
)
=>
argResults
?[
name
]
as
String
?;
...
...
packages/flutter_tools/test/general.shard/args_test.dart
View file @
f86dfdd2
...
...
@@ -13,6 +13,7 @@ import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
import
'../src/common.dart'
;
import
'../src/context.dart'
;
import
'../src/testbed.dart'
;
import
'runner/utils.dart'
;
class
CommandDummy
extends
FlutterCommand
{
@override
...
...
@@ -37,6 +38,29 @@ void main() {
verifyCommandRunner
(
runner
);
}));
testUsingContext
(
'bool? safe argResults'
,
()
async
{
final
DummyFlutterCommand
command
=
DummyFlutterCommand
(
commandFunction:
()
async
{
return
const
FlutterCommandResult
(
ExitStatus
.
success
);
}
);
final
FlutterCommandRunner
runner
=
FlutterCommandRunner
(
verboseHelp:
true
);
command
.
argParser
.
addFlag
(
'key'
);
command
.
argParser
.
addFlag
(
'key-false'
);
runner
.
addCommand
(
command
);
await
runner
.
run
(<
String
>[
'dummy'
,
'--key'
]);
expect
(
command
.
boolArg
(
'key'
),
true
);
expect
(
command
.
boolArg
(
'empty'
),
null
);
expect
(
command
.
boolArgDeprecated
(
'key'
),
true
);
expect
(()
=>
command
.
boolArgDeprecated
(
'empty'
),
throwsA
(
const
TypeMatcher
<
ArgumentError
>()));
expect
(
command
.
boolArg
(
'key-false'
),
false
);
expect
(
command
.
boolArgDeprecated
(
'key-false'
),
false
);
});
testUsingContext
(
'String? safe argResults'
,
()
async
{
final
CommandDummy
command
=
CommandDummy
();
final
FlutterCommandRunner
runner
=
FlutterCommandRunner
(
verboseHelp:
true
);
...
...
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