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
aa1df71c
Unverified
Commit
aa1df71c
authored
Mar 24, 2021
by
Jia Hao
Committed by
GitHub
Mar 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] throwToolExit should return Never (#78954)
parent
ea3d4dbd
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
5 additions
and
25 deletions
+5
-25
android_workflow.dart
packages/flutter_tools/lib/src/android/android_workflow.dart
+0
-1
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+0
-1
gradle_utils.dart
packages/flutter_tools/lib/src/android/gradle_utils.dart
+0
-2
common.dart
packages/flutter_tools/lib/src/base/common.dart
+1
-1
dds.dart
packages/flutter_tools/lib/src/base/dds.dart
+0
-1
os.dart
packages/flutter_tools/lib/src/base/os.dart
+4
-4
attach.dart
packages/flutter_tools/lib/src/commands/attach.dart
+0
-1
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+0
-1
fuchsia_device.dart
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
+0
-4
resident_web_runner.dart
...s/flutter_tools/lib/src/isolated/resident_web_runner.dart
+0
-1
cocoapods.dart
packages/flutter_tools/lib/src/macos/cocoapods.dart
+0
-1
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+0
-2
template.dart
packages/flutter_tools/lib/src/template.dart
+0
-1
flutter_web_platform.dart
...ages/flutter_tools/lib/src/test/flutter_web_platform.dart
+0
-1
chrome.dart
packages/flutter_tools/lib/src/web/chrome.dart
+0
-1
flutter_command_test.dart
...tools/test/general.shard/runner/flutter_command_test.dart
+0
-2
No files found.
packages/flutter_tools/lib/src/android/android_workflow.dart
View file @
aa1df71c
...
...
@@ -452,7 +452,6 @@ class AndroidLicenseValidator extends DoctorValidator {
e
.
toString
(),
_platform
,
));
return
false
;
}
}
...
...
packages/flutter_tools/lib/src/android/gradle.dart
View file @
aa1df71c
...
...
@@ -1083,7 +1083,6 @@ String _getLocalArtifactVersion(String pomPath, FileSystem fileSystem) {
}
}
throwToolExit
(
'Error while parsing the <version> element from
$pomPath
'
);
return
null
;
}
/// Returns the local Maven repository for a local engine build.
...
...
packages/flutter_tools/lib/src/android/gradle_utils.dart
View file @
aa1df71c
...
...
@@ -65,7 +65,6 @@ class GradleUtils {
'Unable to locate gradlew script. Please check that
${gradle.path}
'
'exists or that
${gradle.dirname}
can be read.'
);
return
null
;
}
/// Injects the Gradle wrapper files if any of these files don't exist in [directory].
...
...
@@ -180,7 +179,6 @@ String getGradleVersionFor(String androidPluginVersion) {
return
'6.7'
;
}
throwToolExit
(
'Unsupported Android Plugin version:
$androidPluginVersion
.'
);
return
''
;
}
/// Overwrite local.properties in the specified Flutter project's Android
...
...
packages/flutter_tools/lib/src/base/common.dart
View file @
aa1df71c
...
...
@@ -6,7 +6,7 @@
/// where the tool should exit with a clear message to the user
/// and no stack trace unless the --verbose option is specified.
/// For example: network errors.
void
throwToolExit
(
String
message
,
{
int
?
exitCode
})
{
Never
throwToolExit
(
String
message
,
{
int
?
exitCode
})
{
throw
ToolExit
(
message
,
exitCode:
exitCode
);
}
...
...
packages/flutter_tools/lib/src/base/dds.dart
View file @
aa1df71c
...
...
@@ -76,7 +76,6 @@ class DartDevelopmentService {
}
on
StateError
{
if
(
e
.
message
.
contains
(
'Existing VM service clients prevent DDS from taking control.'
))
{
throwToolExit
(
'
${e.message}
. Please rebuild your application with a newer version of Flutter.'
);
return
;
}
logger
.
printError
(
'DDS has failed to start and there is not an existing DDS instance '
...
...
packages/flutter_tools/lib/src/base/os.dart
View file @
aa1df71c
...
...
@@ -338,7 +338,7 @@ class _MacOSUtils extends _PosixUtils {
throwToolExit
(
'sysctl not found. Try adding it to your PATH environment variable.'
);
}
final
RunResult
arm64Check
=
_processUtils
.
runSync
(<
String
>[
sysctlPath
!
,
'hw.optional.arm64'
]);
_processUtils
.
runSync
(<
String
>[
sysctlPath
,
'hw.optional.arm64'
]);
// On arm64 stdout is "sysctl hw.optional.arm64: 1"
// On x86 hw.optional.arm64 is unavailable and exits with 1.
if
(
arm64Check
.
exitCode
==
0
&&
arm64Check
.
stdout
.
trim
().
endsWith
(
'1'
))
{
...
...
@@ -376,7 +376,7 @@ class _WindowsUtils extends OperatingSystemUtils {
@override
List
<
File
>
_which
(
String
execName
,
{
bool
all
=
false
})
{
// `where` always returns all matches, not just the first one.
ProcessResult
?
result
;
ProcessResult
result
;
try
{
result
=
_processManager
.
runSync
(<
String
>[
'where'
,
execName
]);
}
on
ArgumentError
{
...
...
@@ -388,10 +388,10 @@ class _WindowsUtils extends OperatingSystemUtils {
'the terminal and/or IDE.'
);
}
if
(
result
?
.
exitCode
!=
0
)
{
if
(
result
.
exitCode
!=
0
)
{
return
const
<
File
>[];
}
final
List
<
String
>
lines
=
(
result
!
.
stdout
as
String
).
trim
().
split
(
'
\n
'
);
final
List
<
String
>
lines
=
(
result
.
stdout
as
String
).
trim
().
split
(
'
\n
'
);
if
(
all
)
{
return
lines
.
map
<
File
>((
String
path
)
=>
_fileSystem
.
file
(
path
.
trim
())).
toList
();
}
...
...
packages/flutter_tools/lib/src/commands/attach.dart
View file @
aa1df71c
...
...
@@ -149,7 +149,6 @@ known, it can be explicitly provided to attach via the command-line, e.g.
}
on
Exception
catch
(
error
)
{
throwToolExit
(
'Invalid port for `--debug-port`:
$error
'
);
}
return
null
;
}
Uri
get
debugUri
{
...
...
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
aa1df71c
...
...
@@ -220,7 +220,6 @@ class UpgradeCommandRunner {
'Error:
$error
.'
);
}
return
false
;
}
/// Returns the remote HEAD flutter version.
...
...
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
View file @
aa1df71c
...
...
@@ -622,13 +622,11 @@ class FuchsiaDevice extends Device {
final
RunResult
findResult
=
await
shell
(
findCommand
);
if
(
findResult
.
exitCode
!=
0
)
{
throwToolExit
(
"'
$findCommand
' on device
$name
failed. stderr: '
${findResult.stderr}
'"
);
return
null
;
}
final
String
findOutput
=
findResult
.
stdout
;
if
(
findOutput
.
trim
()
==
''
)
{
throwToolExit
(
'No Dart Observatories found. Are you running a debug build?'
);
return
null
;
}
final
List
<
int
>
ports
=
<
int
>[];
for
(
final
String
path
in
findOutput
.
split
(
'
\n
'
))
{
...
...
@@ -639,7 +637,6 @@ class FuchsiaDevice extends Device {
final
RunResult
lsResult
=
await
shell
(
lsCommand
);
if
(
lsResult
.
exitCode
!=
0
)
{
throwToolExit
(
"'
$lsCommand
' on device
$name
failed"
);
return
null
;
}
final
String
lsOutput
=
lsResult
.
stdout
;
for
(
final
String
line
in
lsOutput
.
split
(
'
\n
'
))
{
...
...
@@ -715,7 +712,6 @@ class FuchsiaDevice extends Device {
}
}
throwToolExit
(
'No ports found running
$isolateName
'
);
return
null
;
}
FuchsiaIsolateDiscoveryProtocol
getIsolateDiscoveryProtocol
(
String
isolateName
)
{
...
...
packages/flutter_tools/lib/src/isolated/resident_web_runner.dart
View file @
aa1df71c
...
...
@@ -563,7 +563,6 @@ class ResidentWebRunner extends ResidentRunner {
appFailedToStart
();
rethrow
;
}
return
0
;
}
@override
...
...
packages/flutter_tools/lib/src/macos/cocoapods.dart
View file @
aa1df71c
...
...
@@ -392,7 +392,6 @@ class CocoaPods {
'To regenerate the Podfile, run:
\n
'
'
$podfileIosMigrationInstructions
\n
'
,
);
return
;
}
}
// Most of the pod and plugin parsing logic was moved from the Podfile
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
aa1df71c
...
...
@@ -378,7 +378,6 @@ abstract class FlutterCommand extends Command<void> {
}
on
FormatException
catch
(
error
)
{
throwToolExit
(
'Invalid port for `--observatory-port/--host-vmservice-port`:
$error
'
);
}
return
null
;
}
int
get
ddsPort
{
...
...
@@ -440,7 +439,6 @@ abstract class FlutterCommand extends Command<void> {
}
on
FormatException
catch
(
error
)
{
throwToolExit
(
'Invalid port for `--device-vmservice-port`:
$error
'
);
}
return
null
;
}
void
addPublishPort
({
bool
enabledByDefault
=
true
,
bool
verboseHelp
=
false
})
{
...
...
packages/flutter_tools/lib/src/template.dart
View file @
aa1df71c
...
...
@@ -112,7 +112,6 @@ class Template {
}
on
FileSystemException
catch
(
err
)
{
_logger
.
printError
(
err
.
toString
());
throwToolExit
(
'Failed to flutter create at
${destination.path}
.'
);
return
0
;
}
int
fileCount
=
0
;
...
...
packages/flutter_tools/lib/src/test/flutter_web_platform.dart
View file @
aa1df71c
...
...
@@ -638,7 +638,6 @@ class BrowserManager {
return
completer
.
future
.
timeout
(
const
Duration
(
seconds:
30
),
onTimeout:
()
{
chrome
.
close
();
throwToolExit
(
'Timed out waiting for
${runtime.name}
to connect.'
);
return
;
});
}
...
...
packages/flutter_tools/lib/src/web/chrome.dart
View file @
aa1df71c
...
...
@@ -81,7 +81,6 @@ String findChromeExecutable(Platform platform, FileSystem fileSystem) {
return
fileSystem
.
path
.
join
(
windowsPrefix
,
kWindowsExecutable
);
}
throwToolExit
(
'Platform
${platform.operatingSystem}
is not supported.'
);
return
null
;
}
/// Find the Microsoft Edge executable on the current platform.
...
...
packages/flutter_tools/test/general.shard/runner/flutter_command_test.dart
View file @
aa1df71c
...
...
@@ -241,7 +241,6 @@ void main() {
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
commandFunction:
()
async
{
throwToolExit
(
'fail'
);
return
null
;
// unreachable
}
);
try
{
...
...
@@ -469,7 +468,6 @@ void main() {
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
commandFunction:
()
async
{
throwToolExit
(
'fail'
);
return
null
;
// unreachable
},
);
...
...
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