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
73c10e8c
Unverified
Commit
73c10e8c
authored
Sep 12, 2019
by
Zachary Anderson
Committed by
GitHub
Sep 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tool] process.dart cleanup (#39899)
parent
3712ea63
Changes
45
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
1274 additions
and
762 deletions
+1274
-762
android_device.dart
packages/flutter_tools/lib/src/android/android_device.dart
+102
-51
android_emulator.dart
packages/flutter_tools/lib/src/android/android_emulator.dart
+7
-10
android_sdk.dart
packages/flutter_tools/lib/src/android/android_sdk.dart
+11
-5
android_studio.dart
packages/flutter_tools/lib/src/android/android_studio.dart
+2
-2
android_workflow.dart
packages/flutter_tools/lib/src/android/android_workflow.dart
+2
-2
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+23
-13
application_package.dart
packages/flutter_tools/lib/src/application_package.dart
+12
-8
build.dart
packages/flutter_tools/lib/src/base/build.dart
+4
-1
os.dart
packages/flutter_tools/lib/src/base/os.dart
+26
-11
process.dart
packages/flutter_tools/lib/src/base/process.dart
+380
-374
build_aot.dart
packages/flutter_tools/lib/src/commands/build_aot.dart
+15
-10
channel.dart
packages/flutter_tools/lib/src/commands/channel.dart
+5
-5
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+1
-1
format.dart
packages/flutter_tools/lib/src/commands/format.dart
+3
-2
unpack.dart
packages/flutter_tools/lib/src/commands/unpack.dart
+2
-3
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+19
-13
version.dart
packages/flutter_tools/lib/src/commands/version.dart
+6
-4
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+2
-0
pub.dart
packages/flutter_tools/lib/src/dart/pub.dart
+23
-6
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+2
-2
emulator.dart
packages/flutter_tools/lib/src/emulator.dart
+6
-6
fuchsia_dev_finder.dart
...ges/flutter_tools/lib/src/fuchsia/fuchsia_dev_finder.dart
+2
-2
fuchsia_device.dart
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
+1
-1
fuchsia_kernel_compiler.dart
...lutter_tools/lib/src/fuchsia/fuchsia_kernel_compiler.dart
+1
-1
fuchsia_pm.dart
packages/flutter_tools/lib/src/fuchsia/fuchsia_pm.dart
+2
-2
code_signing.dart
packages/flutter_tools/lib/src/ios/code_signing.dart
+21
-11
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+8
-5
ios_emulators.dart
packages/flutter_tools/lib/src/ios/ios_emulators.dart
+1
-1
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+16
-10
plist_parser.dart
packages/flutter_tools/lib/src/ios/plist_parser.dart
+6
-2
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+31
-17
xcodeproj.dart
packages/flutter_tools/lib/src/ios/xcodeproj.dart
+28
-18
cocoapods.dart
packages/flutter_tools/lib/src/macos/cocoapods.dart
+3
-2
xcode.dart
packages/flutter_tools/lib/src/macos/xcode.dart
+23
-10
coverage_collector.dart
packages/flutter_tools/lib/src/test/coverage_collector.dart
+2
-2
version.dart
packages/flutter_tools/lib/src/version.dart
+4
-1
visual_studio.dart
packages/flutter_tools/lib/src/windows/visual_studio.dart
+2
-2
windows_device.dart
packages/flutter_tools/lib/src/windows/windows_device.dart
+8
-4
application_package_test.dart
...er_tools/test/general.shard/application_package_test.dart
+1
-1
process_test.dart
...s/flutter_tools/test/general.shard/base/process_test.dart
+226
-12
code_signing_test.dart
...utter_tools/test/general.shard/ios/code_signing_test.dart
+160
-102
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+22
-4
xcodeproj_test.dart
.../flutter_tools/test/general.shard/ios/xcodeproj_test.dart
+4
-1
visual_studio_test.dart
..._tools/test/general.shard/windows/visual_studio_test.dart
+38
-16
windows_device_test.dart
...tools/test/general.shard/windows/windows_device_test.dart
+11
-6
No files found.
packages/flutter_tools/lib/src/android/android_device.dart
View file @
73c10e8c
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/android/android_emulator.dart
View file @
73c10e8c
...
@@ -9,8 +9,7 @@ import 'package:meta/meta.dart';
...
@@ -9,8 +9,7 @@ import 'package:meta/meta.dart';
import
'../android/android_sdk.dart'
;
import
'../android/android_sdk.dart'
;
import
'../android/android_workflow.dart'
;
import
'../android/android_workflow.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/process.dart'
;
import
'../base/process_manager.dart'
;
import
'../device.dart'
;
import
'../device.dart'
;
import
'../emulator.dart'
;
import
'../emulator.dart'
;
import
'android_sdk.dart'
;
import
'android_sdk.dart'
;
...
@@ -50,13 +49,10 @@ class AndroidEmulator extends Emulator {
...
@@ -50,13 +49,10 @@ class AndroidEmulator extends Emulator {
@override
@override
Future
<
void
>
launch
()
async
{
Future
<
void
>
launch
()
async
{
final
Future
<
void
>
launchResult
=
final
Future
<
void
>
launchResult
=
processUtils
.
run
(
processManager
.
run
(<
String
>[
getEmulatorPath
(),
'-avd'
,
id
])
<
String
>[
getEmulatorPath
(),
'-avd'
,
id
],
.
then
((
ProcessResult
runResult
)
{
throwOnError:
true
,
if
(
runResult
.
exitCode
!=
0
)
{
);
throw
'
${runResult.stdout}
\n
${runResult.stderr}
'
.
trimRight
();
}
});
// The emulator continues running on a successful launch, so if it hasn't
// The emulator continues running on a successful launch, so if it hasn't
// quit within 3 seconds we assume that's a success and just return. This
// quit within 3 seconds we assume that's a success and just return. This
// means that on a slow machine, a failure that takes more than three
// means that on a slow machine, a failure that takes more than three
...
@@ -75,7 +71,8 @@ List<AndroidEmulator> getEmulatorAvds() {
...
@@ -75,7 +71,8 @@ List<AndroidEmulator> getEmulatorAvds() {
return
<
AndroidEmulator
>[];
return
<
AndroidEmulator
>[];
}
}
final
String
listAvdsOutput
=
processManager
.
runSync
(<
String
>[
emulatorPath
,
'-list-avds'
]).
stdout
;
final
String
listAvdsOutput
=
processUtils
.
runSync
(
<
String
>[
emulatorPath
,
'-list-avds'
]).
stdout
.
trim
();
final
List
<
AndroidEmulator
>
emulators
=
<
AndroidEmulator
>[];
final
List
<
AndroidEmulator
>
emulators
=
<
AndroidEmulator
>[];
if
(
listAvdsOutput
!=
null
)
{
if
(
listAvdsOutput
!=
null
)
{
...
...
packages/flutter_tools/lib/src/android/android_sdk.dart
View file @
73c10e8c
...
@@ -7,7 +7,6 @@ import 'package:meta/meta.dart';
...
@@ -7,7 +7,6 @@ import 'package:meta/meta.dart';
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/context.dart'
;
import
'../base/context.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
show
ProcessResult
;
import
'../base/os.dart'
;
import
'../base/os.dart'
;
import
'../base/platform.dart'
;
import
'../base/platform.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
...
@@ -526,9 +525,9 @@ class AndroidSdk {
...
@@ -526,9 +525,9 @@ class AndroidSdk {
/// First try Java bundled with Android Studio, then sniff JAVA_HOME, then fallback to PATH.
/// First try Java bundled with Android Studio, then sniff JAVA_HOME, then fallback to PATH.
static
String
findJavaBinary
()
{
static
String
findJavaBinary
()
{
if
(
android_studio
.
javaPath
!=
null
)
{
if
(
android_studio
.
javaPath
!=
null
)
return
fs
.
path
.
join
(
android_studio
.
javaPath
,
'bin'
,
'java'
);
return
fs
.
path
.
join
(
android_studio
.
javaPath
,
'bin'
,
'java'
);
}
final
String
javaHomeEnv
=
platform
.
environment
[
_javaHomeEnvironmentVariable
];
final
String
javaHomeEnv
=
platform
.
environment
[
_javaHomeEnvironmentVariable
];
if
(
javaHomeEnv
!=
null
)
{
if
(
javaHomeEnv
!=
null
)
{
...
@@ -540,7 +539,11 @@ class AndroidSdk {
...
@@ -540,7 +539,11 @@ class AndroidSdk {
// See: http://stackoverflow.com/questions/14292698/how-do-i-check-if-the-java-jdk-is-installed-on-mac.
// See: http://stackoverflow.com/questions/14292698/how-do-i-check-if-the-java-jdk-is-installed-on-mac.
if
(
platform
.
isMacOS
)
{
if
(
platform
.
isMacOS
)
{
try
{
try
{
final
String
javaHomeOutput
=
runCheckedSync
(<
String
>[
'/usr/libexec/java_home'
],
hideStdout:
true
);
final
String
javaHomeOutput
=
processUtils
.
runSync
(
<
String
>[
'/usr/libexec/java_home'
],
throwOnError:
true
,
hideStdout:
true
,
).
stdout
.
trim
();
if
(
javaHomeOutput
!=
null
)
{
if
(
javaHomeOutput
!=
null
)
{
final
List
<
String
>
javaHomeOutputSplit
=
javaHomeOutput
.
split
(
'
\n
'
);
final
List
<
String
>
javaHomeOutputSplit
=
javaHomeOutput
.
split
(
'
\n
'
);
if
((
javaHomeOutputSplit
!=
null
)
&&
(
javaHomeOutputSplit
.
isNotEmpty
))
{
if
((
javaHomeOutputSplit
!=
null
)
&&
(
javaHomeOutputSplit
.
isNotEmpty
))
{
...
@@ -575,7 +578,10 @@ class AndroidSdk {
...
@@ -575,7 +578,10 @@ class AndroidSdk {
String
get
sdkManagerVersion
{
String
get
sdkManagerVersion
{
if
(!
processManager
.
canRun
(
sdkManagerPath
))
if
(!
processManager
.
canRun
(
sdkManagerPath
))
throwToolExit
(
'Android sdkmanager not found. Update to the latest Android SDK to resolve this.'
);
throwToolExit
(
'Android sdkmanager not found. Update to the latest Android SDK to resolve this.'
);
final
ProcessResult
result
=
processManager
.
runSync
(<
String
>[
sdkManagerPath
,
'--version'
],
environment:
sdkManagerEnv
);
final
RunResult
result
=
processUtils
.
runSync
(
<
String
>[
sdkManagerPath
,
'--version'
],
environment:
sdkManagerEnv
,
);
if
(
result
.
exitCode
!=
0
)
{
if
(
result
.
exitCode
!=
0
)
{
printTrace
(
'sdkmanager --version failed: exitCode:
${result.exitCode}
stdout:
${result.stdout}
stderr:
${result.stderr}
'
);
printTrace
(
'sdkmanager --version failed: exitCode:
${result.exitCode}
stdout:
${result.stdout}
stderr:
${result.stderr}
'
);
return
null
;
return
null
;
...
...
packages/flutter_tools/lib/src/android/android_studio.dart
View file @
73c10e8c
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/context.dart'
;
import
'../base/context.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/platform.dart'
;
import
'../base/platform.dart'
;
import
'../base/process.dart'
;
import
'../base/process_manager.dart'
;
import
'../base/process_manager.dart'
;
import
'../base/version.dart'
;
import
'../base/version.dart'
;
import
'../globals.dart'
;
import
'../globals.dart'
;
...
@@ -290,7 +290,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
...
@@ -290,7 +290,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
if
(!
processManager
.
canRun
(
javaExecutable
))
{
if
(!
processManager
.
canRun
(
javaExecutable
))
{
_validationMessages
.
add
(
'Unable to find bundled Java version.'
);
_validationMessages
.
add
(
'Unable to find bundled Java version.'
);
}
else
{
}
else
{
final
ProcessResult
result
=
processManager
.
runSync
(<
String
>[
javaExecutable
,
'-version'
]);
final
RunResult
result
=
processUtils
.
runSync
(<
String
>[
javaExecutable
,
'-version'
]);
if
(
result
.
exitCode
==
0
)
{
if
(
result
.
exitCode
==
0
)
{
final
List
<
String
>
versionLines
=
result
.
stderr
.
split
(
'
\n
'
);
final
List
<
String
>
versionLines
=
result
.
stderr
.
split
(
'
\n
'
);
final
String
javaVersion
=
versionLines
.
length
>=
2
?
versionLines
[
1
]
:
versionLines
[
0
];
final
String
javaVersion
=
versionLines
.
length
>=
2
?
versionLines
[
1
]
:
versionLines
[
0
];
...
...
packages/flutter_tools/lib/src/android/android_workflow.dart
View file @
73c10e8c
...
@@ -259,7 +259,7 @@ class AndroidLicenseValidator extends DoctorValidator {
...
@@ -259,7 +259,7 @@ class AndroidLicenseValidator extends DoctorValidator {
}
}
try
{
try
{
final
Process
process
=
await
runCommand
(
final
Process
process
=
await
processUtils
.
start
(
<
String
>[
androidSdk
.
sdkManagerPath
,
'--licenses'
],
<
String
>[
androidSdk
.
sdkManagerPath
,
'--licenses'
],
environment:
androidSdk
.
sdkManagerEnv
,
environment:
androidSdk
.
sdkManagerEnv
,
);
);
...
@@ -302,7 +302,7 @@ class AndroidLicenseValidator extends DoctorValidator {
...
@@ -302,7 +302,7 @@ class AndroidLicenseValidator extends DoctorValidator {
}
}
try
{
try
{
final
Process
process
=
await
runCommand
(
final
Process
process
=
await
processUtils
.
start
(
<
String
>[
androidSdk
.
sdkManagerPath
,
'--licenses'
],
<
String
>[
androidSdk
.
sdkManagerPath
,
'--licenses'
],
environment:
androidSdk
.
sdkManagerEnv
,
environment:
androidSdk
.
sdkManagerEnv
,
);
);
...
...
packages/flutter_tools/lib/src/android/gradle.dart
View file @
73c10e8c
...
@@ -145,8 +145,9 @@ Future<void> checkGradleDependencies() async {
...
@@ -145,8 +145,9 @@ Future<void> checkGradleDependencies() async {
final
Status
progress
=
logger
.
startProgress
(
'Ensuring gradle dependencies are up to date...'
,
timeout:
timeoutConfiguration
.
slowOperation
);
final
Status
progress
=
logger
.
startProgress
(
'Ensuring gradle dependencies are up to date...'
,
timeout:
timeoutConfiguration
.
slowOperation
);
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
String
gradlew
=
await
gradleUtils
.
getExecutable
(
flutterProject
);
final
String
gradlew
=
await
gradleUtils
.
getExecutable
(
flutterProject
);
await
runCheckedAsync
(
await
processUtils
.
run
(
<
String
>[
gradlew
,
'dependencies'
],
<
String
>[
gradlew
,
'dependencies'
],
throwOnError:
true
,
workingDirectory:
flutterProject
.
android
.
hostAppGradleRoot
.
path
,
workingDirectory:
flutterProject
.
android
.
hostAppGradleRoot
.
path
,
environment:
_gradleEnv
,
environment:
_gradleEnv
,
);
);
...
@@ -234,13 +235,15 @@ Future<GradleProject> _readGradleProject({bool isLibrary = false}) async {
...
@@ -234,13 +235,15 @@ Future<GradleProject> _readGradleProject({bool isLibrary = false}) async {
// Get the properties and tasks from Gradle, so we can determinate the `buildDir`,
// Get the properties and tasks from Gradle, so we can determinate the `buildDir`,
// flavors and build types defined in the project. If gradle fails, then check if the failure is due to t
// flavors and build types defined in the project. If gradle fails, then check if the failure is due to t
try
{
try
{
final
RunResult
propertiesRunResult
=
await
runCheckedAsync
(
final
RunResult
propertiesRunResult
=
await
processUtils
.
run
(
<
String
>[
gradlew
,
isLibrary
?
'properties'
:
'app:properties'
],
<
String
>[
gradlew
,
isLibrary
?
'properties'
:
'app:properties'
],
throwOnError:
true
,
workingDirectory:
hostAppGradleRoot
.
path
,
workingDirectory:
hostAppGradleRoot
.
path
,
environment:
_gradleEnv
,
environment:
_gradleEnv
,
);
);
final
RunResult
tasksRunResult
=
await
runCheckedAsync
(
final
RunResult
tasksRunResult
=
await
processUtils
.
run
(
<
String
>[
gradlew
,
isLibrary
?
'tasks'
:
'app:tasks'
,
'--all'
,
'--console=auto'
],
<
String
>[
gradlew
,
isLibrary
?
'tasks'
:
'app:tasks'
,
'--all'
,
'--console=auto'
],
throwOnError:
true
,
workingDirectory:
hostAppGradleRoot
.
path
,
workingDirectory:
hostAppGradleRoot
.
path
,
environment:
_gradleEnv
,
environment:
_gradleEnv
,
);
);
...
@@ -306,22 +309,29 @@ Future<String> _initializeGradle(FlutterProject project) async {
...
@@ -306,22 +309,29 @@ Future<String> _initializeGradle(FlutterProject project) async {
injectGradleWrapperIfNeeded
(
android
);
injectGradleWrapperIfNeeded
(
android
);
final
String
gradle
=
_locateGradlewExecutable
(
android
);
final
String
gradle
=
_locateGradlewExecutable
(
android
);
if
(
gradle
==
null
)
if
(
gradle
==
null
)
{
status
.
stop
();
throwToolExit
(
'Unable to locate gradlew script'
);
throwToolExit
(
'Unable to locate gradlew script'
);
}
printTrace
(
'Using gradle from
$gradle
.'
);
printTrace
(
'Using gradle from
$gradle
.'
);
// Validates the Gradle executable by asking for its version.
// Validates the Gradle executable by asking for its version.
// Makes Gradle Wrapper download and install Gradle distribution, if needed.
// Makes Gradle Wrapper download and install Gradle distribution, if needed.
try
{
try
{
await
runCheckedAsync
(<
String
>[
gradle
,
'-v'
],
environment:
_gradleEnv
);
await
processUtils
.
run
(
}
catch
(
e
)
{
<
String
>[
gradle
,
'-v'
],
if
(
e
is
ProcessException
&&
throwOnError:
true
,
e
.
toString
().
contains
(
'java.io.FileNotFoundException: https://downloads.gradle.org'
)
||
environment:
_gradleEnv
,
e
.
toString
().
contains
(
'java.io.IOException: Unable to tunnel through proxy'
))
{
);
}
on
ProcessException
catch
(
e
)
{
final
String
error
=
e
.
toString
();
if
(
error
.
contains
(
'java.io.FileNotFoundException: https://downloads.gradle.org'
)
||
error
.
contains
(
'java.io.IOException: Unable to tunnel through proxy'
))
{
throwToolExit
(
'
$gradle
threw an error while trying to update itself.
\n
$e
'
);
throwToolExit
(
'
$gradle
threw an error while trying to update itself.
\n
$e
'
);
}
}
rethrow
;
rethrow
;
}
finally
{
status
.
stop
();
}
}
status
.
stop
();
return
gradle
;
return
gradle
;
}
}
...
@@ -595,7 +605,7 @@ Future<void> buildGradleAar({
...
@@ -595,7 +605,7 @@ Future<void> buildGradleAar({
int
exitCode
=
1
;
int
exitCode
=
1
;
try
{
try
{
exitCode
=
await
runCommandAndStreamOutput
(
exitCode
=
await
processUtils
.
stream
(
command
,
command
,
workingDirectory:
project
.
android
.
hostAppGradleRoot
.
path
,
workingDirectory:
project
.
android
.
hostAppGradleRoot
.
path
,
allowReentrantFlutter:
true
,
allowReentrantFlutter:
true
,
...
@@ -633,7 +643,7 @@ Future<void> _buildGradleProjectV1(FlutterProject project) async {
...
@@ -633,7 +643,7 @@ Future<void> _buildGradleProjectV1(FlutterProject project) async {
multilineOutput:
true
,
multilineOutput:
true
,
);
);
final
Stopwatch
sw
=
Stopwatch
()..
start
();
final
Stopwatch
sw
=
Stopwatch
()..
start
();
final
int
exitCode
=
await
runCommandAndStreamOutput
(
final
int
exitCode
=
await
processUtils
.
stream
(
<
String
>[
fs
.
file
(
gradlew
).
absolute
.
path
,
'build'
],
<
String
>[
fs
.
file
(
gradlew
).
absolute
.
path
,
'build'
],
workingDirectory:
project
.
android
.
hostAppGradleRoot
.
path
,
workingDirectory:
project
.
android
.
hostAppGradleRoot
.
path
,
allowReentrantFlutter:
true
,
allowReentrantFlutter:
true
,
...
@@ -756,7 +766,7 @@ Future<void> _buildGradleProjectV2(
...
@@ -756,7 +766,7 @@ Future<void> _buildGradleProjectV2(
final
Stopwatch
sw
=
Stopwatch
()..
start
();
final
Stopwatch
sw
=
Stopwatch
()..
start
();
int
exitCode
=
1
;
int
exitCode
=
1
;
try
{
try
{
exitCode
=
await
runCommandAndStreamOutput
(
exitCode
=
await
processUtils
.
stream
(
command
,
command
,
workingDirectory:
flutterProject
.
android
.
hostAppGradleRoot
.
path
,
workingDirectory:
flutterProject
.
android
.
hostAppGradleRoot
.
path
,
allowReentrantFlutter:
true
,
allowReentrantFlutter:
true
,
...
...
packages/flutter_tools/lib/src/application_package.dart
View file @
73c10e8c
...
@@ -13,6 +13,7 @@ import 'android/gradle.dart';
...
@@ -13,6 +13,7 @@ import 'android/gradle.dart';
import
'base/common.dart'
;
import
'base/common.dart'
;
import
'base/context.dart'
;
import
'base/context.dart'
;
import
'base/file_system.dart'
;
import
'base/file_system.dart'
;
import
'base/io.dart'
;
import
'base/os.dart'
show
os
;
import
'base/os.dart'
show
os
;
import
'base/process.dart'
;
import
'base/process.dart'
;
import
'base/user_messages.dart'
;
import
'base/user_messages.dart'
;
...
@@ -115,14 +116,17 @@ class AndroidApk extends ApplicationPackage {
...
@@ -115,14 +116,17 @@ class AndroidApk extends ApplicationPackage {
String
apptStdout
;
String
apptStdout
;
try
{
try
{
apptStdout
=
runCheckedSync
(<
String
>[
apptStdout
=
processUtils
.
runSync
(
aaptPath
,
<
String
>[
'dump'
,
aaptPath
,
'xmltree'
,
'dump'
,
apk
.
path
,
'xmltree'
,
'AndroidManifest.xml'
,
apk
.
path
,
]);
'AndroidManifest.xml'
,
}
catch
(
error
)
{
],
throwOnError:
true
,
).
stdout
.
trim
();
}
on
ProcessException
catch
(
error
)
{
printError
(
'Failed to extract manifest from APK:
$error
.'
);
printError
(
'Failed to extract manifest from APK:
$error
.'
);
return
null
;
return
null
;
}
}
...
...
packages/flutter_tools/lib/src/base/build.dart
View file @
73c10e8c
...
@@ -69,7 +69,10 @@ class GenSnapshot {
...
@@ -69,7 +69,10 @@ class GenSnapshot {
outputFilter
=
(
String
line
)
=>
line
!=
kStripWarning
?
line
:
null
;
outputFilter
=
(
String
line
)
=>
line
!=
kStripWarning
?
line
:
null
;
}
}
return
runCommandAndStreamOutput
(<
String
>[
snapshotterPath
,
...
args
],
mapFunction:
outputFilter
);
return
processUtils
.
stream
(
<
String
>[
snapshotterPath
,
...
args
],
mapFunction:
outputFilter
,
);
}
}
}
}
...
...
packages/flutter_tools/lib/src/base/os.dart
View file @
73c10e8c
...
@@ -154,30 +154,45 @@ class _PosixUtils extends OperatingSystemUtils {
...
@@ -154,30 +154,45 @@ class _PosixUtils extends OperatingSystemUtils {
@override
@override
void
zip
(
Directory
data
,
File
zipFile
)
{
void
zip
(
Directory
data
,
File
zipFile
)
{
runSync
(<
String
>[
'zip'
,
'-r'
,
'-q'
,
zipFile
.
path
,
'.'
],
workingDirectory:
data
.
path
);
processUtils
.
runSync
(
<
String
>[
'zip'
,
'-r'
,
'-q'
,
zipFile
.
path
,
'.'
],
workingDirectory:
data
.
path
,
throwOnError:
true
,
);
}
}
// unzip -o -q zipfile -d dest
// unzip -o -q zipfile -d dest
@override
@override
void
unzip
(
File
file
,
Directory
targetDirectory
)
{
void
unzip
(
File
file
,
Directory
targetDirectory
)
{
runSync
(<
String
>[
'unzip'
,
'-o'
,
'-q'
,
file
.
path
,
'-d'
,
targetDirectory
.
path
]);
processUtils
.
runSync
(
<
String
>[
'unzip'
,
'-o'
,
'-q'
,
file
.
path
,
'-d'
,
targetDirectory
.
path
],
throwOnError:
true
,
);
}
}
@override
@override
bool
verifyZip
(
File
zipFile
)
=>
exitsHappy
(<
String
>[
'zip'
,
'-T'
,
zipFile
.
path
]);
bool
verifyZip
(
File
zipFile
)
=>
processUtils
.
exitsHappySync
(<
String
>[
'zip'
,
'-T'
,
zipFile
.
path
]);
// tar -xzf tarball -C dest
// tar -xzf tarball -C dest
@override
@override
void
unpack
(
File
gzippedTarFile
,
Directory
targetDirectory
)
{
void
unpack
(
File
gzippedTarFile
,
Directory
targetDirectory
)
{
runSync
(<
String
>[
'tar'
,
'-xzf'
,
gzippedTarFile
.
path
,
'-C'
,
targetDirectory
.
path
]);
processUtils
.
runSync
(
<
String
>[
'tar'
,
'-xzf'
,
gzippedTarFile
.
path
,
'-C'
,
targetDirectory
.
path
],
throwOnError:
true
,
);
}
}
@override
@override
bool
verifyGzip
(
File
gzippedFile
)
=>
exitsHappy
(<
String
>[
'gzip'
,
'-t'
,
gzippedFile
.
path
]);
bool
verifyGzip
(
File
gzippedFile
)
=>
processUtils
.
exitsHappySync
(<
String
>[
'gzip'
,
'-t'
,
gzippedFile
.
path
]);
@override
@override
File
makePipe
(
String
path
)
{
File
makePipe
(
String
path
)
{
runSync
(<
String
>[
'mkfifo'
,
path
]);
processUtils
.
runSync
(
<
String
>[
'mkfifo'
,
path
],
throwOnError:
true
,
);
return
fs
.
file
(
path
);
return
fs
.
file
(
path
);
}
}
...
@@ -187,12 +202,12 @@ class _PosixUtils extends OperatingSystemUtils {
...
@@ -187,12 +202,12 @@ class _PosixUtils extends OperatingSystemUtils {
String
get
name
{
String
get
name
{
if
(
_name
==
null
)
{
if
(
_name
==
null
)
{
if
(
platform
.
isMacOS
)
{
if
(
platform
.
isMacOS
)
{
final
List
<
ProcessResult
>
results
=
<
Process
Result
>[
final
List
<
RunResult
>
results
=
<
Run
Result
>[
process
Manager
.
runSync
(<
String
>[
'sw_vers'
,
'-productName'
]),
process
Utils
.
runSync
(<
String
>[
'sw_vers'
,
'-productName'
]),
process
Manager
.
runSync
(<
String
>[
'sw_vers'
,
'-productVersion'
]),
process
Utils
.
runSync
(<
String
>[
'sw_vers'
,
'-productVersion'
]),
process
Manager
.
runSync
(<
String
>[
'sw_vers'
,
'-buildVersion'
]),
process
Utils
.
runSync
(<
String
>[
'sw_vers'
,
'-buildVersion'
]),
];
];
if
(
results
.
every
((
Process
Result
result
)
=>
result
.
exitCode
==
0
))
{
if
(
results
.
every
((
Run
Result
result
)
=>
result
.
exitCode
==
0
))
{
_name
=
'
${results[0].stdout.trim()}
${results[1].stdout
_name
=
'
${results[0].stdout.trim()}
${results[1].stdout
.trim()}
${results[2].stdout.trim()}
'
;
.trim()}
${results[2].stdout.trim()}
'
;
}
}
...
...
packages/flutter_tools/lib/src/base/process.dart
View file @
73c10e8c
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/build_aot.dart
View file @
73c10e8c
...
@@ -9,6 +9,7 @@ import '../base/build.dart';
...
@@ -9,6 +9,7 @@ import '../base/build.dart';
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/context.dart'
;
import
'../base/context.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/logger.dart'
;
import
'../base/logger.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
import
'../base/version.dart'
;
import
'../base/version.dart'
;
...
@@ -142,14 +143,18 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
...
@@ -142,14 +143,18 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
// Merge arch-specific App.frameworks into a multi-arch App.framework.
// Merge arch-specific App.frameworks into a multi-arch App.framework.
if
((
await
Future
.
wait
<
int
>(
exitCodes
.
values
)).
every
((
int
buildExitCode
)
=>
buildExitCode
==
0
))
{
if
((
await
Future
.
wait
<
int
>(
exitCodes
.
values
)).
every
((
int
buildExitCode
)
=>
buildExitCode
==
0
))
{
final
Iterable
<
String
>
dylibs
=
iosBuilds
.
values
.
map
<
String
>((
String
outputDir
)
=>
fs
.
path
.
join
(
outputDir
,
'App.framework'
,
'App'
));
final
Iterable
<
String
>
dylibs
=
iosBuilds
.
values
.
map
<
String
>(
(
String
outputDir
)
=>
fs
.
path
.
join
(
outputDir
,
'App.framework'
,
'App'
));
fs
.
directory
(
fs
.
path
.
join
(
outputPath
,
'App.framework'
))..
createSync
();
fs
.
directory
(
fs
.
path
.
join
(
outputPath
,
'App.framework'
))..
createSync
();
await
runCheckedAsync
(<
String
>[
await
processUtils
.
run
(
'lipo'
,
<
String
>[
...
dylibs
,
'lipo'
,
'-create'
,
...
dylibs
,
'-output'
,
fs
.
path
.
join
(
outputPath
,
'App.framework'
,
'App'
),
'-create'
,
]);
'-output'
,
fs
.
path
.
join
(
outputPath
,
'App.framework'
,
'App'
),
],
throwOnError:
true
,
);
}
else
{
}
else
{
status
?.
cancel
();
status
?.
cancel
();
exitCodes
.
forEach
((
DarwinArch
iosArch
,
Future
<
int
>
exitCodeFuture
)
async
{
exitCodes
.
forEach
((
DarwinArch
iosArch
,
Future
<
int
>
exitCodeFuture
)
async
{
...
@@ -173,10 +178,10 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
...
@@ -173,10 +178,10 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
throwToolExit
(
'Snapshotting exited with non-zero exit code:
$snapshotExitCode
'
);
throwToolExit
(
'Snapshotting exited with non-zero exit code:
$snapshotExitCode
'
);
}
}
}
}
}
on
String
catch
(
error
)
{
}
on
ProcessException
catch
(
error
)
{
// Catch the String exceptions thrown from the `run
Checked
Sync` methods below.
// Catch the String exceptions thrown from the `runSync` methods below.
status
?.
cancel
();
status
?.
cancel
();
printError
(
error
);
printError
(
error
.
toString
()
);
return
null
;
return
null
;
}
}
status
?.
stop
();
status
?.
stop
();
...
...
packages/flutter_tools/lib/src/commands/channel.dart
View file @
73c10e8c
...
@@ -61,7 +61,7 @@ class ChannelCommand extends FlutterCommand {
...
@@ -61,7 +61,7 @@ class ChannelCommand extends FlutterCommand {
showAll
=
showAll
||
currentChannel
!=
currentBranch
;
showAll
=
showAll
||
currentChannel
!=
currentBranch
;
printStatus
(
'Flutter channels:'
);
printStatus
(
'Flutter channels:'
);
final
int
result
=
await
runCommandAndStreamOutput
(
final
int
result
=
await
processUtils
.
stream
(
<
String
>[
'git'
,
'branch'
,
'-r'
],
<
String
>[
'git'
,
'branch'
,
'-r'
],
workingDirectory:
Cache
.
flutterRoot
,
workingDirectory:
Cache
.
flutterRoot
,
mapFunction:
(
String
line
)
{
mapFunction:
(
String
line
)
{
...
@@ -111,28 +111,28 @@ class ChannelCommand extends FlutterCommand {
...
@@ -111,28 +111,28 @@ class ChannelCommand extends FlutterCommand {
static
Future
<
void
>
_checkout
(
String
branchName
)
async
{
static
Future
<
void
>
_checkout
(
String
branchName
)
async
{
// Get latest refs from upstream.
// Get latest refs from upstream.
int
result
=
await
runCommandAndStreamOutput
(
int
result
=
await
processUtils
.
stream
(
<
String
>[
'git'
,
'fetch'
],
<
String
>[
'git'
,
'fetch'
],
workingDirectory:
Cache
.
flutterRoot
,
workingDirectory:
Cache
.
flutterRoot
,
prefix:
'git: '
,
prefix:
'git: '
,
);
);
if
(
result
==
0
)
{
if
(
result
==
0
)
{
result
=
await
runCommandAndStreamOutput
(
result
=
await
processUtils
.
stream
(
<
String
>[
'git'
,
'show-ref'
,
'--verify'
,
'--quiet'
,
'refs/heads/
$branchName
'
],
<
String
>[
'git'
,
'show-ref'
,
'--verify'
,
'--quiet'
,
'refs/heads/
$branchName
'
],
workingDirectory:
Cache
.
flutterRoot
,
workingDirectory:
Cache
.
flutterRoot
,
prefix:
'git: '
,
prefix:
'git: '
,
);
);
if
(
result
==
0
)
{
if
(
result
==
0
)
{
// branch already exists, try just switching to it
// branch already exists, try just switching to it
result
=
await
runCommandAndStreamOutput
(
result
=
await
processUtils
.
stream
(
<
String
>[
'git'
,
'checkout'
,
branchName
,
'--'
],
<
String
>[
'git'
,
'checkout'
,
branchName
,
'--'
],
workingDirectory:
Cache
.
flutterRoot
,
workingDirectory:
Cache
.
flutterRoot
,
prefix:
'git: '
,
prefix:
'git: '
,
);
);
}
else
{
}
else
{
// branch does not exist, we have to create it
// branch does not exist, we have to create it
result
=
await
runCommandAndStreamOutput
(
result
=
await
processUtils
.
stream
(
<
String
>[
'git'
,
'checkout'
,
'--track'
,
'-b'
,
branchName
,
'origin/
$branchName
'
],
<
String
>[
'git'
,
'checkout'
,
'--track'
,
'-b'
,
branchName
,
'origin/
$branchName
'
],
workingDirectory:
Cache
.
flutterRoot
,
workingDirectory:
Cache
.
flutterRoot
,
prefix:
'git: '
,
prefix:
'git: '
,
...
...
packages/flutter_tools/lib/src/commands/drive.dart
View file @
73c10e8c
...
@@ -292,7 +292,7 @@ Future<void> _runTests(List<String> testArgs, String observatoryUri) async {
...
@@ -292,7 +292,7 @@ Future<void> _runTests(List<String> testArgs, String observatoryUri) async {
PackageMap
.
globalPackagesPath
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
));
PackageMap
.
globalPackagesPath
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
));
final
String
dartVmPath
=
fs
.
path
.
join
(
dartSdkPath
,
'bin'
,
'dart'
);
final
String
dartVmPath
=
fs
.
path
.
join
(
dartSdkPath
,
'bin'
,
'dart'
);
final
int
result
=
await
runCommandAndStreamOutput
(
final
int
result
=
await
processUtils
.
stream
(
<
String
>[
<
String
>[
dartVmPath
,
dartVmPath
,
...
dartVmFlags
,
...
dartVmFlags
,
...
...
packages/flutter_tools/lib/src/commands/format.dart
View file @
73c10e8c
...
@@ -76,9 +76,10 @@ class FormatCommand extends FlutterCommand {
...
@@ -76,9 +76,10 @@ class FormatCommand extends FlutterCommand {
...
argResults
.
rest
,
...
argResults
.
rest
,
];
];
final
int
result
=
await
runCommandAndStreamOutput
(
command
);
final
int
result
=
await
processUtils
.
stream
(
command
);
if
(
result
!=
0
)
if
(
result
!=
0
)
{
throwToolExit
(
'Formatting failed:
$result
'
,
exitCode:
result
);
throwToolExit
(
'Formatting failed:
$result
'
,
exitCode:
result
);
}
return
null
;
return
null
;
}
}
...
...
packages/flutter_tools/lib/src/commands/unpack.dart
View file @
73c10e8c
...
@@ -5,8 +5,7 @@
...
@@ -5,8 +5,7 @@
import
'../artifacts.dart'
;
import
'../artifacts.dart'
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/process.dart'
;
import
'../base/process_manager.dart'
;
import
'../build_info.dart'
;
import
'../build_info.dart'
;
import
'../cache.dart'
;
import
'../cache.dart'
;
import
'../globals.dart'
;
import
'../globals.dart'
;
...
@@ -284,7 +283,7 @@ class ArtifactUnpacker {
...
@@ -284,7 +283,7 @@ class ArtifactUnpacker {
_deleteFrameworkIfPresent
(
_deleteFrameworkIfPresent
(
fs
.
path
.
join
(
targetDirectory
,
fs
.
path
.
basename
(
frameworkPath
)));
fs
.
path
.
join
(
targetDirectory
,
fs
.
path
.
basename
(
frameworkPath
)));
final
ProcessResult
result
=
processManager
final
RunResult
result
=
processUtils
.
runSync
(<
String
>[
'cp'
,
'-R'
,
frameworkPath
,
targetDirectory
]);
.
runSync
(<
String
>[
'cp'
,
'-R'
,
frameworkPath
,
targetDirectory
]);
if
(
result
.
exitCode
!=
0
)
{
if
(
result
.
exitCode
!=
0
)
{
throw
Exception
(
throw
Exception
(
...
...
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
73c10e8c
...
@@ -121,7 +121,7 @@ class UpgradeCommandRunner {
...
@@ -121,7 +121,7 @@ class UpgradeCommandRunner {
}
}
Future
<
void
>
flutterUpgradeContinue
()
async
{
Future
<
void
>
flutterUpgradeContinue
()
async
{
final
int
code
=
await
runCommandAndStreamOutput
(
final
int
code
=
await
processUtils
.
stream
(
<
String
>[
<
String
>[
fs
.
path
.
join
(
'bin'
,
'flutter'
),
fs
.
path
.
join
(
'bin'
,
'flutter'
),
'upgrade'
,
'upgrade'
,
...
@@ -146,9 +146,11 @@ class UpgradeCommandRunner {
...
@@ -146,9 +146,11 @@ class UpgradeCommandRunner {
Future
<
bool
>
hasUncomittedChanges
()
async
{
Future
<
bool
>
hasUncomittedChanges
()
async
{
try
{
try
{
final
RunResult
result
=
await
runCheckedAsync
(<
String
>[
final
RunResult
result
=
await
processUtils
.
run
(
'git'
,
'status'
,
'-s'
<
String
>[
'git'
,
'status'
,
'-s'
],
],
workingDirectory:
Cache
.
flutterRoot
);
throwOnError:
true
,
workingDirectory:
Cache
.
flutterRoot
,
);
return
result
.
stdout
.
trim
().
isNotEmpty
;
return
result
.
stdout
.
trim
().
isNotEmpty
;
}
on
ProcessException
catch
(
error
)
{
}
on
ProcessException
catch
(
error
)
{
throwToolExit
(
throwToolExit
(
...
@@ -167,9 +169,11 @@ class UpgradeCommandRunner {
...
@@ -167,9 +169,11 @@ class UpgradeCommandRunner {
/// Exits tool if there is no upstream.
/// Exits tool if there is no upstream.
Future
<
void
>
verifyUpstreamConfigured
()
async
{
Future
<
void
>
verifyUpstreamConfigured
()
async
{
try
{
try
{
await
runCheckedAsync
(<
String
>[
await
processUtils
.
run
(
'git'
,
'rev-parse'
,
'@{u}'
,
<
String
>[
'git'
,
'rev-parse'
,
'@{u}'
],
],
workingDirectory:
Cache
.
flutterRoot
);
throwOnError:
true
,
workingDirectory:
Cache
.
flutterRoot
,
);
}
catch
(
e
)
{
}
catch
(
e
)
{
throwToolExit
(
throwToolExit
(
'Unable to upgrade Flutter: no origin repository configured. '
'Unable to upgrade Flutter: no origin repository configured. '
...
@@ -191,9 +195,11 @@ class UpgradeCommandRunner {
...
@@ -191,9 +195,11 @@ class UpgradeCommandRunner {
tag
=
'v
${gitTagVersion.x}
.
${gitTagVersion.y}
.
${gitTagVersion.z}
'
;
tag
=
'v
${gitTagVersion.x}
.
${gitTagVersion.y}
.
${gitTagVersion.z}
'
;
}
}
try
{
try
{
await
runCheckedAsync
(<
String
>[
await
processUtils
.
run
(
'git'
,
'reset'
,
'--hard'
,
tag
,
<
String
>[
'git'
,
'reset'
,
'--hard'
,
tag
],
],
workingDirectory:
Cache
.
flutterRoot
);
throwOnError:
true
,
workingDirectory:
Cache
.
flutterRoot
,
);
}
on
ProcessException
catch
(
error
)
{
}
on
ProcessException
catch
(
error
)
{
throwToolExit
(
throwToolExit
(
'Unable to upgrade Flutter: The tool could not update to the version
$tag
. '
'Unable to upgrade Flutter: The tool could not update to the version
$tag
. '
...
@@ -218,7 +224,7 @@ class UpgradeCommandRunner {
...
@@ -218,7 +224,7 @@ class UpgradeCommandRunner {
/// If there haven't been any hot fixes or local changes, this is equivalent
/// If there haven't been any hot fixes or local changes, this is equivalent
/// to a fast-forward.
/// to a fast-forward.
Future
<
void
>
attemptFastForward
()
async
{
Future
<
void
>
attemptFastForward
()
async
{
final
int
code
=
await
runCommandAndStreamOutput
(
final
int
code
=
await
processUtils
.
stream
(
<
String
>[
'git'
,
'pull'
,
'--ff'
],
<
String
>[
'git'
,
'pull'
,
'--ff'
],
workingDirectory:
Cache
.
flutterRoot
,
workingDirectory:
Cache
.
flutterRoot
,
mapFunction:
(
String
line
)
=>
matchesGitLine
(
line
)
?
null
:
line
,
mapFunction:
(
String
line
)
=>
matchesGitLine
(
line
)
?
null
:
line
,
...
@@ -236,7 +242,7 @@ class UpgradeCommandRunner {
...
@@ -236,7 +242,7 @@ class UpgradeCommandRunner {
Future
<
void
>
precacheArtifacts
()
async
{
Future
<
void
>
precacheArtifacts
()
async
{
printStatus
(
''
);
printStatus
(
''
);
printStatus
(
'Upgrading engine...'
);
printStatus
(
'Upgrading engine...'
);
final
int
code
=
await
runCommandAndStreamOutput
(
final
int
code
=
await
processUtils
.
stream
(
<
String
>[
<
String
>[
fs
.
path
.
join
(
'bin'
,
'flutter'
),
'--no-color'
,
'--no-version-check'
,
'precache'
,
fs
.
path
.
join
(
'bin'
,
'flutter'
),
'--no-color'
,
'--no-version-check'
,
'precache'
,
],
],
...
@@ -263,7 +269,7 @@ class UpgradeCommandRunner {
...
@@ -263,7 +269,7 @@ class UpgradeCommandRunner {
Future
<
void
>
runDoctor
()
async
{
Future
<
void
>
runDoctor
()
async
{
printStatus
(
''
);
printStatus
(
''
);
printStatus
(
'Running flutter doctor...'
);
printStatus
(
'Running flutter doctor...'
);
await
runCommandAndStreamOutput
(
await
processUtils
.
stream
(
<
String
>[
<
String
>[
fs
.
path
.
join
(
'bin'
,
'flutter'
),
'--no-version-check'
,
'doctor'
,
fs
.
path
.
join
(
'bin'
,
'flutter'
),
'--no-version-check'
,
'doctor'
,
],
],
...
...
packages/flutter_tools/lib/src/commands/version.dart
View file @
73c10e8c
...
@@ -37,8 +37,9 @@ class VersionCommand extends FlutterCommand {
...
@@ -37,8 +37,9 @@ class VersionCommand extends FlutterCommand {
Future
<
List
<
String
>>
getTags
()
async
{
Future
<
List
<
String
>>
getTags
()
async
{
RunResult
runResult
;
RunResult
runResult
;
try
{
try
{
runResult
=
await
runCheckedAsync
(
runResult
=
await
processUtils
.
run
(
<
String
>[
'git'
,
'tag'
,
'-l'
,
'v*'
,
'--sort=-creatordate'
],
<
String
>[
'git'
,
'tag'
,
'-l'
,
'v*'
,
'--sort=-creatordate'
],
throwOnError:
true
,
workingDirectory:
Cache
.
flutterRoot
,
workingDirectory:
Cache
.
flutterRoot
,
);
);
}
on
ProcessException
catch
(
error
)
{
}
on
ProcessException
catch
(
error
)
{
...
@@ -83,8 +84,9 @@ class VersionCommand extends FlutterCommand {
...
@@ -83,8 +84,9 @@ class VersionCommand extends FlutterCommand {
}
}
try
{
try
{
await
runCheckedAsync
(
await
processUtils
.
run
(
<
String
>[
'git'
,
'checkout'
,
'v
$version
'
],
<
String
>[
'git'
,
'checkout'
,
'v
$version
'
],
throwOnError:
true
,
workingDirectory:
Cache
.
flutterRoot
,
workingDirectory:
Cache
.
flutterRoot
,
);
);
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -101,7 +103,7 @@ class VersionCommand extends FlutterCommand {
...
@@ -101,7 +103,7 @@ class VersionCommand extends FlutterCommand {
// if necessary.
// if necessary.
printStatus
(
''
);
printStatus
(
''
);
printStatus
(
'Downloading engine...'
);
printStatus
(
'Downloading engine...'
);
int
code
=
await
runCommandAndStreamOutput
(<
String
>[
int
code
=
await
processUtils
.
stream
(<
String
>[
fs
.
path
.
join
(
'bin'
,
'flutter'
),
fs
.
path
.
join
(
'bin'
,
'flutter'
),
'--no-color'
,
'--no-color'
,
'precache'
,
'precache'
,
...
@@ -128,7 +130,7 @@ class VersionCommand extends FlutterCommand {
...
@@ -128,7 +130,7 @@ class VersionCommand extends FlutterCommand {
// Run a doctor check in case system requirements have changed.
// Run a doctor check in case system requirements have changed.
printStatus
(
''
);
printStatus
(
''
);
printStatus
(
'Running flutter doctor...'
);
printStatus
(
'Running flutter doctor...'
);
code
=
await
runCommandAndStreamOutput
(
code
=
await
processUtils
.
stream
(
<
String
>[
<
String
>[
fs
.
path
.
join
(
'bin'
,
'flutter'
),
fs
.
path
.
join
(
'bin'
,
'flutter'
),
'doctor'
,
'doctor'
,
...
...
packages/flutter_tools/lib/src/context_runner.dart
View file @
73c10e8c
...
@@ -19,6 +19,7 @@ import 'base/io.dart';
...
@@ -19,6 +19,7 @@ import 'base/io.dart';
import
'base/logger.dart'
;
import
'base/logger.dart'
;
import
'base/os.dart'
;
import
'base/os.dart'
;
import
'base/platform.dart'
;
import
'base/platform.dart'
;
import
'base/process.dart'
;
import
'base/time.dart'
;
import
'base/time.dart'
;
import
'base/user_messages.dart'
;
import
'base/user_messages.dart'
;
import
'base/utils.dart'
;
import
'base/utils.dart'
;
...
@@ -101,6 +102,7 @@ Future<T> runInContext<T>(
...
@@ -101,6 +102,7 @@ Future<T> runInContext<T>(
Logger:
()
=>
platform
.
isWindows
?
WindowsStdoutLogger
()
:
StdoutLogger
(),
Logger:
()
=>
platform
.
isWindows
?
WindowsStdoutLogger
()
:
StdoutLogger
(),
MacOSWorkflow:
()
=>
const
MacOSWorkflow
(),
MacOSWorkflow:
()
=>
const
MacOSWorkflow
(),
OperatingSystemUtils:
()
=>
OperatingSystemUtils
(),
OperatingSystemUtils:
()
=>
OperatingSystemUtils
(),
ProcessUtils:
()
=>
ProcessUtils
(),
SimControl:
()
=>
SimControl
(),
SimControl:
()
=>
SimControl
(),
Stdio:
()
=>
const
Stdio
(),
Stdio:
()
=>
const
Stdio
(),
SystemClock:
()
=>
const
SystemClock
(),
SystemClock:
()
=>
const
SystemClock
(),
...
...
packages/flutter_tools/lib/src/dart/pub.dart
View file @
73c10e8c
...
@@ -8,6 +8,7 @@ import 'package:meta/meta.dart';
...
@@ -8,6 +8,7 @@ import 'package:meta/meta.dart';
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
as
io
;
import
'../base/logger.dart'
;
import
'../base/logger.dart'
;
import
'../base/platform.dart'
;
import
'../base/platform.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
...
@@ -156,22 +157,25 @@ Future<void> pub(
...
@@ -156,22 +157,25 @@ Future<void> pub(
int
code
;
int
code
;
while
(
true
)
{
while
(
true
)
{
attempts
+=
1
;
attempts
+=
1
;
code
=
await
runCommandAndStreamOutput
(
code
=
await
processUtils
.
stream
(
_pubCommand
(
arguments
),
_pubCommand
(
arguments
),
workingDirectory:
directory
,
workingDirectory:
directory
,
mapFunction:
filter
,
mapFunction:
filter
,
environment:
_createPubEnvironment
(
context
),
environment:
_createPubEnvironment
(
context
),
);
);
if
(
code
!=
69
)
// UNAVAILABLE in https://github.com/dart-lang/pub/blob/master/lib/src/exit_codes.dart
if
(
code
!=
69
)
{
// UNAVAILABLE in https://github.com/dart-lang/pub/blob/master/lib/src/exit_codes.dart
break
;
break
;
}
printStatus
(
'
$failureMessage
(
$code
) -- attempting retry
$attempts
in
$duration
second
${ duration == 1 ? "" : "s"}
...'
);
printStatus
(
'
$failureMessage
(
$code
) -- attempting retry
$attempts
in
$duration
second
${ duration == 1 ? "" : "s"}
...'
);
await
Future
<
void
>.
delayed
(
Duration
(
seconds:
duration
));
await
Future
<
void
>.
delayed
(
Duration
(
seconds:
duration
));
if
(
duration
<
64
)
if
(
duration
<
64
)
{
duration
*=
2
;
duration
*=
2
;
}
}
}
assert
(
code
!=
null
);
assert
(
code
!=
null
);
if
(
code
!=
0
)
if
(
code
!=
0
)
{
throwToolExit
(
'
$failureMessage
(
$code
)'
,
exitCode:
code
);
throwToolExit
(
'
$failureMessage
(
$code
)'
,
exitCode:
code
);
}
}
}
/// Runs pub in 'interactive' mode, directly piping the stdin stream of this
/// Runs pub in 'interactive' mode, directly piping the stdin stream of this
...
@@ -182,13 +186,26 @@ Future<void> pubInteractively(
...
@@ -182,13 +186,26 @@ Future<void> pubInteractively(
String
directory
,
String
directory
,
})
async
{
})
async
{
Cache
.
releaseLockEarly
();
Cache
.
releaseLockEarly
();
final
i
nt
code
=
await
runInteractively
(
final
i
o
.
Process
process
=
await
processUtils
.
start
(
_pubCommand
(
arguments
),
_pubCommand
(
arguments
),
workingDirectory:
directory
,
workingDirectory:
directory
,
environment:
_createPubEnvironment
(
PubContext
.
interactive
),
environment:
_createPubEnvironment
(
PubContext
.
interactive
),
);
);
if
(
code
!=
0
)
// Pipe the Flutter tool stdin to the pub stdin.
unawaited
(
process
.
stdin
.
addStream
(
io
.
stdin
));
// Pipe the put stdout and stderr to the tool stdout and stderr.
await
Future
.
wait
<
dynamic
>(<
Future
<
dynamic
>>[
io
.
stdout
.
addStream
(
process
.
stdout
),
io
.
stderr
.
addStream
(
process
.
stderr
),
]);
// Wait for pub to exit.
final
int
code
=
await
process
.
exitCode
;
if
(
code
!=
0
)
{
throwToolExit
(
'pub finished with exit code
$code
'
,
exitCode:
code
);
throwToolExit
(
'pub finished with exit code
$code
'
,
exitCode:
code
);
}
}
}
/// The command used for running pub.
/// The command used for running pub.
...
...
packages/flutter_tools/lib/src/doctor.dart
View file @
73c10e8c
...
@@ -14,7 +14,7 @@ import 'base/file_system.dart';
...
@@ -14,7 +14,7 @@ import 'base/file_system.dart';
import
'base/logger.dart'
;
import
'base/logger.dart'
;
import
'base/os.dart'
;
import
'base/os.dart'
;
import
'base/platform.dart'
;
import
'base/platform.dart'
;
import
'base/process
_manager
.dart'
;
import
'base/process.dart'
;
import
'base/terminal.dart'
;
import
'base/terminal.dart'
;
import
'base/user_messages.dart'
;
import
'base/user_messages.dart'
;
import
'base/utils.dart'
;
import
'base/utils.dart'
;
...
@@ -607,7 +607,7 @@ class FlutterValidator extends DoctorValidator {
...
@@ -607,7 +607,7 @@ class FlutterValidator extends DoctorValidator {
bool
_genSnapshotRuns
(
String
genSnapshotPath
)
{
bool
_genSnapshotRuns
(
String
genSnapshotPath
)
{
const
int
kExpectedExitCode
=
255
;
const
int
kExpectedExitCode
=
255
;
try
{
try
{
return
process
Manager
.
runSync
(<
String
>[
genSnapshotPath
]).
exitCode
==
kExpectedExitCode
;
return
process
Utils
.
runSync
(<
String
>[
genSnapshotPath
]).
exitCode
==
kExpectedExitCode
;
}
catch
(
error
)
{
}
catch
(
error
)
{
return
false
;
return
false
;
}
}
...
...
packages/flutter_tools/lib/src/emulator.dart
View file @
73c10e8c
...
@@ -8,8 +8,7 @@ import 'dart:math' as math;
...
@@ -8,8 +8,7 @@ import 'dart:math' as math;
import
'android/android_emulator.dart'
;
import
'android/android_emulator.dart'
;
import
'android/android_sdk.dart'
;
import
'android/android_sdk.dart'
;
import
'base/context.dart'
;
import
'base/context.dart'
;
import
'base/io.dart'
show
ProcessResult
;
import
'base/process.dart'
;
import
'base/process_manager.dart'
;
import
'device.dart'
;
import
'device.dart'
;
import
'globals.dart'
;
import
'globals.dart'
;
import
'ios/ios_emulators.dart'
;
import
'ios/ios_emulators.dart'
;
...
@@ -118,7 +117,7 @@ class EmulatorManager {
...
@@ -118,7 +117,7 @@ class EmulatorManager {
'-k'
,
sdkId
,
'-k'
,
sdkId
,
'-d'
,
device
,
'-d'
,
device
,
];
];
final
ProcessResult
runResult
=
processManager
.
runSync
(
args
,
final
RunResult
runResult
=
processUtils
.
runSync
(
args
,
environment:
androidSdk
?.
sdkManagerEnv
);
environment:
androidSdk
?.
sdkManagerEnv
);
return
CreateEmulatorResult
(
return
CreateEmulatorResult
(
name
,
name
,
...
@@ -139,10 +138,11 @@ class EmulatorManager {
...
@@ -139,10 +138,11 @@ class EmulatorManager {
'device'
,
'device'
,
'-c'
,
'-c'
,
];
];
final
ProcessResult
runResult
=
processManager
.
runSync
(
args
,
final
RunResult
runResult
=
processUtils
.
runSync
(
args
,
environment:
androidSdk
?.
sdkManagerEnv
);
environment:
androidSdk
?.
sdkManagerEnv
);
if
(
runResult
.
exitCode
!=
0
)
if
(
runResult
.
exitCode
!=
0
)
{
return
null
;
return
null
;
}
final
List
<
String
>
availableDevices
=
runResult
.
stdout
final
List
<
String
>
availableDevices
=
runResult
.
stdout
.
split
(
'
\n
'
)
.
split
(
'
\n
'
)
...
@@ -165,7 +165,7 @@ class EmulatorManager {
...
@@ -165,7 +165,7 @@ class EmulatorManager {
'avd'
,
'avd'
,
'-n'
,
'temp'
,
'-n'
,
'temp'
,
];
];
final
ProcessResult
runResult
=
processManager
.
runSync
(
args
,
final
RunResult
runResult
=
processUtils
.
runSync
(
args
,
environment:
androidSdk
?.
sdkManagerEnv
);
environment:
androidSdk
?.
sdkManagerEnv
);
// Get the list of IDs that match our criteria
// Get the list of IDs that match our criteria
...
...
packages/flutter_tools/lib/src/fuchsia/fuchsia_dev_finder.dart
View file @
73c10e8c
...
@@ -32,7 +32,7 @@ class FuchsiaDevFinder {
...
@@ -32,7 +32,7 @@ class FuchsiaDevFinder {
'list'
,
'list'
,
'-full'
'-full'
];
];
final
RunResult
result
=
await
runAsync
(
command
);
final
RunResult
result
=
await
processUtils
.
run
(
command
);
if
(
result
.
exitCode
!=
0
)
{
if
(
result
.
exitCode
!=
0
)
{
printError
(
'dev_finder failed:
${result.stderr}
'
);
printError
(
'dev_finder failed:
${result.stderr}
'
);
return
null
;
return
null
;
...
@@ -57,7 +57,7 @@ class FuchsiaDevFinder {
...
@@ -57,7 +57,7 @@ class FuchsiaDevFinder {
'-device-limit'
,
'1'
,
'-device-limit'
,
'1'
,
deviceName
deviceName
];
];
final
RunResult
result
=
await
runAsync
(
command
);
final
RunResult
result
=
await
processUtils
.
run
(
command
);
if
(
result
.
exitCode
!=
0
)
{
if
(
result
.
exitCode
!=
0
)
{
printError
(
'dev_finder failed:
${result.stderr}
'
);
printError
(
'dev_finder failed:
${result.stderr}
'
);
return
null
;
return
null
;
...
...
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
View file @
73c10e8c
...
@@ -454,7 +454,7 @@ class FuchsiaDevice extends Device {
...
@@ -454,7 +454,7 @@ class FuchsiaDevice extends Device {
throwToolExit
(
'Cannot interact with device. No ssh config.
\n
'
throwToolExit
(
'Cannot interact with device. No ssh config.
\n
'
'Try setting FUCHSIA_SSH_CONFIG or FUCHSIA_BUILD_DIR.'
);
'Try setting FUCHSIA_SSH_CONFIG or FUCHSIA_BUILD_DIR.'
);
}
}
return
await
runAsync
(<
String
>[
return
await
processUtils
.
run
(<
String
>[
'ssh'
,
'ssh'
,
'-F'
,
'-F'
,
fuchsiaArtifacts
.
sshConfig
.
absolute
.
path
,
fuchsiaArtifacts
.
sshConfig
.
absolute
.
path
,
...
...
packages/flutter_tools/lib/src/fuchsia/fuchsia_kernel_compiler.dart
View file @
73c10e8c
...
@@ -85,7 +85,7 @@ class FuchsiaKernelCompiler {
...
@@ -85,7 +85,7 @@ class FuchsiaKernelCompiler {
fuchsiaArtifacts
.
kernelCompiler
.
path
,
fuchsiaArtifacts
.
kernelCompiler
.
path
,
...
flags
,
...
flags
,
];
];
final
Process
process
=
await
runCommand
(
command
);
final
Process
process
=
await
processUtils
.
start
(
command
);
final
Status
status
=
logger
.
startProgress
(
final
Status
status
=
logger
.
startProgress
(
'Building Fuchsia application...'
,
'Building Fuchsia application...'
,
timeout:
null
,
timeout:
null
,
...
...
packages/flutter_tools/lib/src/fuchsia/fuchsia_pm.dart
View file @
73c10e8c
...
@@ -118,7 +118,7 @@ class FuchsiaPM {
...
@@ -118,7 +118,7 @@ class FuchsiaPM {
'-l'
,
'-l'
,
'
$host
:
$port
'
,
'
$host
:
$port
'
,
];
];
final
Process
process
=
await
runCommand
(
command
);
final
Process
process
=
await
processUtils
.
start
(
command
);
process
.
stdout
process
.
stdout
.
transform
(
utf8
.
decoder
)
.
transform
(
utf8
.
decoder
)
.
transform
(
const
LineSplitter
())
.
transform
(
const
LineSplitter
())
...
@@ -152,7 +152,7 @@ class FuchsiaPM {
...
@@ -152,7 +152,7 @@ class FuchsiaPM {
throwToolExit
(
'Fuchsia pm tool not found'
);
throwToolExit
(
'Fuchsia pm tool not found'
);
}
}
final
List
<
String
>
command
=
<
String
>[
fuchsiaArtifacts
.
pm
.
path
]
+
args
;
final
List
<
String
>
command
=
<
String
>[
fuchsiaArtifacts
.
pm
.
path
]
+
args
;
final
RunResult
result
=
await
runAsync
(
command
);
final
RunResult
result
=
await
processUtils
.
run
(
command
);
return
result
.
exitCode
==
0
;
return
result
.
exitCode
==
0
;
}
}
}
}
...
...
packages/flutter_tools/lib/src/ios/code_signing.dart
View file @
73c10e8c
...
@@ -96,8 +96,9 @@ Future<Map<String, String>> getCodeSigningIdentityDevelopmentTeam({
...
@@ -96,8 +96,9 @@ Future<Map<String, String>> getCodeSigningIdentityDevelopmentTeam({
BuildableIOSApp
iosApp
,
BuildableIOSApp
iosApp
,
})
async
{
})
async
{
final
Map
<
String
,
String
>
buildSettings
=
iosApp
.
project
.
buildSettings
;
final
Map
<
String
,
String
>
buildSettings
=
iosApp
.
project
.
buildSettings
;
if
(
buildSettings
==
null
)
if
(
buildSettings
==
null
)
{
return
null
;
return
null
;
}
// If the user already has it set in the project build settings itself,
// If the user already has it set in the project build settings itself,
// continue with that.
// continue with that.
...
@@ -114,16 +115,21 @@ Future<Map<String, String>> getCodeSigningIdentityDevelopmentTeam({
...
@@ -114,16 +115,21 @@ Future<Map<String, String>> getCodeSigningIdentityDevelopmentTeam({
// If the user's environment is missing the tools needed to find and read
// If the user's environment is missing the tools needed to find and read
// certificates, abandon. Tools should be pre-equipped on macOS.
// certificates, abandon. Tools should be pre-equipped on macOS.
if
(!
exitsHappy
(
const
<
String
>[
'which'
,
'security'
])
||
!
exitsHappy
(
const
<
String
>[
'which'
,
'openssl'
]))
if
(!
await
processUtils
.
exitsHappy
(
const
<
String
>[
'which'
,
'security'
])
||
!
await
processUtils
.
exitsHappy
(
const
<
String
>[
'which'
,
'openssl'
]))
{
return
null
;
return
null
;
}
const
List
<
String
>
findIdentityCommand
=
const
List
<
String
>
findIdentityCommand
=
<
String
>[
'security'
,
'find-identity'
,
'-p'
,
'codesigning'
,
'-v'
];
<
String
>[
'security'
,
'find-identity'
,
'-p'
,
'codesigning'
,
'-v'
];
String
findIdentityStdout
;
String
findIdentityStdout
;
try
{
try
{
findIdentityStdout
=
runCheckedSync
(
findIdentityCommand
);
findIdentityStdout
=
(
await
processUtils
.
run
(
}
catch
(
error
)
{
findIdentityCommand
,
throwOnError:
true
,
)).
stdout
.
trim
();
}
on
ProcessException
catch
(
error
)
{
printTrace
(
'Unexpected failure from find-identity:
$error
.'
);
printTrace
(
'Unexpected failure from find-identity:
$error
.'
);
return
null
;
return
null
;
}
}
...
@@ -142,8 +148,9 @@ Future<Map<String, String>> getCodeSigningIdentityDevelopmentTeam({
...
@@ -142,8 +148,9 @@ Future<Map<String, String>> getCodeSigningIdentityDevelopmentTeam({
final
String
signingIdentity
=
await
_chooseSigningIdentity
(
validCodeSigningIdentities
);
final
String
signingIdentity
=
await
_chooseSigningIdentity
(
validCodeSigningIdentities
);
// If none are chosen, return null.
// If none are chosen, return null.
if
(
signingIdentity
==
null
)
if
(
signingIdentity
==
null
)
{
return
null
;
return
null
;
}
printStatus
(
'Signing iOS app for device deployment using developer identity: "
$signingIdentity
"'
);
printStatus
(
'Signing iOS app for device deployment using developer identity: "
$signingIdentity
"'
);
...
@@ -153,20 +160,23 @@ Future<Map<String, String>> getCodeSigningIdentityDevelopmentTeam({
...
@@ -153,20 +160,23 @@ Future<Map<String, String>> getCodeSigningIdentityDevelopmentTeam({
?.
group
(
1
);
?.
group
(
1
);
// If `security`'s output format changes, we'd have to update the above regex.
// If `security`'s output format changes, we'd have to update the above regex.
if
(
signingCertificateId
==
null
)
if
(
signingCertificateId
==
null
)
{
return
null
;
return
null
;
}
String
signingCertificateStdout
;
String
signingCertificateStdout
;
try
{
try
{
signingCertificateStdout
=
runCheckedSync
(
signingCertificateStdout
=
(
await
processUtils
.
run
(
<
String
>[
'security'
,
'find-certificate'
,
'-c'
,
signingCertificateId
,
'-p'
]
<
String
>[
'security'
,
'find-certificate'
,
'-c'
,
signingCertificateId
,
'-p'
],
);
throwOnError:
true
,
}
catch
(
error
)
{
)).
stdout
.
trim
();
}
on
ProcessException
catch
(
error
)
{
printTrace
(
'Couldn
\'
t find the certificate:
$error
.'
);
printTrace
(
'Couldn
\'
t find the certificate:
$error
.'
);
return
null
;
return
null
;
}
}
final
Process
opensslProcess
=
await
runCommand
(
const
<
String
>[
'openssl'
,
'x509'
,
'-subject'
]);
final
Process
opensslProcess
=
await
processUtils
.
start
(
const
<
String
>[
'openssl'
,
'x509'
,
'-subject'
]);
await
(
opensslProcess
.
stdin
..
write
(
signingCertificateStdout
)).
close
();
await
(
opensslProcess
.
stdin
..
write
(
signingCertificateStdout
)).
close
();
final
String
opensslOutput
=
await
utf8
.
decodeStream
(
opensslProcess
.
stdout
);
final
String
opensslOutput
=
await
utf8
.
decodeStream
(
opensslProcess
.
stdout
);
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
73c10e8c
...
@@ -64,7 +64,7 @@ class IOSDeploy {
...
@@ -64,7 +64,7 @@ class IOSDeploy {
iosDeployEnv
[
'PATH'
]
=
'/usr/bin:
${iosDeployEnv['PATH']}
'
;
iosDeployEnv
[
'PATH'
]
=
'/usr/bin:
${iosDeployEnv['PATH']}
'
;
iosDeployEnv
.
addEntries
(<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
]);
iosDeployEnv
.
addEntries
(<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
]);
return
await
runCommandAndStreamOutput
(
return
await
processUtils
.
stream
(
launchCommand
,
launchCommand
,
mapFunction:
_monitorInstallationFailure
,
mapFunction:
_monitorInstallationFailure
,
trace:
true
,
trace:
true
,
...
@@ -195,8 +195,9 @@ class IOSDevice extends Device {
...
@@ -195,8 +195,9 @@ class IOSDevice extends Device {
Future
<
bool
>
isAppInstalled
(
ApplicationPackage
app
)
async
{
Future
<
bool
>
isAppInstalled
(
ApplicationPackage
app
)
async
{
RunResult
apps
;
RunResult
apps
;
try
{
try
{
apps
=
await
runCheckedAsync
(
apps
=
await
processUtils
.
run
(
<
String
>[
_installerPath
,
'--list-apps'
],
<
String
>[
_installerPath
,
'--list-apps'
],
throwOnError:
true
,
environment:
Map
<
String
,
String
>.
fromEntries
(
environment:
Map
<
String
,
String
>.
fromEntries
(
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
],
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
],
),
),
...
@@ -220,8 +221,9 @@ class IOSDevice extends Device {
...
@@ -220,8 +221,9 @@ class IOSDevice extends Device {
}
}
try
{
try
{
await
runCheckedAsync
(
await
processUtils
.
run
(
<
String
>[
_installerPath
,
'-i'
,
iosApp
.
deviceBundlePath
],
<
String
>[
_installerPath
,
'-i'
,
iosApp
.
deviceBundlePath
],
throwOnError:
true
,
environment:
Map
<
String
,
String
>.
fromEntries
(
environment:
Map
<
String
,
String
>.
fromEntries
(
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
],
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
],
),
),
...
@@ -236,8 +238,9 @@ class IOSDevice extends Device {
...
@@ -236,8 +238,9 @@ class IOSDevice extends Device {
@override
@override
Future
<
bool
>
uninstallApp
(
ApplicationPackage
app
)
async
{
Future
<
bool
>
uninstallApp
(
ApplicationPackage
app
)
async
{
try
{
try
{
await
runCheckedAsync
(
await
processUtils
.
run
(
<
String
>[
_installerPath
,
'-U'
,
app
.
id
],
<
String
>[
_installerPath
,
'-U'
,
app
.
id
],
throwOnError:
true
,
environment:
Map
<
String
,
String
>.
fromEntries
(
environment:
Map
<
String
,
String
>.
fromEntries
(
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
],
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
],
),
),
...
@@ -610,7 +613,7 @@ class _IOSDevicePortForwarder extends DevicePortForwarder {
...
@@ -610,7 +613,7 @@ class _IOSDevicePortForwarder extends DevicePortForwarder {
while
(!
connected
)
{
while
(!
connected
)
{
printTrace
(
'attempting to forward device port
$devicePort
to host port
$hostPort
'
);
printTrace
(
'attempting to forward device port
$devicePort
to host port
$hostPort
'
);
// Usage: iproxy LOCAL_TCP_PORT DEVICE_TCP_PORT UDID
// Usage: iproxy LOCAL_TCP_PORT DEVICE_TCP_PORT UDID
process
=
await
runCommand
(
process
=
await
processUtils
.
start
(
<
String
>[
<
String
>[
device
.
_iproxyPath
,
device
.
_iproxyPath
,
hostPort
.
toString
(),
hostPort
.
toString
(),
...
...
packages/flutter_tools/lib/src/ios/ios_emulators.dart
View file @
73c10e8c
...
@@ -47,7 +47,7 @@ class IOSEmulator extends Emulator {
...
@@ -47,7 +47,7 @@ class IOSEmulator extends Emulator {
.
followedBy
(<
String
>[
'-a'
,
xcode
.
getSimulatorPath
()])
.
followedBy
(<
String
>[
'-a'
,
xcode
.
getSimulatorPath
()])
.
toList
();
.
toList
();
final
RunResult
launchResult
=
await
runAsync
(
args
);
final
RunResult
launchResult
=
await
processUtils
.
run
(
args
);
if
(
launchResult
.
exitCode
!=
0
)
{
if
(
launchResult
.
exitCode
!=
0
)
{
printError
(
'
$launchResult
'
);
printError
(
'
$launchResult
'
);
return
false
;
return
false
;
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
73c10e8c
...
@@ -107,7 +107,7 @@ class IMobileDevice {
...
@@ -107,7 +107,7 @@ class IMobileDevice {
final
String
_idevicescreenshotPath
;
final
String
_idevicescreenshotPath
;
bool
get
isInstalled
{
bool
get
isInstalled
{
_isInstalled
??=
exitsHappy
(
_isInstalled
??=
processUtils
.
exitsHappySync
(
<
String
>[
<
String
>[
_ideviceIdPath
,
_ideviceIdPath
,
'-h'
'-h'
...
@@ -136,7 +136,7 @@ class IMobileDevice {
...
@@ -136,7 +136,7 @@ class IMobileDevice {
final
Map
<
String
,
String
>
executionEnv
=
Map
<
String
,
String
>.
fromEntries
(
final
Map
<
String
,
String
>
executionEnv
=
Map
<
String
,
String
>.
fromEntries
(
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
]
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
]
);
);
final
ProcessResult
ideviceResult
=
(
await
runAsync
(
final
ProcessResult
ideviceResult
=
(
await
processUtils
.
run
(
<
String
>[
<
String
>[
_ideviceinfoPath
,
_ideviceinfoPath
,
'-u'
,
'-u'
,
...
@@ -150,7 +150,7 @@ class IMobileDevice {
...
@@ -150,7 +150,7 @@ class IMobileDevice {
}
}
// If no device is attached, we're unable to detect any problems. Assume all is well.
// If no device is attached, we're unable to detect any problems. Assume all is well.
final
ProcessResult
result
=
(
await
runAsync
(
final
ProcessResult
result
=
(
await
processUtils
.
run
(
<
String
>[
<
String
>[
_ideviceIdPath
,
_ideviceIdPath
,
'-l'
,
'-l'
,
...
@@ -161,7 +161,7 @@ class IMobileDevice {
...
@@ -161,7 +161,7 @@ class IMobileDevice {
_isWorking
=
true
;
_isWorking
=
true
;
}
else
{
}
else
{
// Check that we can look up the names of any attached devices.
// Check that we can look up the names of any attached devices.
_isWorking
=
await
exitsHappyAsync
(
_isWorking
=
await
processUtils
.
exitsHappy
(
<
String
>[
_idevicenamePath
],
<
String
>[
_idevicenamePath
],
environment:
executionEnv
,
environment:
executionEnv
,
);
);
...
@@ -229,7 +229,7 @@ class IMobileDevice {
...
@@ -229,7 +229,7 @@ class IMobileDevice {
/// Starts `idevicesyslog` and returns the running process.
/// Starts `idevicesyslog` and returns the running process.
Future
<
Process
>
startLogger
(
String
deviceID
)
{
Future
<
Process
>
startLogger
(
String
deviceID
)
{
return
runCommand
(
return
processUtils
.
start
(
<
String
>[
<
String
>[
_idevicesyslogPath
,
_idevicesyslogPath
,
'-u'
,
'-u'
,
...
@@ -243,11 +243,12 @@ class IMobileDevice {
...
@@ -243,11 +243,12 @@ class IMobileDevice {
/// Captures a screenshot to the specified outputFile.
/// Captures a screenshot to the specified outputFile.
Future
<
void
>
takeScreenshot
(
File
outputFile
)
{
Future
<
void
>
takeScreenshot
(
File
outputFile
)
{
return
runCheckedAsync
(
return
processUtils
.
run
(
<
String
>[
<
String
>[
_idevicescreenshotPath
,
_idevicescreenshotPath
,
outputFile
.
path
outputFile
.
path
],
],
throwOnError:
true
,
environment:
Map
<
String
,
String
>.
fromEntries
(
environment:
Map
<
String
,
String
>.
fromEntries
(
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
]
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
]
),
),
...
@@ -318,8 +319,9 @@ Future<XcodeBuildResult> buildXcodeProject({
...
@@ -318,8 +319,9 @@ Future<XcodeBuildResult> buildXcodeProject({
}
}
Map
<
String
,
String
>
autoSigningConfigs
;
Map
<
String
,
String
>
autoSigningConfigs
;
if
(
codesign
&&
buildForDevice
)
if
(
codesign
&&
buildForDevice
)
{
autoSigningConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
iosApp:
app
);
autoSigningConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
iosApp:
app
);
}
// Before the build, all service definitions must be updated and the dylibs
// Before the build, all service definitions must be updated and the dylibs
// copied over to a location that is suitable for Xcodebuild to find them.
// copied over to a location that is suitable for Xcodebuild to find them.
...
@@ -440,7 +442,7 @@ Future<XcodeBuildResult> buildXcodeProject({
...
@@ -440,7 +442,7 @@ Future<XcodeBuildResult> buildXcodeProject({
final
Stopwatch
sw
=
Stopwatch
()..
start
();
final
Stopwatch
sw
=
Stopwatch
()..
start
();
initialBuildStatus
=
logger
.
startProgress
(
'Running Xcode build...'
,
timeout:
timeoutConfiguration
.
fastOperation
);
initialBuildStatus
=
logger
.
startProgress
(
'Running Xcode build...'
,
timeout:
timeoutConfiguration
.
fastOperation
);
final
RunResult
buildResult
=
await
runAsync
(
final
RunResult
buildResult
=
await
processUtils
.
run
(
buildCommands
,
buildCommands
,
workingDirectory:
app
.
project
.
hostAppRoot
.
path
,
workingDirectory:
app
.
project
.
hostAppRoot
.
path
,
allowReentrantFlutter:
true
,
allowReentrantFlutter:
true
,
...
@@ -476,8 +478,9 @@ Future<XcodeBuildResult> buildXcodeProject({
...
@@ -476,8 +478,9 @@ Future<XcodeBuildResult> buildXcodeProject({
const
Duration
showBuildSettingsTimeout
=
Duration
(
minutes:
1
);
const
Duration
showBuildSettingsTimeout
=
Duration
(
minutes:
1
);
Map
<
String
,
String
>
buildSettings
;
Map
<
String
,
String
>
buildSettings
;
try
{
try
{
final
RunResult
showBuildSettingsResult
=
await
runCheckedAsync
(
final
RunResult
showBuildSettingsResult
=
await
processUtils
.
run
(
showBuildSettingsCommand
,
showBuildSettingsCommand
,
throwOnError:
true
,
workingDirectory:
app
.
project
.
hostAppRoot
.
path
,
workingDirectory:
app
.
project
.
hostAppRoot
.
path
,
timeout:
showBuildSettingsTimeout
,
timeout:
showBuildSettingsTimeout
,
timeoutRetries:
1
,
timeoutRetries:
1
,
...
@@ -677,7 +680,10 @@ Future<void> _copyServiceFrameworks(List<Map<String, String>> services, Director
...
@@ -677,7 +680,10 @@ Future<void> _copyServiceFrameworks(List<Map<String, String>> services, Director
continue
;
continue
;
}
}
// Shell out so permissions on the dylib are preserved.
// Shell out so permissions on the dylib are preserved.
await
runCheckedAsync
(<
String
>[
'/bin/cp'
,
dylib
.
path
,
frameworksDirectory
.
path
]);
await
processUtils
.
run
(
<
String
>[
'/bin/cp'
,
dylib
.
path
,
frameworksDirectory
.
path
],
throwOnError:
true
,
);
}
}
}
}
...
...
packages/flutter_tools/lib/src/ios/plist_parser.dart
View file @
73c10e8c
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
'../base/context.dart'
;
import
'../base/context.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
import
'../convert.dart'
;
import
'../convert.dart'
;
import
'../globals.dart'
;
import
'../globals.dart'
;
...
@@ -38,9 +39,12 @@ class PlistParser {
...
@@ -38,9 +39,12 @@ class PlistParser {
final
List
<
String
>
args
=
<
String
>[
final
List
<
String
>
args
=
<
String
>[
executable
,
'-convert'
,
'json'
,
'-o'
,
'-'
,
normalizedPlistPath
,
executable
,
'-convert'
,
'json'
,
'-o'
,
'-'
,
normalizedPlistPath
,
];
];
final
String
jsonContent
=
runCheckedSync
(
args
);
final
String
jsonContent
=
processUtils
.
runSync
(
args
,
throwOnError:
true
,
).
stdout
.
trim
();
return
json
.
decode
(
jsonContent
);
return
json
.
decode
(
jsonContent
);
}
catch
(
error
)
{
}
on
ProcessException
catch
(
error
)
{
printTrace
(
'
$error
'
);
printTrace
(
'
$error
'
);
return
const
<
String
,
dynamic
>{};
return
const
<
String
,
dynamic
>{};
}
}
...
...
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
73c10e8c
...
@@ -130,7 +130,7 @@ class SimControl {
...
@@ -130,7 +130,7 @@ class SimControl {
}
}
Future
<
bool
>
isInstalled
(
String
deviceId
,
String
appId
)
{
Future
<
bool
>
isInstalled
(
String
deviceId
,
String
appId
)
{
return
exitsHappyAsync
(<
String
>[
return
processUtils
.
exitsHappy
(<
String
>[
_xcrunPath
,
_xcrunPath
,
'simctl'
,
'simctl'
,
'get_app_container'
,
'get_app_container'
,
...
@@ -142,7 +142,10 @@ class SimControl {
...
@@ -142,7 +142,10 @@ class SimControl {
Future
<
RunResult
>
install
(
String
deviceId
,
String
appPath
)
{
Future
<
RunResult
>
install
(
String
deviceId
,
String
appPath
)
{
Future
<
RunResult
>
result
;
Future
<
RunResult
>
result
;
try
{
try
{
result
=
runCheckedAsync
(<
String
>[
_xcrunPath
,
'simctl'
,
'install'
,
deviceId
,
appPath
]);
result
=
processUtils
.
run
(
<
String
>[
_xcrunPath
,
'simctl'
,
'install'
,
deviceId
,
appPath
],
throwOnError:
true
,
);
}
on
ProcessException
catch
(
exception
)
{
}
on
ProcessException
catch
(
exception
)
{
throwToolExit
(
'Unable to install
$appPath
on
$deviceId
:
\n
$exception
'
);
throwToolExit
(
'Unable to install
$appPath
on
$deviceId
:
\n
$exception
'
);
}
}
...
@@ -152,7 +155,10 @@ class SimControl {
...
@@ -152,7 +155,10 @@ class SimControl {
Future
<
RunResult
>
uninstall
(
String
deviceId
,
String
appId
)
{
Future
<
RunResult
>
uninstall
(
String
deviceId
,
String
appId
)
{
Future
<
RunResult
>
result
;
Future
<
RunResult
>
result
;
try
{
try
{
result
=
runCheckedAsync
(<
String
>[
_xcrunPath
,
'simctl'
,
'uninstall'
,
deviceId
,
appId
]);
result
=
processUtils
.
run
(
<
String
>[
_xcrunPath
,
'simctl'
,
'uninstall'
,
deviceId
,
appId
],
throwOnError:
true
,
);
}
on
ProcessException
catch
(
exception
)
{
}
on
ProcessException
catch
(
exception
)
{
throwToolExit
(
'Unable to uninstall
$appId
from
$deviceId
:
\n
$exception
'
);
throwToolExit
(
'Unable to uninstall
$appId
from
$deviceId
:
\n
$exception
'
);
}
}
...
@@ -162,14 +168,17 @@ class SimControl {
...
@@ -162,14 +168,17 @@ class SimControl {
Future
<
RunResult
>
launch
(
String
deviceId
,
String
appIdentifier
,
[
List
<
String
>
launchArgs
])
{
Future
<
RunResult
>
launch
(
String
deviceId
,
String
appIdentifier
,
[
List
<
String
>
launchArgs
])
{
Future
<
RunResult
>
result
;
Future
<
RunResult
>
result
;
try
{
try
{
result
=
runCheckedAsync
(<
String
>[
result
=
processUtils
.
run
(
_xcrunPath
,
<
String
>[
'simctl'
,
_xcrunPath
,
'launch'
,
'simctl'
,
deviceId
,
'launch'
,
appIdentifier
,
deviceId
,
...?
launchArgs
,
appIdentifier
,
]);
...?
launchArgs
,
],
throwOnError:
true
,
);
}
on
ProcessException
catch
(
exception
)
{
}
on
ProcessException
catch
(
exception
)
{
throwToolExit
(
'Unable to launch
$appIdentifier
on
$deviceId
:
\n
$exception
'
);
throwToolExit
(
'Unable to launch
$appIdentifier
on
$deviceId
:
\n
$exception
'
);
}
}
...
@@ -178,7 +187,10 @@ class SimControl {
...
@@ -178,7 +187,10 @@ class SimControl {
Future
<
void
>
takeScreenshot
(
String
deviceId
,
String
outputPath
)
async
{
Future
<
void
>
takeScreenshot
(
String
deviceId
,
String
outputPath
)
async
{
try
{
try
{
await
runCheckedAsync
(<
String
>[
_xcrunPath
,
'simctl'
,
'io'
,
deviceId
,
'screenshot'
,
outputPath
]);
await
processUtils
.
run
(
<
String
>[
_xcrunPath
,
'simctl'
,
'io'
,
deviceId
,
'screenshot'
,
outputPath
],
throwOnError:
true
,
);
}
on
ProcessException
catch
(
exception
)
{
}
on
ProcessException
catch
(
exception
)
{
throwToolExit
(
'Unable to take screenshot of
$deviceId
:
\n
$exception
'
);
throwToolExit
(
'Unable to take screenshot of
$deviceId
:
\n
$exception
'
);
}
}
...
@@ -518,20 +530,22 @@ class IOSSimulator extends Device {
...
@@ -518,20 +530,22 @@ class IOSSimulator extends Device {
/// Launches the device log reader process on the host.
/// Launches the device log reader process on the host.
Future
<
Process
>
launchDeviceLogTool
(
IOSSimulator
device
)
async
{
Future
<
Process
>
launchDeviceLogTool
(
IOSSimulator
device
)
async
{
// Versions of iOS prior to iOS 11 log to the simulator syslog file.
// Versions of iOS prior to iOS 11 log to the simulator syslog file.
if
(
await
device
.
sdkMajorVersion
<
11
)
if
(
await
device
.
sdkMajorVersion
<
11
)
{
return
runCommand
(<
String
>[
'tail'
,
'-n'
,
'0'
,
'-F'
,
device
.
logFilePath
]);
return
processUtils
.
start
(<
String
>[
'tail'
,
'-n'
,
'0'
,
'-F'
,
device
.
logFilePath
]);
}
// For iOS 11 and above, use /usr/bin/log to tail process logs.
// For iOS 11 and above, use /usr/bin/log to tail process logs.
// Run in interactive mode (via script), otherwise /usr/bin/log buffers in 4k chunks. (radar: 34420207)
// Run in interactive mode (via script), otherwise /usr/bin/log buffers in 4k chunks. (radar: 34420207)
return
runCommand
(<
String
>[
return
processUtils
.
start
(<
String
>[
'script'
,
'/dev/null'
,
'/usr/bin/log'
,
'stream'
,
'--style'
,
'syslog'
,
'--predicate'
,
'processImagePath CONTAINS "
${device.id}
"'
,
'script'
,
'/dev/null'
,
'/usr/bin/log'
,
'stream'
,
'--style'
,
'syslog'
,
'--predicate'
,
'processImagePath CONTAINS "
${device.id}
"'
,
]);
]);
}
}
Future
<
Process
>
launchSystemLogTool
(
IOSSimulator
device
)
async
{
Future
<
Process
>
launchSystemLogTool
(
IOSSimulator
device
)
async
{
// Versions of iOS prior to 11 tail the simulator syslog file.
// Versions of iOS prior to 11 tail the simulator syslog file.
if
(
await
device
.
sdkMajorVersion
<
11
)
if
(
await
device
.
sdkMajorVersion
<
11
)
{
return
runCommand
(<
String
>[
'tail'
,
'-n'
,
'0'
,
'-F'
,
'/private/var/log/system.log'
]);
return
processUtils
.
start
(<
String
>[
'tail'
,
'-n'
,
'0'
,
'-F'
,
'/private/var/log/system.log'
]);
}
// For iOS 11 and later, all relevant detail is in the device log.
// For iOS 11 and later, all relevant detail is in the device log.
return
null
;
return
null
;
...
...
packages/flutter_tools/lib/src/ios/xcodeproj.dart
View file @
73c10e8c
...
@@ -14,7 +14,6 @@ import '../base/logger.dart';
...
@@ -14,7 +14,6 @@ import '../base/logger.dart';
import
'../base/os.dart'
;
import
'../base/os.dart'
;
import
'../base/platform.dart'
;
import
'../base/platform.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
import
'../base/process_manager.dart'
;
import
'../base/utils.dart'
;
import
'../base/utils.dart'
;
import
'../build_info.dart'
;
import
'../build_info.dart'
;
import
'../cache.dart'
;
import
'../cache.dart'
;
...
@@ -211,7 +210,9 @@ class XcodeProjectInterpreter {
...
@@ -211,7 +210,9 @@ class XcodeProjectInterpreter {
return
;
return
;
}
}
try
{
try
{
final
ProcessResult
result
=
processManager
.
runSync
(<
String
>[
_executable
,
'-version'
]);
final
RunResult
result
=
processUtils
.
runSync
(
<
String
>[
_executable
,
'-version'
],
);
if
(
result
.
exitCode
!=
0
)
{
if
(
result
.
exitCode
!=
0
)
{
return
;
return
;
}
}
...
@@ -255,16 +256,20 @@ class XcodeProjectInterpreter {
...
@@ -255,16 +256,20 @@ class XcodeProjectInterpreter {
/// version below.
/// version below.
Map
<
String
,
String
>
getBuildSettings
(
String
projectPath
,
String
target
)
{
Map
<
String
,
String
>
getBuildSettings
(
String
projectPath
,
String
target
)
{
try
{
try
{
final
String
out
=
runCheckedSync
(<
String
>[
final
String
out
=
processUtils
.
runSync
(
_executable
,
<
String
>[
'-project'
,
_executable
,
fs
.
path
.
absolute
(
projectPath
),
'-project'
,
'-target'
,
fs
.
path
.
absolute
(
projectPath
),
target
,
'-target'
,
'-showBuildSettings'
,
target
,
],
workingDirectory:
projectPath
);
'-showBuildSettings'
,
],
throwOnError:
true
,
workingDirectory:
projectPath
,
).
stdout
.
trim
();
return
parseXcodeBuildSettings
(
out
);
return
parseXcodeBuildSettings
(
out
);
}
catch
(
error
)
{
}
on
ProcessException
catch
(
error
)
{
printTrace
(
'Unexpected failure to get the build settings:
$error
.'
);
printTrace
(
'Unexpected failure to get the build settings:
$error
.'
);
return
const
<
String
,
String
>{};
return
const
<
String
,
String
>{};
}
}
...
@@ -291,8 +296,9 @@ class XcodeProjectInterpreter {
...
@@ -291,8 +296,9 @@ class XcodeProjectInterpreter {
// showBuildSettings is reported to ocassionally timeout. Here, we give it
// showBuildSettings is reported to ocassionally timeout. Here, we give it
// a lot of wiggle room (locally on Flutter Gallery, this takes ~1s).
// a lot of wiggle room (locally on Flutter Gallery, this takes ~1s).
// When there is a timeout, we retry once.
// When there is a timeout, we retry once.
final
RunResult
result
=
await
runCheckedAsync
(
final
RunResult
result
=
await
processUtils
.
run
(
showBuildSettingsCommand
,
showBuildSettingsCommand
,
throwOnError:
true
,
workingDirectory:
projectPath
,
workingDirectory:
projectPath
,
timeout:
timeout
,
timeout:
timeout
,
timeoutRetries:
1
,
timeoutRetries:
1
,
...
@@ -313,7 +319,7 @@ class XcodeProjectInterpreter {
...
@@ -313,7 +319,7 @@ class XcodeProjectInterpreter {
}
}
void
cleanWorkspace
(
String
workspacePath
,
String
scheme
)
{
void
cleanWorkspace
(
String
workspacePath
,
String
scheme
)
{
runSync
(<
String
>[
processUtils
.
runSync
(<
String
>[
_executable
,
_executable
,
'-workspace'
,
'-workspace'
,
workspacePath
,
workspacePath
,
...
@@ -325,11 +331,15 @@ class XcodeProjectInterpreter {
...
@@ -325,11 +331,15 @@ class XcodeProjectInterpreter {
}
}
Future
<
XcodeProjectInfo
>
getInfo
(
String
projectPath
,
{
String
projectFilename
})
async
{
Future
<
XcodeProjectInfo
>
getInfo
(
String
projectPath
,
{
String
projectFilename
})
async
{
final
RunResult
result
=
await
runCheckedAsync
(<
String
>[
final
RunResult
result
=
await
processUtils
.
run
(
_executable
,
<
String
>[
'-list'
,
_executable
,
if
(
projectFilename
!=
null
)
...<
String
>[
'-project'
,
projectFilename
],
'-list'
,
],
workingDirectory:
projectPath
);
if
(
projectFilename
!=
null
)
...<
String
>[
'-project'
,
projectFilename
],
],
throwOnError:
true
,
workingDirectory:
projectPath
,
);
return
XcodeProjectInfo
.
fromXcodeBuildOutput
(
result
.
toString
());
return
XcodeProjectInfo
.
fromXcodeBuildOutput
(
result
.
toString
());
}
}
}
}
...
...
packages/flutter_tools/lib/src/macos/cocoapods.dart
View file @
73c10e8c
...
@@ -67,10 +67,11 @@ class CocoaPods {
...
@@ -67,10 +67,11 @@ class CocoaPods {
String
get
cocoaPodsMinimumVersion
=>
'1.6.0'
;
String
get
cocoaPodsMinimumVersion
=>
'1.6.0'
;
String
get
cocoaPodsRecommendedVersion
=>
'1.6.0'
;
String
get
cocoaPodsRecommendedVersion
=>
'1.6.0'
;
Future
<
bool
>
get
isInstalled
=>
exitsHappyAsync
(<
String
>[
'which'
,
'pod'
]);
Future
<
bool
>
get
isInstalled
=>
processUtils
.
exitsHappy
(<
String
>[
'which'
,
'pod'
]);
Future
<
String
>
get
cocoaPodsVersionText
{
Future
<
String
>
get
cocoaPodsVersionText
{
_versionText
??=
runAsync
(<
String
>[
'pod'
,
'--version'
]).
then
<
String
>((
RunResult
result
)
{
_versionText
??=
processUtils
.
run
(<
String
>[
'pod'
,
'--version'
]).
then
<
String
>((
RunResult
result
)
{
return
result
.
exitCode
==
0
?
result
.
stdout
.
trim
()
:
null
;
return
result
.
exitCode
==
0
?
result
.
stdout
.
trim
()
:
null
;
},
onError:
(
dynamic
_
)
=>
null
);
},
onError:
(
dynamic
_
)
=>
null
);
return
_versionText
;
return
_versionText
;
...
...
packages/flutter_tools/lib/src/macos/xcode.dart
View file @
73c10e8c
...
@@ -10,7 +10,6 @@ import '../base/file_system.dart';
...
@@ -10,7 +10,6 @@ import '../base/file_system.dart';
import
'../base/io.dart'
;
import
'../base/io.dart'
;
import
'../base/platform.dart'
;
import
'../base/platform.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
import
'../base/process_manager.dart'
;
import
'../ios/xcodeproj.dart'
;
import
'../ios/xcodeproj.dart'
;
const
int
kXcodeRequiredVersionMajor
=
9
;
const
int
kXcodeRequiredVersionMajor
=
9
;
...
@@ -25,7 +24,9 @@ class Xcode {
...
@@ -25,7 +24,9 @@ class Xcode {
String
get
xcodeSelectPath
{
String
get
xcodeSelectPath
{
if
(
_xcodeSelectPath
==
null
)
{
if
(
_xcodeSelectPath
==
null
)
{
try
{
try
{
_xcodeSelectPath
=
processManager
.
runSync
(<
String
>[
'/usr/bin/xcode-select'
,
'--print-path'
]).
stdout
.
trim
();
_xcodeSelectPath
=
processUtils
.
runSync
(
<
String
>[
'/usr/bin/xcode-select'
,
'--print-path'
],
).
stdout
.
trim
();
}
on
ProcessException
{
}
on
ProcessException
{
// Ignored, return null below.
// Ignored, return null below.
}
on
ArgumentError
{
}
on
ArgumentError
{
...
@@ -52,13 +53,16 @@ class Xcode {
...
@@ -52,13 +53,16 @@ class Xcode {
bool
get
eulaSigned
{
bool
get
eulaSigned
{
if
(
_eulaSigned
==
null
)
{
if
(
_eulaSigned
==
null
)
{
try
{
try
{
final
ProcessResult
result
=
processManager
.
runSync
(<
String
>[
'/usr/bin/xcrun'
,
'clang'
]);
final
RunResult
result
=
processUtils
.
runSync
(
if
(
result
.
stdout
!=
null
&&
result
.
stdout
.
contains
(
'license'
))
<
String
>[
'/usr/bin/xcrun'
,
'clang'
],
);
if
(
result
.
stdout
!=
null
&&
result
.
stdout
.
contains
(
'license'
))
{
_eulaSigned
=
false
;
_eulaSigned
=
false
;
else
if
(
result
.
stderr
!=
null
&&
result
.
stderr
.
contains
(
'license'
))
}
else
if
(
result
.
stderr
!=
null
&&
result
.
stderr
.
contains
(
'license'
))
{
_eulaSigned
=
false
;
_eulaSigned
=
false
;
else
}
else
{
_eulaSigned
=
true
;
_eulaSigned
=
true
;
}
}
on
ProcessException
{
}
on
ProcessException
{
_eulaSigned
=
false
;
_eulaSigned
=
false
;
}
}
...
@@ -74,7 +78,9 @@ class Xcode {
...
@@ -74,7 +78,9 @@ class Xcode {
try
{
try
{
// This command will error if additional components need to be installed in
// This command will error if additional components need to be installed in
// xcode 9.2 and above.
// xcode 9.2 and above.
final
ProcessResult
result
=
processManager
.
runSync
(<
String
>[
'/usr/bin/xcrun'
,
'simctl'
,
'list'
]);
final
RunResult
result
=
processUtils
.
runSync
(
<
String
>[
'/usr/bin/xcrun'
,
'simctl'
,
'list'
],
);
_isSimctlInstalled
=
result
.
stderr
==
null
||
result
.
stderr
==
''
;
_isSimctlInstalled
=
result
.
stderr
==
null
||
result
.
stderr
==
''
;
}
on
ProcessException
{
}
on
ProcessException
{
_isSimctlInstalled
=
false
;
_isSimctlInstalled
=
false
;
...
@@ -94,16 +100,23 @@ class Xcode {
...
@@ -94,16 +100,23 @@ class Xcode {
}
}
Future
<
RunResult
>
cc
(
List
<
String
>
args
)
{
Future
<
RunResult
>
cc
(
List
<
String
>
args
)
{
return
runCheckedAsync
(<
String
>[
'xcrun'
,
'cc'
,
...
args
]);
return
processUtils
.
run
(
<
String
>[
'xcrun'
,
'cc'
,
...
args
],
throwOnError:
true
,
);
}
}
Future
<
RunResult
>
clang
(
List
<
String
>
args
)
{
Future
<
RunResult
>
clang
(
List
<
String
>
args
)
{
return
runCheckedAsync
(<
String
>[
'xcrun'
,
'clang'
,
...
args
]);
return
processUtils
.
run
(
<
String
>[
'xcrun'
,
'clang'
,
...
args
],
throwOnError:
true
,
);
}
}
Future
<
String
>
iPhoneSdkLocation
()
async
{
Future
<
String
>
iPhoneSdkLocation
()
async
{
final
RunResult
runResult
=
await
runCheckedAsync
(
final
RunResult
runResult
=
await
processUtils
.
run
(
<
String
>[
'xcrun'
,
'--sdk'
,
'iphoneos'
,
'--show-sdk-path'
],
<
String
>[
'xcrun'
,
'--sdk'
,
'iphoneos'
,
'--show-sdk-path'
],
throwOnError:
true
,
);
);
if
(
runResult
.
exitCode
!=
0
)
{
if
(
runResult
.
exitCode
!=
0
)
{
throwToolExit
(
'Could not find iPhone SDK location:
${runResult.stderr}
'
);
throwToolExit
(
'Could not find iPhone SDK location:
${runResult.stderr}
'
);
...
...
packages/flutter_tools/lib/src/test/coverage_collector.dart
View file @
73c10e8c
...
@@ -11,7 +11,7 @@ import '../base/io.dart';
...
@@ -11,7 +11,7 @@ import '../base/io.dart';
import
'../base/logger.dart'
;
import
'../base/logger.dart'
;
import
'../base/os.dart'
;
import
'../base/os.dart'
;
import
'../base/platform.dart'
;
import
'../base/platform.dart'
;
import
'../base/process
_manager
.dart'
;
import
'../base/process.dart'
;
import
'../dart/package_map.dart'
;
import
'../dart/package_map.dart'
;
import
'../globals.dart'
;
import
'../globals.dart'
;
import
'../vmservice.dart'
;
import
'../vmservice.dart'
;
...
@@ -150,7 +150,7 @@ class CoverageCollector extends TestWatcher {
...
@@ -150,7 +150,7 @@ class CoverageCollector extends TestWatcher {
final
Directory
tempDir
=
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_test_coverage.'
);
final
Directory
tempDir
=
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools_test_coverage.'
);
try
{
try
{
final
File
sourceFile
=
coverageFile
.
copySync
(
fs
.
path
.
join
(
tempDir
.
path
,
'lcov.source.info'
));
final
File
sourceFile
=
coverageFile
.
copySync
(
fs
.
path
.
join
(
tempDir
.
path
,
'lcov.source.info'
));
final
ProcessResult
result
=
processManager
.
runSync
(<
String
>[
final
RunResult
result
=
processUtils
.
runSync
(<
String
>[
'lcov'
,
'lcov'
,
'--add-tracefile'
,
baseCoverageData
,
'--add-tracefile'
,
baseCoverageData
,
'--add-tracefile'
,
sourceFile
.
path
,
'--add-tracefile'
,
sourceFile
.
path
,
...
...
packages/flutter_tools/lib/src/version.dart
View file @
73c10e8c
...
@@ -538,7 +538,10 @@ String _runSync(List<String> command, { bool lenient = true }) {
...
@@ -538,7 +538,10 @@ String _runSync(List<String> command, { bool lenient = true }) {
}
}
String
_runGit
(
String
command
)
{
String
_runGit
(
String
command
)
{
return
runSync
(
command
.
split
(
' '
),
workingDirectory:
Cache
.
flutterRoot
);
return
processUtils
.
runSync
(
command
.
split
(
' '
),
workingDirectory:
Cache
.
flutterRoot
,
).
stdout
.
trim
();
}
}
/// Runs [command] in the root of the Flutter installation and returns the
/// Runs [command] in the root of the Flutter installation and returns the
...
...
packages/flutter_tools/lib/src/windows/visual_studio.dart
View file @
73c10e8c
...
@@ -6,7 +6,7 @@ import '../base/context.dart';
...
@@ -6,7 +6,7 @@ import '../base/context.dart';
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/io.dart'
;
import
'../base/platform.dart'
;
import
'../base/platform.dart'
;
import
'../base/process
_manager
.dart'
;
import
'../base/process.dart'
;
import
'../convert.dart'
;
import
'../convert.dart'
;
VisualStudio
get
visualStudio
=>
context
.
get
<
VisualStudio
>();
VisualStudio
get
visualStudio
=>
context
.
get
<
VisualStudio
>();
...
@@ -167,7 +167,7 @@ class VisualStudio {
...
@@ -167,7 +167,7 @@ class VisualStudio {
'-utf8'
,
'-utf8'
,
'-latest'
,
'-latest'
,
];
];
final
ProcessResult
whereResult
=
processManager
.
runSync
(<
String
>[
final
RunResult
whereResult
=
processUtils
.
runSync
(<
String
>[
_vswherePath
,
_vswherePath
,
...
defaultArguments
,
...
defaultArguments
,
...?
additionalArguments
,
...?
additionalArguments
,
...
...
packages/flutter_tools/lib/src/windows/windows_device.dart
View file @
73c10e8c
...
@@ -8,7 +8,7 @@ import '../application_package.dart';
...
@@ -8,7 +8,7 @@ import '../application_package.dart';
import
'../base/io.dart'
;
import
'../base/io.dart'
;
import
'../base/os.dart'
;
import
'../base/os.dart'
;
import
'../base/platform.dart'
;
import
'../base/platform.dart'
;
import
'../base/process
_manager
.dart'
;
import
'../base/process.dart'
;
import
'../build_info.dart'
;
import
'../build_info.dart'
;
import
'../desktop.dart'
;
import
'../desktop.dart'
;
import
'../device.dart'
;
import
'../device.dart'
;
...
@@ -88,7 +88,7 @@ class WindowsDevice extends Device {
...
@@ -88,7 +88,7 @@ class WindowsDevice extends Device {
);
);
}
}
await
stopApp
(
package
);
await
stopApp
(
package
);
final
Process
process
=
await
process
Manager
.
start
(<
String
>[
final
Process
process
=
await
process
Utils
.
start
(<
String
>[
package
.
executable
(
debuggingOptions
?.
buildInfo
?.
mode
)
package
.
executable
(
debuggingOptions
?.
buildInfo
?.
mode
)
]);
]);
if
(
debuggingOptions
?.
buildInfo
?.
isRelease
==
true
)
{
if
(
debuggingOptions
?.
buildInfo
?.
isRelease
==
true
)
{
...
@@ -114,7 +114,9 @@ class WindowsDevice extends Device {
...
@@ -114,7 +114,9 @@ class WindowsDevice extends Device {
if
(
process
==
null
)
{
if
(
process
==
null
)
{
return
false
;
return
false
;
}
}
final
ProcessResult
result
=
await
processManager
.
run
(<
String
>[
'Taskkill'
,
'/PID'
,
process
.
first
,
'/F'
]);
final
RunResult
result
=
await
processUtils
.
run
(
<
String
>[
'Taskkill'
,
'/PID'
,
process
.
first
,
'/F'
],
);
return
result
.
exitCode
==
0
;
return
result
.
exitCode
==
0
;
}
}
...
@@ -163,7 +165,9 @@ final RegExp _whitespace = RegExp(r'\s+');
...
@@ -163,7 +165,9 @@ final RegExp _whitespace = RegExp(r'\s+');
@visibleForTesting
@visibleForTesting
List
<
String
>
runningProcess
(
String
processName
)
{
List
<
String
>
runningProcess
(
String
processName
)
{
// TODO(jonahwilliams): find a way to do this without powershell.
// TODO(jonahwilliams): find a way to do this without powershell.
final
ProcessResult
result
=
processManager
.
runSync
(<
String
>[
'powershell'
,
'-script="Get-CimInstance Win32_Process"'
]);
final
RunResult
result
=
processUtils
.
runSync
(
<
String
>[
'powershell'
,
'-script="Get-CimInstance Win32_Process"'
],
);
if
(
result
.
exitCode
!=
0
)
{
if
(
result
.
exitCode
!=
0
)
{
return
null
;
return
null
;
}
}
...
...
packages/flutter_tools/test/general.shard/application_package_test.dart
View file @
73c10e8c
...
@@ -87,7 +87,7 @@ void main() {
...
@@ -87,7 +87,7 @@ void main() {
workingDirectory:
anyNamed
(
'workingDirectory'
),
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
environment:
anyNamed
(
'environment'
),
),
),
).
thenReturn
(
ProcessResult
(
0
,
0
,
_aaptDataWithDefaultEnabledAndMainLauncherActivity
,
null
));
).
thenReturn
(
ProcessResult
(
0
,
0
,
_aaptDataWithDefaultEnabledAndMainLauncherActivity
,
''
));
final
ApplicationPackage
applicationPackage
=
await
ApplicationPackageFactory
.
instance
.
getPackageForPlatform
(
final
ApplicationPackage
applicationPackage
=
await
ApplicationPackageFactory
.
instance
.
getPackageForPlatform
(
TargetPlatform
.
android_arm
,
TargetPlatform
.
android_arm
,
...
...
packages/flutter_tools/test/general.shard/base/process_test.dart
View file @
73c10e8c
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/ios/code_signing_test.dart
View file @
73c10e8c
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
73c10e8c
...
@@ -142,10 +142,13 @@ void main() {
...
@@ -142,10 +142,13 @@ void main() {
final
MockDirectory
directory
=
MockDirectory
();
final
MockDirectory
directory
=
MockDirectory
();
when
(
mockFileSystem
.
directory
(
bundlePath
)).
thenReturn
(
directory
);
when
(
mockFileSystem
.
directory
(
bundlePath
)).
thenReturn
(
directory
);
when
(
directory
.
existsSync
()).
thenReturn
(
true
);
when
(
directory
.
existsSync
()).
thenReturn
(
true
);
when
(
mockProcessManager
.
run
(
installArgs
,
environment:
env
))
when
(
mockProcessManager
.
run
(
.
thenAnswer
(
installArgs
,
(
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
0
,
''
,
''
))
workingDirectory:
anyNamed
(
'workingDirectory'
),
);
environment:
env
)).
thenAnswer
(
(
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
0
,
''
,
''
))
);
when
(
mockIMobileDevice
.
getInfoForDevice
(
any
,
'CPUArchitecture'
))
when
(
mockIMobileDevice
.
getInfoForDevice
(
any
,
'CPUArchitecture'
))
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
'arm64'
));
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
'arm64'
));
...
@@ -259,6 +262,21 @@ void main() {
...
@@ -259,6 +262,21 @@ void main() {
return
Future
<
ProcessResult
>.
value
(
ProcessResult
(
0
,
0
,
''
,
''
));
return
Future
<
ProcessResult
>.
value
(
ProcessResult
(
0
,
0
,
''
,
''
));
});
});
when
(
mockProcessManager
.
run
(
argThat
(
contains
(
'find-identity'
)),
environment:
anyNamed
(
'environment'
),
workingDirectory:
anyNamed
(
'workingDirectory'
),
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
// pid
0
,
// exitCode
'''
1) 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 "iPhone Developer: Profile 1 (1111AAAA11)"
2) da4b9237bacccdf19c0760cab7aec4a8359010b0 "iPhone Developer: Profile 2 (2222BBBB22)"
3) 5bf1fd927dfb8679496a2e6cf00cbe50c1c87145 "iPhone Developer: Profile 3 (3333CCCC33)"
3 valid identities found'''
,
''
,
)));
// Deploy works.
// Deploy works.
when
(
mockIosDeploy
.
runApp
(
when
(
mockIosDeploy
.
runApp
(
deviceId:
anyNamed
(
'deviceId'
),
deviceId:
anyNamed
(
'deviceId'
),
...
...
packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart
View file @
73c10e8c
...
@@ -146,7 +146,10 @@ void main() {
...
@@ -146,7 +146,10 @@ void main() {
});
});
testUsingOsxContext
(
'build settings is empty when xcodebuild failed to get the build settings'
,
()
{
testUsingOsxContext
(
'build settings is empty when xcodebuild failed to get the build settings'
,
()
{
when
(
mockProcessManager
.
runSync
(
argThat
(
contains
(
xcodebuild
))))
when
(
mockProcessManager
.
runSync
(
argThat
(
contains
(
xcodebuild
)),
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
)))
.
thenReturn
(
ProcessResult
(
0
,
1
,
''
,
''
));
.
thenReturn
(
ProcessResult
(
0
,
1
,
''
,
''
));
expect
(
xcodeProjectInterpreter
.
getBuildSettings
(
''
,
''
),
const
<
String
,
String
>{});
expect
(
xcodeProjectInterpreter
.
getBuildSettings
(
''
,
''
),
const
<
String
,
String
>{});
});
});
...
...
packages/flutter_tools/test/general.shard/windows/visual_studio_test.dart
View file @
73c10e8c
...
@@ -69,18 +69,23 @@ void main() {
...
@@ -69,18 +69,23 @@ void main() {
final
String
finalResponse
=
final
String
finalResponse
=
json
.
encode
(<
Map
<
String
,
dynamic
>>[
response
]);
json
.
encode
(<
Map
<
String
,
dynamic
>>[
response
]);
when
<
String
>(
result
.
stdout
).
thenReturn
(
finalResponse
);
when
<
String
>(
result
.
stdout
).
thenReturn
(
finalResponse
);
when
<
String
>(
result
.
stderr
).
thenReturn
(
''
);
final
List
<
String
>
requirementArguments
=
requiredComponents
==
null
final
List
<
String
>
requirementArguments
=
requiredComponents
==
null
?
<
String
>[]
?
<
String
>[]
:
<
String
>[
'-requires'
,
...
requiredComponents
];
:
<
String
>[
'-requires'
,
...
requiredComponents
];
when
(
mockProcessManager
.
runSync
(<
String
>[
when
(
mockProcessManager
.
runSync
(
vswherePath
,
<
String
>[
'-format'
,
vswherePath
,
'json'
,
'-format'
,
'-utf8'
,
'json'
,
'-latest'
,
'-utf8'
,
...?
additionalArguments
,
'-latest'
,
...?
requirementArguments
,
...?
additionalArguments
,
])).
thenAnswer
((
Invocation
invocation
)
{
...?
requirementArguments
,
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenAnswer
((
Invocation
invocation
)
{
return
result
;
return
result
;
});
});
}
}
...
@@ -111,8 +116,11 @@ void main() {
...
@@ -111,8 +116,11 @@ void main() {
});
});
testUsingContext
(
'isInstalled returns false when vswhere is missing'
,
()
{
testUsingContext
(
'isInstalled returns false when vswhere is missing'
,
()
{
when
(
mockProcessManager
.
runSync
(
any
))
when
(
mockProcessManager
.
runSync
(
.
thenThrow
(
const
ProcessException
(
'vswhere'
,
<
String
>[]));
any
,
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenThrow
(
const
ProcessException
(
'vswhere'
,
<
String
>[]));
visualStudio
=
VisualStudio
();
visualStudio
=
VisualStudio
();
expect
(
visualStudio
.
isInstalled
,
false
);
expect
(
visualStudio
.
isInstalled
,
false
);
...
@@ -123,8 +131,11 @@ void main() {
...
@@ -123,8 +131,11 @@ void main() {
});
});
testUsingContext
(
'vcvarsPath returns null when vswhere is missing'
,
()
{
testUsingContext
(
'vcvarsPath returns null when vswhere is missing'
,
()
{
when
(
mockProcessManager
.
runSync
(
any
))
when
(
mockProcessManager
.
runSync
(
.
thenThrow
(
const
ProcessException
(
'vswhere'
,
<
String
>[]));
any
,
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenThrow
(
const
ProcessException
(
'vswhere'
,
<
String
>[]));
visualStudio
=
VisualStudio
();
visualStudio
=
VisualStudio
();
expect
(
visualStudio
.
vcvarsPath
,
isNull
);
expect
(
visualStudio
.
vcvarsPath
,
isNull
);
...
@@ -135,13 +146,24 @@ void main() {
...
@@ -135,13 +146,24 @@ void main() {
});
});
testUsingContext
(
'isInstalled returns false when vswhere returns non-zero'
,
()
{
testUsingContext
(
'isInstalled returns false when vswhere returns non-zero'
,
()
{
when
(
mockProcessManager
.
runSync
(
any
))
.
thenThrow
(
const
ProcessException
(
'vswhere'
,
<
String
>[]));
when
(
mockProcessManager
.
runSync
(
any
,
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenThrow
(
const
ProcessException
(
'vswhere'
,
<
String
>[]));
final
MockProcessResult
result
=
MockProcessResult
();
final
MockProcessResult
result
=
MockProcessResult
();
when
(
result
.
exitCode
).
thenReturn
(
1
);
when
(
result
.
exitCode
).
thenReturn
(
1
);
when
(
mockProcessManager
.
runSync
(
any
)).
thenAnswer
((
Invocation
invocation
)
{
when
(
mockProcessManager
.
runSync
(
any
,
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenAnswer
((
Invocation
invocation
)
{
return
result
;
return
result
;
});
});
when
<
String
>(
result
.
stdout
).
thenReturn
(
''
);
when
<
String
>(
result
.
stderr
).
thenReturn
(
''
);
visualStudio
=
VisualStudio
();
visualStudio
=
VisualStudio
();
expect
(
visualStudio
.
isInstalled
,
false
);
expect
(
visualStudio
.
isInstalled
,
false
);
...
...
packages/flutter_tools/test/general.shard/windows/windows_device_test.dart
View file @
73c10e8c
...
@@ -26,18 +26,23 @@ void main() {
...
@@ -26,18 +26,23 @@ void main() {
when
(
notWindows
.
isWindows
).
thenReturn
(
false
);
when
(
notWindows
.
isWindows
).
thenReturn
(
false
);
when
(
notWindows
.
environment
).
thenReturn
(
const
<
String
,
String
>{});
when
(
notWindows
.
environment
).
thenReturn
(
const
<
String
,
String
>{});
when
(
mockProcessManager
.
runSync
(<
String
>[
when
(
mockProcessManager
.
runSync
(
'powershell'
,
'-script="Get-CimInstance Win32_Process"'
<
String
>[
'powershell'
,
'-script="Get-CimInstance Win32_Process"'
],
])).
thenAnswer
((
Invocation
invocation
)
{
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenAnswer
((
Invocation
invocation
)
{
// The flutter tool process is returned as output to the powershell script
// The flutter tool process is returned as output to the powershell script
final
MockProcessResult
result
=
MockProcessResult
();
final
MockProcessResult
result
=
MockProcessResult
();
when
(
result
.
exitCode
).
thenReturn
(
0
);
when
(
result
.
exitCode
).
thenReturn
(
0
);
when
<
String
>(
result
.
stdout
).
thenReturn
(
'
$pid
$flutterToolBinary
'
);
when
<
String
>(
result
.
stdout
).
thenReturn
(
'
$pid
$flutterToolBinary
'
);
when
<
String
>(
result
.
stderr
).
thenReturn
(
''
);
return
result
;
return
result
;
});
});
when
(
mockProcessManager
.
run
(<
String
>[
when
(
mockProcessManager
.
run
(
'Taskkill'
,
'/PID'
,
'
$pid
'
,
'/F'
<
String
>[
'Taskkill'
,
'/PID'
,
'
$pid
'
,
'/F'
],
])).
thenThrow
(
Exception
(
'Flutter tool process has been killed'
));
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenThrow
(
Exception
(
'Flutter tool process has been killed'
));
testUsingContext
(
'defaults'
,
()
async
{
testUsingContext
(
'defaults'
,
()
async
{
final
PrebuiltWindowsApp
windowsApp
=
PrebuiltWindowsApp
(
executable:
'foo'
);
final
PrebuiltWindowsApp
windowsApp
=
PrebuiltWindowsApp
(
executable:
'foo'
);
...
...
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