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
e91822da
Unverified
Commit
e91822da
authored
Jul 12, 2019
by
Christopher Fujino
Committed by
GitHub
Jul 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Bundle ios dependencies (#34669)" (#36071)
This reverts commit
14d489ad
.
parent
7b150f81
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
432 additions
and
398 deletions
+432
-398
.cirrus.yml
.cirrus.yml
+2
-2
ideviceinstaller.version
bin/internal/ideviceinstaller.version
+0
-1
ios-deploy.version
bin/internal/ios-deploy.version
+0
-1
libimobiledevice.version
bin/internal/libimobiledevice.version
+0
-1
libplist.version
bin/internal/libplist.version
+0
-1
openssl.version
bin/internal/openssl.version
+0
-1
usbmuxd.version
bin/internal/usbmuxd.version
+0
-1
adb.dart
dev/devicelab/lib/framework/adb.dart
+1
-26
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+16
-66
process.dart
packages/flutter_tools/lib/src/base/process.dart
+4
-10
user_messages.dart
packages/flutter_tools/lib/src/base/user_messages.dart
+41
-0
cache.dart
packages/flutter_tools/lib/src/cache.dart
+1
-56
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+2
-1
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+2
-0
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+30
-34
ios_workflow.dart
packages/flutter_tools/lib/src/ios/ios_workflow.dart
+91
-0
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+17
-112
cocoapods.dart
packages/flutter_tools/lib/src/macos/cocoapods.dart
+2
-2
cocoapods_validator.dart
...ages/flutter_tools/lib/src/macos/cocoapods_validator.dart
+9
-1
cache_test.dart
packages/flutter_tools/test/cache_test.dart
+0
-16
code_signing_test.dart
packages/flutter_tools/test/ios/code_signing_test.dart
+1
-1
ios_workflow_test.dart
packages/flutter_tools/test/ios/ios_workflow_test.dart
+178
-0
mac_test.dart
packages/flutter_tools/test/ios/mac_test.dart
+13
-60
cocoapods_validator_test.dart
...es/flutter_tools/test/macos/cocoapods_validator_test.dart
+22
-5
No files found.
.cirrus.yml
View file @
e91822da
...
@@ -21,7 +21,7 @@ task:
...
@@ -21,7 +21,7 @@ task:
fingerprint_script
:
echo $OS; cat bin/internal/engine.version
fingerprint_script
:
echo $OS; cat bin/internal/engine.version
artifacts_cache
:
artifacts_cache
:
folder
:
bin/cache/artifacts
folder
:
bin/cache/artifacts
fingerprint_script
:
echo $OS; cat bin/internal/
*
.version
fingerprint_script
:
echo $OS; cat bin/internal/
engine
.version
setup_script
:
./dev/bots/cirrus_setup.sh
setup_script
:
./dev/bots/cirrus_setup.sh
matrix
:
matrix
:
-
name
:
docs
-
name
:
docs
...
@@ -298,7 +298,7 @@ task:
...
@@ -298,7 +298,7 @@ task:
fingerprint_script
:
echo %OS% & type bin\internal\engine.version
fingerprint_script
:
echo %OS% & type bin\internal\engine.version
artifacts_cache
:
artifacts_cache
:
folder
:
bin\cache\artifacts
folder
:
bin\cache\artifacts
fingerprint_script
:
echo %OS% & type bin\internal\
*
.version
fingerprint_script
:
echo %OS% & type bin\internal\
engine
.version
setup_script
:
setup_script
:
-
flutter config --no-analytics
-
flutter config --no-analytics
-
flutter doctor -v
-
flutter doctor -v
...
...
bin/internal/ideviceinstaller.version
deleted
100644 → 0
View file @
7b150f81
ab9352110092cf651b5602301371cd00691c7e13
bin/internal/ios-deploy.version
deleted
100644 → 0
View file @
7b150f81
ea5583388ac0ca035f6b991fd7955bea6492c68c
bin/internal/libimobiledevice.version
deleted
100644 → 0
View file @
7b150f81
398c1208731cb887c64a31c2ae111048b079f80d
bin/internal/libplist.version
deleted
100644 → 0
View file @
7b150f81
17546f53ac1377b0d4f45a800aaec7366ba5b6a0
bin/internal/openssl.version
deleted
100644 → 0
View file @
7b150f81
03da376ff7504c63a1d00d57cf41bd7b7e93ff65
bin/internal/usbmuxd.version
deleted
100644 → 0
View file @
7b150f81
60109fdef47dfe0badfb558a6a2105e8fb23660a
dev/devicelab/lib/framework/adb.dart
View file @
e91822da
...
@@ -392,34 +392,9 @@ class IosDeviceDiscovery implements DeviceDiscovery {
...
@@ -392,34 +392,9 @@ class IosDeviceDiscovery implements DeviceDiscovery {
_workingDevice
=
allDevices
[
math
.
Random
().
nextInt
(
allDevices
.
length
)];
_workingDevice
=
allDevices
[
math
.
Random
().
nextInt
(
allDevices
.
length
)];
}
}
// Returns the path to cached binaries relative to devicelab directory
String
get
_artifactDirPath
{
return
path
.
normalize
(
path
.
join
(
path
.
current
,
'../../bin/cache/artifacts'
,
)
);
}
// Returns a colon-separated environment variable that contains the paths
// of linked libraries for idevice_id
Map
<
String
,
String
>
get
_ideviceIdEnvironment
{
final
String
libPath
=
const
<
String
>[
'libimobiledevice'
,
'usbmuxd'
,
'libplist'
,
'openssl'
,
'ideviceinstaller'
,
'ios-deploy'
,
].
map
((
String
packageName
)
=>
path
.
join
(
_artifactDirPath
,
packageName
)).
join
(
':'
);
return
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libPath
};
}
@override
@override
Future
<
List
<
String
>>
discoverDevices
()
async
{
Future
<
List
<
String
>>
discoverDevices
()
async
{
final
String
ideviceIdPath
=
path
.
join
(
_artifactDirPath
,
'libimobiledevice'
,
'idevice_id'
);
final
List
<
String
>
iosDeviceIDs
=
LineSplitter
.
split
(
await
eval
(
'idevice_id'
,
<
String
>[
'-l'
]))
final
List
<
String
>
iosDeviceIDs
=
LineSplitter
.
split
(
await
eval
(
ideviceIdPath
,
<
String
>[
'-l'
],
environment:
_ideviceIdEnvironment
))
.
map
<
String
>((
String
line
)
=>
line
.
trim
())
.
map
<
String
>((
String
line
)
=>
line
.
trim
())
.
where
((
String
line
)
=>
line
.
isNotEmpty
)
.
where
((
String
line
)
=>
line
.
isNotEmpty
)
.
toList
();
.
toList
();
...
...
packages/flutter_tools/lib/src/artifacts.dart
View file @
e91822da
...
@@ -40,14 +40,6 @@ enum Artifact {
...
@@ -40,14 +40,6 @@ enum Artifact {
kernelWorkerSnapshot
,
kernelWorkerSnapshot
,
/// The root of the web implementation of the dart SDK.
/// The root of the web implementation of the dart SDK.
flutterWebSdk
,
flutterWebSdk
,
iosDeploy
,
ideviceinfo
,
ideviceId
,
idevicename
,
idevicesyslog
,
idevicescreenshot
,
ideviceinstaller
,
iproxy
,
/// The root of the Linux desktop sources.
/// The root of the Linux desktop sources.
linuxDesktopPath
,
linuxDesktopPath
,
/// The root of the Windows desktop sources.
/// The root of the Windows desktop sources.
...
@@ -101,22 +93,6 @@ String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMo
...
@@ -101,22 +93,6 @@ String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMo
return
'dartdevc.dart.snapshot'
;
return
'dartdevc.dart.snapshot'
;
case
Artifact
.
kernelWorkerSnapshot
:
case
Artifact
.
kernelWorkerSnapshot
:
return
'kernel_worker.dart.snapshot'
;
return
'kernel_worker.dart.snapshot'
;
case
Artifact
.
iosDeploy
:
return
'ios-deploy'
;
case
Artifact
.
ideviceinfo
:
return
'ideviceinfo'
;
case
Artifact
.
ideviceId
:
return
'idevice_id'
;
case
Artifact
.
idevicename
:
return
'idevicename'
;
case
Artifact
.
idevicesyslog
:
return
'idevicesyslog'
;
case
Artifact
.
idevicescreenshot
:
return
'idevicescreenshot'
;
case
Artifact
.
ideviceinstaller
:
return
'ideviceinstaller'
;
case
Artifact
.
iproxy
:
return
'iproxy'
;
case
Artifact
.
linuxDesktopPath
:
case
Artifact
.
linuxDesktopPath
:
if
(
platform
!=
TargetPlatform
.
linux_x64
)
{
if
(
platform
!=
TargetPlatform
.
linux_x64
)
{
throw
Exception
(
'
${getNameForTargetPlatform(platform)}
does not support'
throw
Exception
(
'
${getNameForTargetPlatform(platform)}
does not support'
...
@@ -211,26 +187,13 @@ class CachedArtifacts extends Artifacts {
...
@@ -211,26 +187,13 @@ class CachedArtifacts extends Artifacts {
}
}
String
_getIosArtifactPath
(
Artifact
artifact
,
TargetPlatform
platform
,
BuildMode
mode
)
{
String
_getIosArtifactPath
(
Artifact
artifact
,
TargetPlatform
platform
,
BuildMode
mode
)
{
final
String
artifactFileName
=
_artifactToFileName
(
artifact
);
final
String
engineDir
=
_getEngineArtifactsPath
(
platform
,
mode
);
switch
(
artifact
)
{
switch
(
artifact
)
{
case
Artifact
.
genSnapshot
:
case
Artifact
.
genSnapshot
:
case
Artifact
.
snapshotDart
:
case
Artifact
.
snapshotDart
:
case
Artifact
.
flutterFramework
:
case
Artifact
.
flutterFramework
:
case
Artifact
.
frontendServerSnapshotForEngineDartSdk
:
case
Artifact
.
frontendServerSnapshotForEngineDartSdk
:
final
String
engineDir
=
_getEngineArtifactsPath
(
platform
,
mode
);
return
fs
.
path
.
join
(
engineDir
,
_artifactToFileName
(
artifact
));
return
fs
.
path
.
join
(
engineDir
,
artifactFileName
);
case
Artifact
.
ideviceId
:
case
Artifact
.
ideviceinfo
:
case
Artifact
.
idevicescreenshot
:
case
Artifact
.
idevicesyslog
:
case
Artifact
.
idevicename
:
return
cache
.
getArtifactDirectory
(
'libimobiledevice'
).
childFile
(
artifactFileName
).
path
;
case
Artifact
.
iosDeploy
:
return
cache
.
getArtifactDirectory
(
'ios-deploy'
).
childFile
(
artifactFileName
).
path
;
case
Artifact
.
ideviceinstaller
:
return
cache
.
getArtifactDirectory
(
'ideviceinstaller'
).
childFile
(
artifactFileName
).
path
;
case
Artifact
.
iproxy
:
return
cache
.
getArtifactDirectory
(
'usbmuxd'
).
childFile
(
artifactFileName
).
path
;
default
:
default
:
assert
(
false
,
'Artifact
$artifact
not available for platform
$platform
.'
);
assert
(
false
,
'Artifact
$artifact
not available for platform
$platform
.'
);
return
null
;
return
null
;
...
@@ -339,25 +302,24 @@ class LocalEngineArtifacts extends Artifacts {
...
@@ -339,25 +302,24 @@ class LocalEngineArtifacts extends Artifacts {
@override
@override
String
getArtifactPath
(
Artifact
artifact
,
{
TargetPlatform
platform
,
BuildMode
mode
})
{
String
getArtifactPath
(
Artifact
artifact
,
{
TargetPlatform
platform
,
BuildMode
mode
})
{
final
String
artifactFileName
=
_artifactToFileName
(
artifact
);
switch
(
artifact
)
{
switch
(
artifact
)
{
case
Artifact
.
snapshotDart
:
case
Artifact
.
snapshotDart
:
return
fs
.
path
.
join
(
_engineSrcPath
,
'flutter'
,
'lib'
,
'snapshot'
,
artifactFileName
);
return
fs
.
path
.
join
(
_engineSrcPath
,
'flutter'
,
'lib'
,
'snapshot'
,
_artifactToFileName
(
artifact
)
);
case
Artifact
.
genSnapshot
:
case
Artifact
.
genSnapshot
:
return
_genSnapshotPath
();
return
_genSnapshotPath
();
case
Artifact
.
flutterTester
:
case
Artifact
.
flutterTester
:
return
_flutterTesterPath
(
platform
);
return
_flutterTesterPath
(
platform
);
case
Artifact
.
isolateSnapshotData
:
case
Artifact
.
isolateSnapshotData
:
case
Artifact
.
vmSnapshotData
:
case
Artifact
.
vmSnapshotData
:
return
fs
.
path
.
join
(
engineOutPath
,
'gen'
,
'flutter'
,
'lib'
,
'snapshot'
,
artifactFileName
);
return
fs
.
path
.
join
(
engineOutPath
,
'gen'
,
'flutter'
,
'lib'
,
'snapshot'
,
_artifactToFileName
(
artifact
)
);
case
Artifact
.
platformKernelDill
:
case
Artifact
.
platformKernelDill
:
return
fs
.
path
.
join
(
_getFlutterPatchedSdkPath
(
mode
),
artifactFileName
);
return
fs
.
path
.
join
(
_getFlutterPatchedSdkPath
(
mode
),
_artifactToFileName
(
artifact
)
);
case
Artifact
.
platformLibrariesJson
:
case
Artifact
.
platformLibrariesJson
:
return
fs
.
path
.
join
(
_getFlutterPatchedSdkPath
(
mode
),
'lib'
,
artifactFileName
);
return
fs
.
path
.
join
(
_getFlutterPatchedSdkPath
(
mode
),
'lib'
,
_artifactToFileName
(
artifact
)
);
case
Artifact
.
flutterFramework
:
case
Artifact
.
flutterFramework
:
return
fs
.
path
.
join
(
engineOutPath
,
artifactFileName
);
return
fs
.
path
.
join
(
engineOutPath
,
_artifactToFileName
(
artifact
)
);
case
Artifact
.
flutterMacOSFramework
:
case
Artifact
.
flutterMacOSFramework
:
return
fs
.
path
.
join
(
engineOutPath
,
artifactFileName
);
return
fs
.
path
.
join
(
engineOutPath
,
_artifactToFileName
(
artifact
)
);
case
Artifact
.
flutterPatchedSdkPath
:
case
Artifact
.
flutterPatchedSdkPath
:
// When using local engine always use [BuildMode.debug] regardless of
// When using local engine always use [BuildMode.debug] regardless of
// what was specified in [mode] argument because local engine will
// what was specified in [mode] argument because local engine will
...
@@ -367,35 +329,23 @@ class LocalEngineArtifacts extends Artifacts {
...
@@ -367,35 +329,23 @@ class LocalEngineArtifacts extends Artifacts {
case
Artifact
.
flutterWebSdk
:
case
Artifact
.
flutterWebSdk
:
return
_getFlutterWebSdkPath
();
return
_getFlutterWebSdkPath
();
case
Artifact
.
frontendServerSnapshotForEngineDartSdk
:
case
Artifact
.
frontendServerSnapshotForEngineDartSdk
:
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'gen'
,
artifactFileName
);
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'gen'
,
_artifactToFileName
(
artifact
)
);
case
Artifact
.
engineDartSdkPath
:
case
Artifact
.
engineDartSdkPath
:
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'dart-sdk'
);
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'dart-sdk'
);
case
Artifact
.
engineDartBinary
:
case
Artifact
.
engineDartBinary
:
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'dart-sdk'
,
'bin'
,
artifactFileName
);
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'dart-sdk'
,
'bin'
,
_artifactToFileName
(
artifact
)
);
case
Artifact
.
dart2jsSnapshot
:
case
Artifact
.
dart2jsSnapshot
:
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'dart-sdk'
,
'bin'
,
'snapshots'
,
artifactFileName
);
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'dart-sdk'
,
'bin'
,
'snapshots'
,
_artifactToFileName
(
artifact
)
);
case
Artifact
.
dartdevcSnapshot
:
case
Artifact
.
dartdevcSnapshot
:
return
fs
.
path
.
join
(
dartSdkPath
,
'bin'
,
'snapshots'
,
artifactFileName
);
return
fs
.
path
.
join
(
dartSdkPath
,
'bin'
,
'snapshots'
,
_artifactToFileName
(
artifact
)
);
case
Artifact
.
kernelWorkerSnapshot
:
case
Artifact
.
kernelWorkerSnapshot
:
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'dart-sdk'
,
'bin'
,
'snapshots'
,
artifactFileName
);
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'dart-sdk'
,
'bin'
,
'snapshots'
,
_artifactToFileName
(
artifact
));
case
Artifact
.
ideviceId
:
case
Artifact
.
ideviceinfo
:
case
Artifact
.
idevicename
:
case
Artifact
.
idevicescreenshot
:
case
Artifact
.
idevicesyslog
:
return
cache
.
getArtifactDirectory
(
'libimobiledevice'
).
childFile
(
artifactFileName
).
path
;
case
Artifact
.
ideviceinstaller
:
return
cache
.
getArtifactDirectory
(
'ideviceinstaller'
).
childFile
(
artifactFileName
).
path
;
case
Artifact
.
iosDeploy
:
return
cache
.
getArtifactDirectory
(
'ios-deploy'
).
childFile
(
artifactFileName
).
path
;
case
Artifact
.
iproxy
:
return
cache
.
getArtifactDirectory
(
'usbmuxd'
).
childFile
(
artifactFileName
).
path
;
case
Artifact
.
linuxDesktopPath
:
case
Artifact
.
linuxDesktopPath
:
return
fs
.
path
.
join
(
_hostEngineOutPath
,
artifactFileName
);
return
fs
.
path
.
join
(
_hostEngineOutPath
,
_artifactToFileName
(
artifact
)
);
case
Artifact
.
windowsDesktopPath
:
case
Artifact
.
windowsDesktopPath
:
return
fs
.
path
.
join
(
_hostEngineOutPath
,
artifactFileName
);
return
fs
.
path
.
join
(
_hostEngineOutPath
,
_artifactToFileName
(
artifact
)
);
case
Artifact
.
skyEnginePath
:
case
Artifact
.
skyEnginePath
:
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'gen'
,
'dart-pkg'
,
artifactFileName
);
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'gen'
,
'dart-pkg'
,
_artifactToFileName
(
artifact
)
);
}
}
assert
(
false
,
'Invalid artifact
$artifact
.'
);
assert
(
false
,
'Invalid artifact
$artifact
.'
);
return
null
;
return
null
;
...
...
packages/flutter_tools/lib/src/base/process.dart
View file @
e91822da
...
@@ -263,26 +263,20 @@ Future<RunResult> runCheckedAsync(
...
@@ -263,26 +263,20 @@ Future<RunResult> runCheckedAsync(
return
result
;
return
result
;
}
}
bool
exitsHappy
(
bool
exitsHappy
(
List
<
String
>
cli
)
{
List
<
String
>
cli
,
{
Map
<
String
,
String
>
environment
,
})
{
_traceCommand
(
cli
);
_traceCommand
(
cli
);
try
{
try
{
return
processManager
.
runSync
(
cli
,
environment:
environment
).
exitCode
==
0
;
return
processManager
.
runSync
(
cli
).
exitCode
==
0
;
}
catch
(
error
)
{
}
catch
(
error
)
{
printTrace
(
'
$cli
failed with
$error
'
);
printTrace
(
'
$cli
failed with
$error
'
);
return
false
;
return
false
;
}
}
}
}
Future
<
bool
>
exitsHappyAsync
(
Future
<
bool
>
exitsHappyAsync
(
List
<
String
>
cli
)
async
{
List
<
String
>
cli
,
{
Map
<
String
,
String
>
environment
,
})
async
{
_traceCommand
(
cli
);
_traceCommand
(
cli
);
try
{
try
{
return
(
await
processManager
.
run
(
cli
,
environment:
environment
)).
exitCode
==
0
;
return
(
await
processManager
.
run
(
cli
)).
exitCode
==
0
;
}
catch
(
error
)
{
}
catch
(
error
)
{
printTrace
(
'
$cli
failed with
$error
'
);
printTrace
(
'
$cli
failed with
$error
'
);
return
false
;
return
false
;
...
...
packages/flutter_tools/lib/src/base/user_messages.dart
View file @
e91822da
...
@@ -145,6 +145,44 @@ class UserMessages {
...
@@ -145,6 +145,44 @@ class UserMessages {
'Once installed, run:
\n
'
'Once installed, run:
\n
'
' sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer'
;
' sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer'
;
// Messages used in IOSValidator
String
get
iOSIMobileDeviceMissing
=>
'libimobiledevice and ideviceinstaller are not installed. To install with Brew, run:
\n
'
' brew update
\n
'
' brew install --HEAD usbmuxd
\n
'
' brew link usbmuxd
\n
'
' brew install --HEAD libimobiledevice
\n
'
' brew install ideviceinstaller'
;
String
get
iOSIMobileDeviceBroken
=>
'Verify that all connected devices have been paired with this computer in Xcode.
\n
'
'If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
\n
'
'To update with Brew, run:
\n
'
' brew update
\n
'
' brew uninstall --ignore-dependencies libimobiledevice
\n
'
' brew uninstall --ignore-dependencies usbmuxd
\n
'
' brew install --HEAD usbmuxd
\n
'
' brew unlink usbmuxd
\n
'
' brew link usbmuxd
\n
'
' brew install --HEAD libimobiledevice
\n
'
' brew install ideviceinstaller'
;
String
get
iOSDeviceInstallerMissing
=>
'ideviceinstaller is not installed; this is used to discover connected iOS devices.
\n
'
'To install with Brew, run:
\n
'
' brew install --HEAD usbmuxd
\n
'
' brew link usbmuxd
\n
'
' brew install --HEAD libimobiledevice
\n
'
' brew install ideviceinstaller'
;
String
iOSDeployVersion
(
String
version
)
=>
'ios-deploy
$version
'
;
String
iOSDeployOutdated
(
String
minVersion
)
=>
'ios-deploy out of date (
$minVersion
is required). To upgrade with Brew:
\n
'
' brew upgrade ios-deploy'
;
String
get
iOSDeployMissing
=>
'ios-deploy not installed. To install:
\n
'
' brew install ios-deploy'
;
String
get
iOSBrewMissing
=>
'Brew can be used to install tools for iOS device development.
\n
'
'Download brew at https://brew.sh/.'
;
// Messages used in CocoaPodsValidator
// Messages used in CocoaPodsValidator
String
cocoaPodsVersion
(
String
version
)
=>
'CocoaPods version
$version
'
;
String
cocoaPodsVersion
(
String
version
)
=>
'CocoaPods version
$version
'
;
String
cocoaPodsUninitialized
(
String
consequence
)
=>
String
cocoaPodsUninitialized
(
String
consequence
)
=>
...
@@ -168,6 +206,9 @@ class UserMessages {
...
@@ -168,6 +206,9 @@ class UserMessages {
'
$consequence
\n
'
'
$consequence
\n
'
'To upgrade:
\n
'
'To upgrade:
\n
'
'
$upgradeInstructions
'
;
'
$upgradeInstructions
'
;
String
get
cocoaPodsBrewMissing
=>
'Brew can be used to install CocoaPods.
\n
'
'Download brew at https://brew.sh/.'
;
// Messages used in VsCodeValidator
// Messages used in VsCodeValidator
String
vsCodeVersion
(
String
version
)
=>
'version
$version
'
;
String
vsCodeVersion
(
String
version
)
=>
'version
$version
'
;
...
...
packages/flutter_tools/lib/src/cache.dart
View file @
e91822da
...
@@ -53,7 +53,7 @@ class DevelopmentArtifact {
...
@@ -53,7 +53,7 @@ class DevelopmentArtifact {
/// Artifacts required by all developments.
/// Artifacts required by all developments.
static
const
DevelopmentArtifact
universal
=
DevelopmentArtifact
.
_
(
'universal'
);
static
const
DevelopmentArtifact
universal
=
DevelopmentArtifact
.
_
(
'universal'
);
/// The values of DevelopmentArtifacts.
/// The va
u
lues of DevelopmentArtifacts.
static
final
List
<
DevelopmentArtifact
>
values
=
<
DevelopmentArtifact
>[
static
final
List
<
DevelopmentArtifact
>
values
=
<
DevelopmentArtifact
>[
android
,
android
,
iOS
,
iOS
,
...
@@ -83,9 +83,6 @@ class Cache {
...
@@ -83,9 +83,6 @@ class Cache {
_artifacts
.
add
(
LinuxEngineArtifacts
(
this
));
_artifacts
.
add
(
LinuxEngineArtifacts
(
this
));
_artifacts
.
add
(
LinuxFuchsiaSDKArtifacts
(
this
));
_artifacts
.
add
(
LinuxFuchsiaSDKArtifacts
(
this
));
_artifacts
.
add
(
MacOSFuchsiaSDKArtifacts
(
this
));
_artifacts
.
add
(
MacOSFuchsiaSDKArtifacts
(
this
));
for
(
String
artifactName
in
IosUsbArtifacts
.
artifactNames
)
{
_artifacts
.
add
(
IosUsbArtifacts
(
artifactName
,
this
));
}
}
else
{
}
else
{
_artifacts
.
addAll
(
artifacts
);
_artifacts
.
addAll
(
artifacts
);
}
}
...
@@ -224,22 +221,6 @@ class Cache {
...
@@ -224,22 +221,6 @@ class Cache {
return
getCacheArtifacts
().
childDirectory
(
name
);
return
getCacheArtifacts
().
childDirectory
(
name
);
}
}
MapEntry
<
String
,
String
>
get
dyLdLibEntry
{
if
(
_dyLdLibEntry
!=
null
)
{
return
_dyLdLibEntry
;
}
final
List
<
String
>
paths
=
<
String
>[];
for
(
CachedArtifact
artifact
in
_artifacts
)
{
final
String
currentPath
=
artifact
.
dyLdLibPath
;
if
(
currentPath
.
isNotEmpty
)
{
paths
.
add
(
currentPath
);
}
}
_dyLdLibEntry
=
MapEntry
<
String
,
String
>(
'DYLD_LIBARY_PATH'
,
paths
.
join
(
':'
));
return
_dyLdLibEntry
;
}
MapEntry
<
String
,
String
>
_dyLdLibEntry
;
/// The web sdk has to be co-located with the dart-sdk so that they can share source
/// The web sdk has to be co-located with the dart-sdk so that they can share source
/// code.
/// code.
Directory
getWebSdkDirectory
()
{
Directory
getWebSdkDirectory
()
{
...
@@ -347,9 +328,6 @@ abstract class CachedArtifact {
...
@@ -347,9 +328,6 @@ abstract class CachedArtifact {
// artifact name.
// artifact name.
String
get
stampName
=>
name
;
String
get
stampName
=>
name
;
/// Returns a string to be set as environment DYLD_LIBARY_PATH variable
String
get
dyLdLibPath
=>
''
;
/// All development artifacts this cache provides.
/// All development artifacts this cache provides.
final
Set
<
DevelopmentArtifact
>
developmentArtifacts
;
final
Set
<
DevelopmentArtifact
>
developmentArtifacts
;
...
@@ -912,39 +890,6 @@ class MacOSFuchsiaSDKArtifacts extends _FuchsiaSDKArtifacts {
...
@@ -912,39 +890,6 @@ class MacOSFuchsiaSDKArtifacts extends _FuchsiaSDKArtifacts {
}
}
}
}
/// Cached iOS/USB binary artifacts.
class
IosUsbArtifacts
extends
CachedArtifact
{
IosUsbArtifacts
(
String
name
,
Cache
cache
)
:
super
(
name
,
cache
,
// This is universal to ensure every command checks for them first
const
<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
},
);
static
const
List
<
String
>
artifactNames
=
<
String
>[
'libimobiledevice'
,
'usbmuxd'
,
'libplist'
,
'openssl'
,
'ideviceinstaller'
,
'ios-deploy'
,
];
@override
String
get
dyLdLibPath
{
return
cache
.
getArtifactDirectory
(
name
).
path
;
}
@override
Future
<
void
>
updateInner
()
{
if
(!
platform
.
isMacOS
)
{
return
Future
<
void
>.
value
();
}
final
Uri
archiveUri
=
Uri
.
parse
(
'
$_storageBaseUrl
/flutter_infra/ios-usb-dependencies/
$name
/
$version
/
$name
.zip'
);
return
_downloadZipArchive
(
'Downloading
$name
...'
,
archiveUri
,
location
);
}
}
// Many characters are problematic in filenames, especially on Windows.
// Many characters are problematic in filenames, especially on Windows.
final
Map
<
int
,
List
<
int
>>
_flattenNameSubstitutions
=
<
int
,
List
<
int
>>{
final
Map
<
int
,
List
<
int
>>
_flattenNameSubstitutions
=
<
int
,
List
<
int
>>{
r'@'
.
codeUnitAt
(
0
):
'@@'
.
codeUnits
,
r'@'
.
codeUnitAt
(
0
):
'@@'
.
codeUnits
,
...
...
packages/flutter_tools/lib/src/context_runner.dart
View file @
e91822da
...
@@ -87,8 +87,9 @@ Future<T> runInContext<T>(
...
@@ -87,8 +87,9 @@ Future<T> runInContext<T>(
FuchsiaWorkflow:
()
=>
FuchsiaWorkflow
(),
FuchsiaWorkflow:
()
=>
FuchsiaWorkflow
(),
GenSnapshot:
()
=>
const
GenSnapshot
(),
GenSnapshot:
()
=>
const
GenSnapshot
(),
HotRunnerConfig:
()
=>
HotRunnerConfig
(),
HotRunnerConfig:
()
=>
HotRunnerConfig
(),
IMobileDevice:
()
=>
IMobileDevice
(),
IMobileDevice:
()
=>
const
IMobileDevice
(),
IOSSimulatorUtils:
()
=>
IOSSimulatorUtils
(),
IOSSimulatorUtils:
()
=>
IOSSimulatorUtils
(),
IOSValidator:
()
=>
const
IOSValidator
(),
IOSWorkflow:
()
=>
const
IOSWorkflow
(),
IOSWorkflow:
()
=>
const
IOSWorkflow
(),
KernelCompilerFactory:
()
=>
const
KernelCompilerFactory
(),
KernelCompilerFactory:
()
=>
const
KernelCompilerFactory
(),
LinuxWorkflow:
()
=>
const
LinuxWorkflow
(),
LinuxWorkflow:
()
=>
const
LinuxWorkflow
(),
...
...
packages/flutter_tools/lib/src/doctor.dart
View file @
e91822da
...
@@ -72,6 +72,8 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
...
@@ -72,6 +72,8 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
GroupedValidator
(<
DoctorValidator
>[
androidValidator
,
androidLicenseValidator
]),
GroupedValidator
(<
DoctorValidator
>[
androidValidator
,
androidLicenseValidator
]),
if
(
iosWorkflow
.
appliesToHostPlatform
||
macOSWorkflow
.
appliesToHostPlatform
)
if
(
iosWorkflow
.
appliesToHostPlatform
||
macOSWorkflow
.
appliesToHostPlatform
)
GroupedValidator
(<
DoctorValidator
>[
xcodeValidator
,
cocoapodsValidator
]),
GroupedValidator
(<
DoctorValidator
>[
xcodeValidator
,
cocoapodsValidator
]),
if
(
iosWorkflow
.
appliesToHostPlatform
)
iosValidator
,
if
(
webWorkflow
.
appliesToHostPlatform
)
if
(
webWorkflow
.
appliesToHostPlatform
)
const
WebValidator
(),
const
WebValidator
(),
// Add desktop doctors to workflow if the flag is enabled.
// Add desktop doctors to workflow if the flag is enabled.
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
e91822da
...
@@ -7,7 +7,6 @@ import 'dart:async';
...
@@ -7,7 +7,6 @@ import 'dart:async';
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'../application_package.dart'
;
import
'../application_package.dart'
;
import
'../artifacts.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/io.dart'
;
import
'../base/logger.dart'
;
import
'../base/logger.dart'
;
...
@@ -24,6 +23,10 @@ import 'code_signing.dart';
...
@@ -24,6 +23,10 @@ import 'code_signing.dart';
import
'ios_workflow.dart'
;
import
'ios_workflow.dart'
;
import
'mac.dart'
;
import
'mac.dart'
;
const
String
_kIdeviceinstallerInstructions
=
'To work with iOS devices, please install ideviceinstaller. To install, run:
\n
'
'brew install ideviceinstaller.'
;
class
IOSDeploy
{
class
IOSDeploy
{
const
IOSDeploy
();
const
IOSDeploy
();
...
@@ -34,15 +37,9 @@ class IOSDeploy {
...
@@ -34,15 +37,9 @@ class IOSDeploy {
@required
String
bundlePath
,
@required
String
bundlePath
,
@required
List
<
String
>
launchArguments
,
@required
List
<
String
>
launchArguments
,
})
async
{
})
async
{
final
String
iosDeployPath
=
artifacts
.
getArtifactPath
(
Artifact
.
iosDeploy
,
platform:
TargetPlatform
.
ios
);
final
List
<
String
>
launchCommand
=
<
String
>[
// TODO(fujino): remove fallback once g3 updated
const
List
<
String
>
fallbackIosDeployPath
=
<
String
>[
'/usr/bin/env'
,
'/usr/bin/env'
,
'ios-deploy'
,
'ios-deploy'
,
];
final
List
<
String
>
commandList
=
iosDeployPath
!=
null
?
<
String
>[
iosDeployPath
]
:
fallbackIosDeployPath
;
final
List
<
String
>
launchCommand
=
<
String
>[
...
commandList
,
'--id'
,
'--id'
,
deviceId
,
deviceId
,
'--bundle'
,
'--bundle'
,
...
@@ -64,7 +61,6 @@ class IOSDeploy {
...
@@ -64,7 +61,6 @@ class IOSDeploy {
// it.
// it.
final
Map
<
String
,
String
>
iosDeployEnv
=
Map
<
String
,
String
>.
from
(
platform
.
environment
);
final
Map
<
String
,
String
>
iosDeployEnv
=
Map
<
String
,
String
>.
from
(
platform
.
environment
);
iosDeployEnv
[
'PATH'
]
=
'/usr/bin:
${iosDeployEnv['PATH']}
'
;
iosDeployEnv
[
'PATH'
]
=
'/usr/bin:
${iosDeployEnv['PATH']}
'
;
iosDeployEnv
.
addEntries
(<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
]);
return
await
runCommandAndStreamOutput
(
return
await
runCommandAndStreamOutput
(
launchCommand
,
launchCommand
,
...
@@ -124,20 +120,8 @@ class IOSDevice extends Device {
...
@@ -124,20 +120,8 @@ class IOSDevice extends Device {
platformType:
PlatformType
.
ios
,
platformType:
PlatformType
.
ios
,
ephemeral:
true
,
ephemeral:
true
,
)
{
)
{
if
(
platform
.
isMacOS
)
{
_installerPath
=
_checkForCommand
(
'ideviceinstaller'
);
printError
(
'Cannot control iOS devices or simulators. ideviceinstaller and iproxy are not available on your platform.'
);
_iproxyPath
=
_checkForCommand
(
'iproxy'
);
_installerPath
=
null
;
_iproxyPath
=
null
;
return
;
}
_installerPath
=
artifacts
.
getArtifactPath
(
Artifact
.
ideviceinstaller
,
platform:
TargetPlatform
.
ios
)
??
'ideviceinstaller'
;
// TODO(fujino): remove fallback once g3 updated
_iproxyPath
=
artifacts
.
getArtifactPath
(
Artifact
.
iproxy
,
platform:
TargetPlatform
.
ios
)
??
'iproxy'
;
// TODO(fujino): remove fallback once g3 updated
}
}
String
_installerPath
;
String
_installerPath
;
...
@@ -189,6 +173,23 @@ class IOSDevice extends Device {
...
@@ -189,6 +173,23 @@ class IOSDevice extends Device {
return
devices
;
return
devices
;
}
}
static
String
_checkForCommand
(
String
command
,
[
String
macInstructions
=
_kIdeviceinstallerInstructions
,
])
{
try
{
command
=
runCheckedSync
(<
String
>[
'which'
,
command
]).
trim
();
}
catch
(
e
)
{
if
(
platform
.
isMacOS
)
{
printError
(
'
$command
not found.
$macInstructions
'
);
}
else
{
printError
(
'Cannot control iOS devices or simulators.
$command
is not available on your platform.'
);
}
return
null
;
}
return
command
;
}
@override
@override
Future
<
bool
>
isAppInstalled
(
ApplicationPackage
app
)
async
{
Future
<
bool
>
isAppInstalled
(
ApplicationPackage
app
)
async
{
try
{
try
{
...
@@ -588,17 +589,12 @@ class _IOSDevicePortForwarder extends DevicePortForwarder {
...
@@ -588,17 +589,12 @@ 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
runCommand
(<
String
>[
<
String
>[
device
.
_iproxyPath
,
device
.
_iproxyPath
,
hostPort
.
toString
(),
hostPort
.
toString
(),
devicePort
.
toString
(),
devicePort
.
toString
(),
device
.
id
,
device
.
id
,
]);
],
environment:
Map
<
String
,
String
>.
fromEntries
(
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
],
),
);
// TODO(ianh): This is a flakey race condition, https://github.com/libimobiledevice/libimobiledevice/issues/674
// TODO(ianh): This is a flakey race condition, https://github.com/libimobiledevice/libimobiledevice/issues/674
connected
=
!
await
process
.
stdout
.
isEmpty
.
timeout
(
_kiProxyPortForwardTimeout
,
onTimeout:
()
=>
false
);
connected
=
!
await
process
.
stdout
.
isEmpty
.
timeout
(
_kiProxyPortForwardTimeout
,
onTimeout:
()
=>
false
);
if
(!
connected
)
{
if
(!
connected
)
{
...
...
packages/flutter_tools/lib/src/ios/ios_workflow.dart
View file @
e91822da
...
@@ -2,13 +2,21 @@
...
@@ -2,13 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:async'
;
import
'../base/context.dart'
;
import
'../base/context.dart'
;
import
'../base/os.dart'
;
import
'../base/platform.dart'
;
import
'../base/platform.dart'
;
import
'../base/process.dart'
;
import
'../base/user_messages.dart'
;
import
'../base/version.dart'
;
import
'../doctor.dart'
;
import
'../doctor.dart'
;
import
'../macos/xcode.dart'
;
import
'../macos/xcode.dart'
;
import
'mac.dart'
;
import
'plist_utils.dart'
as
plist
;
import
'plist_utils.dart'
as
plist
;
IOSWorkflow
get
iosWorkflow
=>
context
.
get
<
IOSWorkflow
>();
IOSWorkflow
get
iosWorkflow
=>
context
.
get
<
IOSWorkflow
>();
IOSValidator
get
iosValidator
=>
context
.
get
<
IOSValidator
>();
class
IOSWorkflow
implements
Workflow
{
class
IOSWorkflow
implements
Workflow
{
const
IOSWorkflow
();
const
IOSWorkflow
();
...
@@ -32,3 +40,86 @@ class IOSWorkflow implements Workflow {
...
@@ -32,3 +40,86 @@ class IOSWorkflow implements Workflow {
return
plist
.
getValueFromFile
(
path
,
key
);
return
plist
.
getValueFromFile
(
path
,
key
);
}
}
}
}
class
IOSValidator
extends
DoctorValidator
{
const
IOSValidator
()
:
super
(
'iOS tools - develop for iOS devices'
);
Future
<
bool
>
get
hasIDeviceInstaller
=>
exitsHappyAsync
(<
String
>[
'ideviceinstaller'
,
'-h'
]);
Future
<
bool
>
get
hasIosDeploy
=>
exitsHappyAsync
(<
String
>[
'ios-deploy'
,
'--version'
]);
String
get
iosDeployMinimumVersion
=>
'1.9.4'
;
// ios-deploy <= v1.9.3 declares itself as v2.0.0
List
<
String
>
get
iosDeployBadVersions
=>
<
String
>[
'2.0.0'
];
Future
<
String
>
get
iosDeployVersionText
async
=>
(
await
runAsync
(<
String
>[
'ios-deploy'
,
'--version'
])).
processResult
.
stdout
.
replaceAll
(
'
\n
'
,
''
);
bool
get
hasHomebrew
=>
os
.
which
(
'brew'
)
!=
null
;
Future
<
String
>
get
macDevMode
async
=>
(
await
runAsync
(<
String
>[
'DevToolsSecurity'
,
'-status'
])).
processResult
.
stdout
;
Future
<
bool
>
get
_iosDeployIsInstalledAndMeetsVersionCheck
async
{
if
(!
await
hasIosDeploy
)
return
false
;
try
{
final
Version
version
=
Version
.
parse
(
await
iosDeployVersionText
);
return
version
>=
Version
.
parse
(
iosDeployMinimumVersion
)
&&
!
iosDeployBadVersions
.
map
((
String
v
)
=>
Version
.
parse
(
v
)).
contains
(
version
);
}
on
FormatException
catch
(
_
)
{
return
false
;
}
}
// Change this value if the number of checks for packages needed for installation changes
static
const
int
totalChecks
=
4
;
@override
Future
<
ValidationResult
>
validate
()
async
{
final
List
<
ValidationMessage
>
messages
=
<
ValidationMessage
>[];
ValidationType
packageManagerStatus
=
ValidationType
.
installed
;
int
checksFailed
=
0
;
if
(!
iMobileDevice
.
isInstalled
)
{
checksFailed
+=
3
;
packageManagerStatus
=
ValidationType
.
partial
;
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
iOSIMobileDeviceMissing
));
}
else
if
(!
await
iMobileDevice
.
isWorking
)
{
checksFailed
+=
2
;
packageManagerStatus
=
ValidationType
.
partial
;
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
iOSIMobileDeviceBroken
));
}
else
if
(!
await
hasIDeviceInstaller
)
{
checksFailed
+=
1
;
packageManagerStatus
=
ValidationType
.
partial
;
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
iOSDeviceInstallerMissing
));
}
final
bool
iHasIosDeploy
=
await
hasIosDeploy
;
// Check ios-deploy is installed at meets version requirements.
if
(
iHasIosDeploy
)
{
messages
.
add
(
ValidationMessage
(
userMessages
.
iOSDeployVersion
(
await
iosDeployVersionText
)));
}
if
(!
await
_iosDeployIsInstalledAndMeetsVersionCheck
)
{
packageManagerStatus
=
ValidationType
.
partial
;
if
(
iHasIosDeploy
)
{
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
iOSDeployOutdated
(
iosDeployMinimumVersion
)));
}
else
{
checksFailed
+=
1
;
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
iOSDeployMissing
));
}
}
// If one of the checks for the packages failed, we may need brew so that we can install
// the necessary packages. If they're all there, however, we don't even need it.
if
(
checksFailed
==
totalChecks
)
packageManagerStatus
=
ValidationType
.
missing
;
if
(
checksFailed
>
0
&&
!
hasHomebrew
)
{
messages
.
add
(
ValidationMessage
.
hint
(
userMessages
.
iOSBrewMissing
));
}
return
ValidationResult
(
packageManagerStatus
,
messages
);
}
}
packages/flutter_tools/lib/src/ios/mac.dart
View file @
e91822da
...
@@ -7,7 +7,6 @@ import 'dart:async';
...
@@ -7,7 +7,6 @@ import 'dart:async';
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'../application_package.dart'
;
import
'../application_package.dart'
;
import
'../artifacts.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'
;
...
@@ -43,99 +42,35 @@ class IOSDeviceNotFoundError implements Exception {
...
@@ -43,99 +42,35 @@ class IOSDeviceNotFoundError implements Exception {
}
}
class
IMobileDevice
{
class
IMobileDevice
{
IMobileDevice
()
const
IMobileDevice
();
:
_ideviceIdPath
=
artifacts
.
getArtifactPath
(
Artifact
.
ideviceId
,
platform:
TargetPlatform
.
ios
)
??
'idevice_id'
,
// TODO(fujino): remove fallback once g3 updated
bool
get
isInstalled
=>
exitsHappy
(<
String
>[
'idevice_id'
,
'-h'
]);
_ideviceinfoPath
=
artifacts
.
getArtifactPath
(
Artifact
.
ideviceinfo
,
platform:
TargetPlatform
.
ios
)
??
'ideviceinfo'
,
// TODO(fujino): remove fallback once g3 updated
_idevicenamePath
=
artifacts
.
getArtifactPath
(
Artifact
.
idevicename
,
platform:
TargetPlatform
.
ios
)
??
'idevicename'
,
// TODO(fujino): remove fallback once g3 updated
_idevicesyslogPath
=
artifacts
.
getArtifactPath
(
Artifact
.
idevicesyslog
,
platform:
TargetPlatform
.
ios
)
??
'idevicesyslog'
,
// TODO(fujino): remove fallback once g3 updated
_idevicescreenshotPath
=
artifacts
.
getArtifactPath
(
Artifact
.
idevicescreenshot
,
platform:
TargetPlatform
.
ios
)
??
'idevicescreenshot'
{
// TODO(fujino): remove fallback once g3 updated
}
final
String
_ideviceIdPath
;
final
String
_ideviceinfoPath
;
final
String
_idevicenamePath
;
final
String
_idevicesyslogPath
;
final
String
_idevicescreenshotPath
;
bool
get
isInstalled
{
_isInstalled
??=
exitsHappy
(
<
String
>[
_ideviceIdPath
,
'-h'
],
environment:
Map
<
String
,
String
>.
fromEntries
(
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
]
),
);
return
_isInstalled
;
}
bool
_isInstalled
;
/// Returns true if libimobiledevice is installed and working as expected.
/// Returns true if libimobiledevice is installed and working as expected.
///
///
/// Older releases of libimobiledevice fail to work with iOS 10.3 and above.
/// Older releases of libimobiledevice fail to work with iOS 10.3 and above.
Future
<
bool
>
get
isWorking
async
{
Future
<
bool
>
get
isWorking
async
{
if
(
_isWorking
!=
null
)
{
if
(!
isInstalled
)
return
_isWorking
;
return
false
;
}
if
(!
isInstalled
)
{
_isWorking
=
false
;
return
_isWorking
;
}
// If usage info is printed in a hyphenated id, we need to update.
// If usage info is printed in a hyphenated id, we need to update.
const
String
fakeIphoneId
=
'00008020-001C2D903C42002E'
;
const
String
fakeIphoneId
=
'00008020-001C2D903C42002E'
;
final
Map
<
String
,
String
>
executionEnv
=
Map
<
String
,
String
>.
fromEntries
(
final
ProcessResult
ideviceResult
=
(
await
runAsync
(<
String
>[
'ideviceinfo'
,
'-u'
,
fakeIphoneId
])).
processResult
;
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
]
);
final
ProcessResult
ideviceResult
=
(
await
runAsync
(
<
String
>[
_ideviceinfoPath
,
'-u'
,
fakeIphoneId
],
environment:
executionEnv
,
)).
processResult
;
if
(
ideviceResult
.
stdout
.
contains
(
'Usage: ideviceinfo'
))
{
if
(
ideviceResult
.
stdout
.
contains
(
'Usage: ideviceinfo'
))
{
_isWorking
=
false
;
return
false
;
return
_isWorking
;
}
}
// 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
runAsync
(<
String
>[
'idevice_id'
,
'-l'
])).
processResult
;
<
String
>[
if
(
result
.
exitCode
==
0
&&
result
.
stdout
.
isEmpty
)
_ideviceIdPath
,
return
true
;
'-l'
,
],
// Check that we can look up the names of any attached devices.
environment:
executionEnv
,
return
await
exitsHappyAsync
(<
String
>[
'idevicename'
]);
)).
processResult
;
if
(
result
.
exitCode
==
0
&&
result
.
stdout
.
isEmpty
)
{
_isWorking
=
true
;
}
else
{
// Check that we can look up the names of any attached devices.
_isWorking
=
await
exitsHappyAsync
(
<
String
>[
_idevicenamePath
],
environment:
executionEnv
,
);
}
return
_isWorking
;
}
}
bool
_isWorking
;
Future
<
String
>
getAvailableDeviceIDs
()
async
{
Future
<
String
>
getAvailableDeviceIDs
()
async
{
try
{
try
{
final
ProcessResult
result
=
await
processManager
.
run
(
final
ProcessResult
result
=
await
processManager
.
run
(<
String
>[
'idevice_id'
,
'-l'
]);
<
String
>[
_ideviceIdPath
,
'-l'
],
environment:
Map
<
String
,
String
>.
fromEntries
(
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
]
),
);
if
(
result
.
exitCode
!=
0
)
if
(
result
.
exitCode
!=
0
)
throw
ToolExit
(
'idevice_id returned an error:
\n
${result.stderr}
'
);
throw
ToolExit
(
'idevice_id returned an error:
\n
${result.stderr}
'
);
return
result
.
stdout
;
return
result
.
stdout
;
...
@@ -146,18 +81,7 @@ class IMobileDevice {
...
@@ -146,18 +81,7 @@ class IMobileDevice {
Future
<
String
>
getInfoForDevice
(
String
deviceID
,
String
key
)
async
{
Future
<
String
>
getInfoForDevice
(
String
deviceID
,
String
key
)
async
{
try
{
try
{
final
ProcessResult
result
=
await
processManager
.
run
(
final
ProcessResult
result
=
await
processManager
.
run
(<
String
>[
'ideviceinfo'
,
'-u'
,
deviceID
,
'-k'
,
key
]);
<
String
>[
_ideviceinfoPath
,
'-u'
,
deviceID
,
'-k'
,
key
],
environment:
Map
<
String
,
String
>.
fromEntries
(
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
]
),
);
if
(
result
.
exitCode
==
255
&&
result
.
stdout
!=
null
&&
result
.
stdout
.
contains
(
'No device found'
))
if
(
result
.
exitCode
==
255
&&
result
.
stdout
!=
null
&&
result
.
stdout
.
contains
(
'No device found'
))
throw
IOSDeviceNotFoundError
(
'ideviceinfo could not find device:
\n
${result.stdout}
'
);
throw
IOSDeviceNotFoundError
(
'ideviceinfo could not find device:
\n
${result.stdout}
'
);
if
(
result
.
exitCode
!=
0
)
if
(
result
.
exitCode
!=
0
)
...
@@ -169,30 +93,11 @@ class IMobileDevice {
...
@@ -169,30 +93,11 @@ 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
)
=>
runCommand
(<
String
>[
'idevicesyslog'
,
'-u'
,
deviceID
]);
return
runCommand
(
<
String
>[
_idevicesyslogPath
,
'-u'
,
deviceID
,
],
environment:
Map
<
String
,
String
>.
fromEntries
(
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
]
),
);
}
/// 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
runCheckedAsync
(<
String
>[
'idevicescreenshot'
,
outputFile
.
path
]);
<
String
>[
_idevicescreenshotPath
,
outputFile
.
path
],
environment:
Map
<
String
,
String
>.
fromEntries
(
<
MapEntry
<
String
,
String
>>[
cache
.
dyLdLibEntry
]
),
);
}
}
}
}
...
...
packages/flutter_tools/lib/src/macos/cocoapods.dart
View file @
e91822da
...
@@ -30,11 +30,11 @@ const String unknownCocoaPodsConsequence = '''
...
@@ -30,11 +30,11 @@ const String unknownCocoaPodsConsequence = '''
Ensure
that
the
output
of
'pod --version'
contains
only
digits
and
.
to
be
recognized
by
Flutter
.
''';
Ensure
that
the
output
of
'pod --version'
contains
only
digits
and
.
to
be
recognized
by
Flutter
.
''';
const String cocoaPodsInstallInstructions = '''
const String cocoaPodsInstallInstructions = '''
sudo
gem
install
cocoapods
brew
install
cocoapods
pod
setup
''';
pod
setup
''';
const String cocoaPodsUpgradeInstructions = '''
const String cocoaPodsUpgradeInstructions = '''
sudo
gem
install
cocoapods
brew
upgrade
cocoapods
pod
setup
''';
pod
setup
''';
CocoaPods get cocoaPods => context.get<CocoaPods>();
CocoaPods get cocoaPods => context.get<CocoaPods>();
...
...
packages/flutter_tools/lib/src/macos/cocoapods_validator.dart
View file @
e91822da
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
import
'dart:async'
;
import
'dart:async'
;
import
'../base/context.dart'
;
import
'../base/context.dart'
;
import
'../base/os.dart'
;
import
'../base/user_messages.dart'
;
import
'../base/user_messages.dart'
;
import
'../doctor.dart'
;
import
'../doctor.dart'
;
import
'cocoapods.dart'
;
import
'cocoapods.dart'
;
...
@@ -14,6 +15,8 @@ CocoaPodsValidator get cocoapodsValidator => context.get<CocoaPodsValidator>();
...
@@ -14,6 +15,8 @@ CocoaPodsValidator get cocoapodsValidator => context.get<CocoaPodsValidator>();
class
CocoaPodsValidator
extends
DoctorValidator
{
class
CocoaPodsValidator
extends
DoctorValidator
{
const
CocoaPodsValidator
()
:
super
(
'CocoaPods subvalidator'
);
const
CocoaPodsValidator
()
:
super
(
'CocoaPods subvalidator'
);
bool
get
hasHomebrew
=>
os
.
which
(
'brew'
)
!=
null
;
@override
@override
Future
<
ValidationResult
>
validate
()
async
{
Future
<
ValidationResult
>
validate
()
async
{
final
List
<
ValidationMessage
>
messages
=
<
ValidationMessage
>[];
final
List
<
ValidationMessage
>
messages
=
<
ValidationMessage
>[];
...
@@ -45,6 +48,11 @@ class CocoaPodsValidator extends DoctorValidator {
...
@@ -45,6 +48,11 @@ class CocoaPodsValidator extends DoctorValidator {
}
}
}
}
// Only check/report homebrew status if CocoaPods isn't installed.
if
(
status
==
ValidationType
.
missing
&&
!
hasHomebrew
)
{
messages
.
add
(
ValidationMessage
.
hint
(
userMessages
.
cocoaPodsBrewMissing
));
}
return
ValidationResult
(
status
,
messages
);
return
ValidationResult
(
status
,
messages
);
}
}
}
}
\ No newline at end of file
packages/flutter_tools/test/cache_test.dart
View file @
e91822da
...
@@ -107,22 +107,6 @@ void main() {
...
@@ -107,22 +107,6 @@ void main() {
verifyNever
(
artifact1
.
update
(<
DevelopmentArtifact
>{}));
verifyNever
(
artifact1
.
update
(<
DevelopmentArtifact
>{}));
verify
(
artifact2
.
update
(<
DevelopmentArtifact
>{}));
verify
(
artifact2
.
update
(<
DevelopmentArtifact
>{}));
});
});
testUsingContext
(
'getter dyLdLibEntry concatenates the output of each artifact
\'
s dyLdLibEntry getter'
,
()
async
{
final
CachedArtifact
artifact1
=
MockCachedArtifact
();
final
CachedArtifact
artifact2
=
MockCachedArtifact
();
final
CachedArtifact
artifact3
=
MockCachedArtifact
();
when
(
artifact1
.
dyLdLibPath
).
thenReturn
(
'/path/to/alpha:/path/to/beta'
);
when
(
artifact2
.
dyLdLibPath
).
thenReturn
(
'/path/to/gamma:/path/to/delta:/path/to/epsilon'
);
when
(
artifact3
.
dyLdLibPath
).
thenReturn
(
''
);
// Empty output
final
Cache
cache
=
Cache
(
artifacts:
<
CachedArtifact
>[
artifact1
,
artifact2
,
artifact3
]);
expect
(
cache
.
dyLdLibEntry
.
key
,
'DYLD_LIBARY_PATH'
);
expect
(
cache
.
dyLdLibEntry
.
value
,
'/path/to/alpha:/path/to/beta:/path/to/gamma:/path/to/delta:/path/to/epsilon'
,
);
},
overrides:
<
Type
,
Generator
>{
Cache:
()=>
mockCache
,
});
testUsingContext
(
'failed storage.googleapis.com download shows China warning'
,
()
async
{
testUsingContext
(
'failed storage.googleapis.com download shows China warning'
,
()
async
{
final
CachedArtifact
artifact1
=
MockCachedArtifact
();
final
CachedArtifact
artifact1
=
MockCachedArtifact
();
final
CachedArtifact
artifact2
=
MockCachedArtifact
();
final
CachedArtifact
artifact2
=
MockCachedArtifact
();
...
...
packages/flutter_tools/test/ios/code_signing_test.dart
View file @
e91822da
...
@@ -425,7 +425,7 @@ void main() {
...
@@ -425,7 +425,7 @@ void main() {
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
iosApp:
app
);
final
Map
<
String
,
String
>
signingConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
iosApp:
app
);
expect
(
expect
(
testLogger
.
errorText
.
replaceAll
(
'
\n
'
,
' '
)
,
testLogger
.
errorText
,
contains
(
'Saved signing certificate "iPhone Developer: Invalid Profile" is not a valid development certificate'
),
contains
(
'Saved signing certificate "iPhone Developer: Invalid Profile" is not a valid development certificate'
),
);
);
expect
(
expect
(
...
...
packages/flutter_tools/test/ios/ios_workflow_test.dart
0 → 100644
View file @
e91822da
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/doctor.dart'
;
import
'package:flutter_tools/src/ios/ios_workflow.dart'
;
import
'package:flutter_tools/src/ios/mac.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:process/process.dart'
;
import
'../src/common.dart'
;
import
'../src/context.dart'
;
void
main
(
)
{
group
(
'iOS Workflow validation'
,
()
{
MockIMobileDevice
iMobileDevice
;
MockIMobileDevice
iMobileDeviceUninstalled
;
MockProcessManager
processManager
;
FileSystem
fs
;
setUp
(()
{
iMobileDevice
=
MockIMobileDevice
();
iMobileDeviceUninstalled
=
MockIMobileDevice
(
isInstalled:
false
);
processManager
=
MockProcessManager
();
fs
=
MemoryFileSystem
();
});
testUsingContext
(
'Emit missing status when nothing is installed'
,
()
async
{
final
IOSWorkflowTestTarget
workflow
=
IOSWorkflowTestTarget
(
hasHomebrew:
false
,
hasIosDeploy:
false
,
hasIDeviceInstaller:
false
,
iosDeployVersionText:
'0.0.0'
,
);
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
missing
);
},
overrides:
<
Type
,
Generator
>{
IMobileDevice:
()
=>
iMobileDeviceUninstalled
,
});
testUsingContext
(
'Emits installed status when homebrew not installed, but not needed'
,
()
async
{
final
IOSWorkflowTestTarget
workflow
=
IOSWorkflowTestTarget
(
hasHomebrew:
false
);
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
installed
);
},
overrides:
<
Type
,
Generator
>{
IMobileDevice:
()
=>
iMobileDevice
,
});
testUsingContext
(
'Emits partial status when libimobiledevice is not installed'
,
()
async
{
final
IOSWorkflowTestTarget
workflow
=
IOSWorkflowTestTarget
();
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
partial
);
},
overrides:
<
Type
,
Generator
>{
IMobileDevice:
()
=>
MockIMobileDevice
(
isInstalled:
false
,
isWorking:
false
),
});
testUsingContext
(
'Emits partial status when libimobiledevice is installed but not working'
,
()
async
{
final
IOSWorkflowTestTarget
workflow
=
IOSWorkflowTestTarget
();
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
partial
);
},
overrides:
<
Type
,
Generator
>{
IMobileDevice:
()
=>
MockIMobileDevice
(
isWorking:
false
),
});
testUsingContext
(
'Emits partial status when libimobiledevice is installed but not working'
,
()
async
{
when
(
processManager
.
run
(
<
String
>[
'ideviceinfo'
,
'-u'
,
'00008020-001C2D903C42002E'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
)),
).
thenAnswer
((
Invocation
_
)
async
{
final
MockProcessResult
result
=
MockProcessResult
();
when
<
String
>(
result
.
stdout
).
thenReturn
(
r''
'
Usage: ideviceinfo [OPTIONS]
Show information about a connected device.
-d, --debug enable communication debugging
-s, --simple use a simple connection to avoid auto-pairing with the device
-u, --udid UDID target specific device by its 40-digit device UDID
-q, --domain NAME set domain of query to NAME. Default: None
-k, --key NAME only query key specified by NAME. Default: All keys.
-x, --xml output information as xml plist instead of key/value pairs
-h, --help prints usage information
'''
);
return
null
;
});
final
IOSWorkflowTestTarget
workflow
=
IOSWorkflowTestTarget
();
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
partial
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
});
testUsingContext
(
'Emits partial status when ios-deploy is not installed'
,
()
async
{
final
IOSWorkflowTestTarget
workflow
=
IOSWorkflowTestTarget
(
hasIosDeploy:
false
);
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
partial
);
},
overrides:
<
Type
,
Generator
>{
IMobileDevice:
()
=>
iMobileDevice
,
});
testUsingContext
(
'Emits partial status when ios-deploy version is too low'
,
()
async
{
final
IOSWorkflowTestTarget
workflow
=
IOSWorkflowTestTarget
(
iosDeployVersionText:
'1.8.0'
);
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
partial
);
},
overrides:
<
Type
,
Generator
>{
IMobileDevice:
()
=>
iMobileDevice
,
});
testUsingContext
(
'Emits partial status when ios-deploy version is a known bad version'
,
()
async
{
final
IOSWorkflowTestTarget
workflow
=
IOSWorkflowTestTarget
(
iosDeployVersionText:
'2.0.0'
);
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
partial
);
},
overrides:
<
Type
,
Generator
>{
IMobileDevice:
()
=>
iMobileDevice
,
});
testUsingContext
(
'Succeeds when all checks pass'
,
()
async
{
final
ValidationResult
result
=
await
IOSWorkflowTestTarget
().
validate
();
expect
(
result
.
type
,
ValidationType
.
installed
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
IMobileDevice:
()
=>
iMobileDevice
,
ProcessManager:
()
=>
processManager
,
});
});
}
final
ProcessResult
exitsHappy
=
ProcessResult
(
1
,
// pid
0
,
// exitCode
''
,
// stdout
''
,
// stderr
);
class
MockIMobileDevice
extends
IMobileDevice
{
MockIMobileDevice
({
this
.
isInstalled
=
true
,
bool
isWorking
=
true
,
})
:
isWorking
=
Future
<
bool
>.
value
(
isWorking
);
@override
final
bool
isInstalled
;
@override
final
Future
<
bool
>
isWorking
;
}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockProcessResult
extends
Mock
implements
ProcessResult
{}
class
IOSWorkflowTestTarget
extends
IOSValidator
{
IOSWorkflowTestTarget
({
this
.
hasHomebrew
=
true
,
bool
hasIosDeploy
=
true
,
String
iosDeployVersionText
=
'1.9.4'
,
bool
hasIDeviceInstaller
=
true
,
})
:
hasIosDeploy
=
Future
<
bool
>.
value
(
hasIosDeploy
),
iosDeployVersionText
=
Future
<
String
>.
value
(
iosDeployVersionText
),
hasIDeviceInstaller
=
Future
<
bool
>.
value
(
hasIDeviceInstaller
);
@override
final
bool
hasHomebrew
;
@override
final
Future
<
bool
>
hasIosDeploy
;
@override
final
Future
<
String
>
iosDeployVersionText
;
@override
final
Future
<
bool
>
hasIDeviceInstaller
;
}
packages/flutter_tools/test/ios/mac_test.dart
View file @
e91822da
...
@@ -9,8 +9,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
...
@@ -9,8 +9,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
import
'package:flutter_tools/src/base/io.dart'
show
ProcessException
,
ProcessResult
;
import
'package:flutter_tools/src/base/io.dart'
show
ProcessException
,
ProcessResult
;
import
'package:flutter_tools/src/ios/mac.dart'
;
import
'package:flutter_tools/src/ios/mac.dart'
;
import
'package:flutter_tools/src/ios/xcodeproj.dart'
;
import
'package:flutter_tools/src/ios/xcodeproj.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:platform/platform.dart'
;
import
'package:platform/platform.dart'
;
...
@@ -24,8 +22,6 @@ final Map<Type, Generator> noColorTerminalOverride = <Type, Generator>{
...
@@ -24,8 +22,6 @@ final Map<Type, Generator> noColorTerminalOverride = <Type, Generator>{
Platform:
_kNoColorTerminalPlatform
,
Platform:
_kNoColorTerminalPlatform
,
};
};
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
class
MockCache
extends
Mock
implements
Cache
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockFile
extends
Mock
implements
File
{}
class
MockFile
extends
Mock
implements
File
{}
class
MockXcodeProjectInterpreter
extends
Mock
implements
XcodeProjectInterpreter
{}
class
MockXcodeProjectInterpreter
extends
Mock
implements
XcodeProjectInterpreter
{}
...
@@ -36,80 +32,41 @@ void main() {
...
@@ -36,80 +32,41 @@ void main() {
final
FakePlatform
osx
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())
final
FakePlatform
osx
=
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())
..
operatingSystem
=
'macos'
;
..
operatingSystem
=
'macos'
;
MockProcessManager
mockProcessManager
;
MockProcessManager
mockProcessManager
;
final
String
libimobiledevicePath
=
fs
.
path
.
join
(
'bin'
,
'cache'
,
'artifacts'
,
'libimobiledevice'
);
final
String
ideviceIdPath
=
fs
.
path
.
join
(
libimobiledevicePath
,
'idevice_id'
);
final
String
ideviceInfoPath
=
fs
.
path
.
join
(
libimobiledevicePath
,
'ideviceinfo'
);
final
String
idevicescreenshotPath
=
fs
.
path
.
join
(
libimobiledevicePath
,
'idevicescreenshot'
);
MockArtifacts
mockArtifacts
;
MockCache
mockCache
;
setUp
(()
{
setUp
(()
{
mockProcessManager
=
MockProcessManager
();
mockProcessManager
=
MockProcessManager
();
mockCache
=
MockCache
();
mockArtifacts
=
MockArtifacts
();
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
ideviceId
,
platform:
anyNamed
(
'platform'
))).
thenReturn
(
ideviceIdPath
);
when
(
mockCache
.
dyLdLibEntry
).
thenReturn
(
MapEntry
<
String
,
String
>(
'DYLD_LIBRARY_PATH'
,
libimobiledevicePath
)
);
});
testUsingContext
(
'isWorking returns false if libimobiledevice is not installed'
,
()
async
{
when
(
mockProcessManager
.
runSync
(
<
String
>[
ideviceIdPath
,
'-h'
],
environment:
anyNamed
(
'environment'
)
)).
thenReturn
(
ProcessResult
(
123
,
1
,
''
,
''
));
expect
(
await
iMobileDevice
.
isWorking
,
false
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
Artifacts:
()
=>
mockArtifacts
,
});
});
testUsingContext
(
'getAvailableDeviceIDs throws ToolExit when libimobiledevice is not installed'
,
()
async
{
testUsingContext
(
'getAvailableDeviceIDs throws ToolExit when libimobiledevice is not installed'
,
()
async
{
when
(
mockProcessManager
.
run
(
when
(
mockProcessManager
.
run
(<
String
>[
'idevice_id'
,
'-l'
]))
<
String
>[
ideviceIdPath
,
'-l'
],
.
thenThrow
(
const
ProcessException
(
'idevice_id'
,
<
String
>[
'-l'
]));
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
)).
thenThrow
(
ProcessException
(
ideviceIdPath
,
<
String
>[
'-l'
]));
expect
(()
async
=>
await
iMobileDevice
.
getAvailableDeviceIDs
(),
throwsToolExit
());
expect
(()
async
=>
await
iMobileDevice
.
getAvailableDeviceIDs
(),
throwsToolExit
());
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Cache:
()
=>
mockCache
,
Artifacts:
()
=>
mockArtifacts
,
});
});
testUsingContext
(
'getAvailableDeviceIDs throws ToolExit when idevice_id returns non-zero'
,
()
async
{
testUsingContext
(
'getAvailableDeviceIDs throws ToolExit when idevice_id returns non-zero'
,
()
async
{
when
(
mockProcessManager
.
run
(
when
(
mockProcessManager
.
run
(<
String
>[
'idevice_id'
,
'-l'
]))
<
String
>[
ideviceIdPath
,
'-l'
],
.
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
1
,
''
,
'Sad today'
)));
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
1
,
''
,
'Sad today'
)));
expect
(()
async
=>
await
iMobileDevice
.
getAvailableDeviceIDs
(),
throwsToolExit
());
expect
(()
async
=>
await
iMobileDevice
.
getAvailableDeviceIDs
(),
throwsToolExit
());
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Cache:
()
=>
mockCache
,
Artifacts:
()
=>
mockArtifacts
,
});
});
testUsingContext
(
'getAvailableDeviceIDs returns idevice_id output when installed'
,
()
async
{
testUsingContext
(
'getAvailableDeviceIDs returns idevice_id output when installed'
,
()
async
{
when
(
mockProcessManager
.
run
(
when
(
mockProcessManager
.
run
(<
String
>[
'idevice_id'
,
'-l'
]))
<
String
>[
ideviceIdPath
,
'-l'
],
.
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
0
,
'foo'
,
''
)));
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
0
,
'foo'
,
''
)));
expect
(
await
iMobileDevice
.
getAvailableDeviceIDs
(),
'foo'
);
expect
(
await
iMobileDevice
.
getAvailableDeviceIDs
(),
'foo'
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Cache:
()
=>
mockCache
,
Artifacts:
()
=>
mockArtifacts
,
});
});
testUsingContext
(
'getInfoForDevice throws IOSDeviceNotFoundError when ideviceinfo returns specific error code and message'
,
()
async
{
testUsingContext
(
'getInfoForDevice throws IOSDeviceNotFoundError when ideviceinfo returns specific error code and message'
,
()
async
{
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
ideviceinfo
,
platform:
anyNamed
(
'platform'
))).
thenReturn
(
ideviceInfoPath
);
when
(
mockProcessManager
.
run
(<
String
>[
'ideviceinfo'
,
'-u'
,
'foo'
,
'-k'
,
'bar'
]))
when
(
mockProcessManager
.
run
(
.
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
255
,
'No device found with udid foo, is it plugged in?'
,
''
)));
<
String
>[
ideviceInfoPath
,
'-u'
,
'foo'
,
'-k'
,
'bar'
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
1
,
255
,
'No device found with udid foo, is it plugged in?'
,
''
)));
expect
(()
async
=>
await
iMobileDevice
.
getInfoForDevice
(
'foo'
,
'bar'
),
throwsA
(
isInstanceOf
<
IOSDeviceNotFoundError
>()));
expect
(()
async
=>
await
iMobileDevice
.
getInfoForDevice
(
'foo'
,
'bar'
),
throwsA
(
isInstanceOf
<
IOSDeviceNotFoundError
>()));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Cache:
()
=>
mockCache
,
Artifacts:
()
=>
mockArtifacts
,
});
});
group
(
'screenshot'
,
()
{
group
(
'screenshot'
,
()
{
...
@@ -120,15 +77,14 @@ void main() {
...
@@ -120,15 +77,14 @@ void main() {
setUp
(()
{
setUp
(()
{
mockProcessManager
=
MockProcessManager
();
mockProcessManager
=
MockProcessManager
();
mockOutputFile
=
MockFile
();
mockOutputFile
=
MockFile
();
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
idevicescreenshot
,
platform:
anyNamed
(
'platform'
))).
thenReturn
(
idevicescreenshotPath
);
});
});
testUsingContext
(
'error if idevicescreenshot is not installed'
,
()
async
{
testUsingContext
(
'error if idevicescreenshot is not installed'
,
()
async
{
when
(
mockOutputFile
.
path
).
thenReturn
(
outputPath
);
when
(
mockOutputFile
.
path
).
thenReturn
(
outputPath
);
// Let `idevicescreenshot` fail with exit code 1.
// Let `idevicescreenshot` fail with exit code 1.
when
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
outputPath
],
when
(
mockProcessManager
.
run
(<
String
>[
'idevicescreenshot'
,
outputPath
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
}
,
environment:
null
,
workingDirectory:
null
,
workingDirectory:
null
,
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
1
,
''
,
''
)));
)).
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
1
,
''
,
''
)));
...
@@ -136,23 +92,20 @@ void main() {
...
@@ -136,23 +92,20 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Platform:
()
=>
osx
,
Platform:
()
=>
osx
,
Cache:
()
=>
mockCache
,
});
});
testUsingContext
(
'idevicescreenshot captures and returns screenshot'
,
()
async
{
testUsingContext
(
'idevicescreenshot captures and returns screenshot'
,
()
async
{
when
(
mockOutputFile
.
path
).
thenReturn
(
outputPath
);
when
(
mockOutputFile
.
path
).
thenReturn
(
outputPath
);
when
(
mockProcessManager
.
run
(
any
,
environment:
anyNamed
(
'environment'
)
,
workingDirectory:
null
)).
thenAnswer
(
when
(
mockProcessManager
.
run
(
any
,
environment:
null
,
workingDirectory:
null
)).
thenAnswer
(
(
Invocation
invocation
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
0
,
''
,
''
)));
(
Invocation
invocation
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
0
,
''
,
''
)));
await
iMobileDevice
.
takeScreenshot
(
mockOutputFile
);
await
iMobileDevice
.
takeScreenshot
(
mockOutputFile
);
verify
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
outputPath
],
verify
(
mockProcessManager
.
run
(<
String
>[
'idevicescreenshot'
,
outputPath
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
}
,
environment:
null
,
workingDirectory:
null
,
workingDirectory:
null
,
));
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Cache:
()
=>
mockCache
,
Artifacts:
()
=>
mockArtifacts
,
});
});
});
});
});
});
...
...
packages/flutter_tools/test/macos/cocoapods_validator_test.dart
View file @
e91822da
...
@@ -23,7 +23,7 @@ void main() {
...
@@ -23,7 +23,7 @@ void main() {
});
});
testUsingContext
(
'Emits installed status when CocoaPods is installed'
,
()
async
{
testUsingContext
(
'Emits installed status when CocoaPods is installed'
,
()
async
{
const
CocoaPodsValidator
workflow
=
CocoaPodsValidator
();
final
CocoaPodsTestTarget
workflow
=
CocoaPodsTestTarget
();
final
ValidationResult
result
=
await
workflow
.
validate
();
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
installed
);
expect
(
result
.
type
,
ValidationType
.
installed
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -33,7 +33,7 @@ void main() {
...
@@ -33,7 +33,7 @@ void main() {
testUsingContext
(
'Emits missing status when CocoaPods is not installed'
,
()
async
{
testUsingContext
(
'Emits missing status when CocoaPods is not installed'
,
()
async
{
when
(
cocoaPods
.
evaluateCocoaPodsInstallation
)
when
(
cocoaPods
.
evaluateCocoaPodsInstallation
)
.
thenAnswer
((
_
)
async
=>
CocoaPodsStatus
.
notInstalled
);
.
thenAnswer
((
_
)
async
=>
CocoaPodsStatus
.
notInstalled
);
const
CocoaPodsValidator
workflow
=
CocoaPodsValidator
();
final
CocoaPodsTestTarget
workflow
=
CocoaPodsTestTarget
();
final
ValidationResult
result
=
await
workflow
.
validate
();
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
missing
);
expect
(
result
.
type
,
ValidationType
.
missing
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -43,7 +43,7 @@ void main() {
...
@@ -43,7 +43,7 @@ void main() {
testUsingContext
(
'Emits partial status when CocoaPods is installed with unknown version'
,
()
async
{
testUsingContext
(
'Emits partial status when CocoaPods is installed with unknown version'
,
()
async
{
when
(
cocoaPods
.
evaluateCocoaPodsInstallation
)
when
(
cocoaPods
.
evaluateCocoaPodsInstallation
)
.
thenAnswer
((
_
)
async
=>
CocoaPodsStatus
.
unknownVersion
);
.
thenAnswer
((
_
)
async
=>
CocoaPodsStatus
.
unknownVersion
);
const
CocoaPodsValidator
workflow
=
CocoaPodsValidator
();
final
CocoaPodsTestTarget
workflow
=
CocoaPodsTestTarget
();
final
ValidationResult
result
=
await
workflow
.
validate
();
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
partial
);
expect
(
result
.
type
,
ValidationType
.
partial
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -52,7 +52,7 @@ void main() {
...
@@ -52,7 +52,7 @@ void main() {
testUsingContext
(
'Emits partial status when CocoaPods is not initialized'
,
()
async
{
testUsingContext
(
'Emits partial status when CocoaPods is not initialized'
,
()
async
{
when
(
cocoaPods
.
isCocoaPodsInitialized
).
thenAnswer
((
_
)
async
=>
false
);
when
(
cocoaPods
.
isCocoaPodsInitialized
).
thenAnswer
((
_
)
async
=>
false
);
const
CocoaPodsValidator
workflow
=
CocoaPodsValidator
();
final
CocoaPodsTestTarget
workflow
=
CocoaPodsTestTarget
();
final
ValidationResult
result
=
await
workflow
.
validate
();
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
partial
);
expect
(
result
.
type
,
ValidationType
.
partial
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -62,13 +62,30 @@ void main() {
...
@@ -62,13 +62,30 @@ void main() {
testUsingContext
(
'Emits partial status when CocoaPods version is too low'
,
()
async
{
testUsingContext
(
'Emits partial status when CocoaPods version is too low'
,
()
async
{
when
(
cocoaPods
.
evaluateCocoaPodsInstallation
)
when
(
cocoaPods
.
evaluateCocoaPodsInstallation
)
.
thenAnswer
((
_
)
async
=>
CocoaPodsStatus
.
belowRecommendedVersion
);
.
thenAnswer
((
_
)
async
=>
CocoaPodsStatus
.
belowRecommendedVersion
);
const
CocoaPodsValidator
workflow
=
CocoaPodsValidator
();
final
CocoaPodsTestTarget
workflow
=
CocoaPodsTestTarget
();
final
ValidationResult
result
=
await
workflow
.
validate
();
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
partial
);
expect
(
result
.
type
,
ValidationType
.
partial
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
CocoaPods:
()
=>
cocoaPods
,
CocoaPods:
()
=>
cocoaPods
,
});
});
testUsingContext
(
'Emits installed status when homebrew not installed, but not needed'
,
()
async
{
final
CocoaPodsTestTarget
workflow
=
CocoaPodsTestTarget
(
hasHomebrew:
false
);
final
ValidationResult
result
=
await
workflow
.
validate
();
expect
(
result
.
type
,
ValidationType
.
installed
);
},
overrides:
<
Type
,
Generator
>{
CocoaPods:
()
=>
cocoaPods
,
});
});
});
}
}
class
MockCocoaPods
extends
Mock
implements
CocoaPods
{}
class
MockCocoaPods
extends
Mock
implements
CocoaPods
{}
class
CocoaPodsTestTarget
extends
CocoaPodsValidator
{
CocoaPodsTestTarget
({
this
.
hasHomebrew
=
true
,
});
@override
final
bool
hasHomebrew
;
}
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