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
91f7902a
Commit
91f7902a
authored
Jan 25, 2020
by
Jenn Magder
Committed by
Flutter GitHub Bot
Jan 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Xcode context fetch to global.dart (#49458)
parent
2042c7d5
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
54 additions
and
57 deletions
+54
-57
build.dart
packages/flutter_tools/lib/src/base/build.dart
+3
-3
ios.dart
packages/flutter_tools/lib/src/build_system/targets/ios.dart
+2
-2
macos.dart
...ges/flutter_tools/lib/src/build_system/targets/macos.dart
+1
-2
build_ios_framework.dart
...s/flutter_tools/lib/src/commands/build_ios_framework.dart
+1
-1
clean.dart
packages/flutter_tools/lib/src/commands/clean.dart
+1
-2
globals.dart
packages/flutter_tools/lib/src/globals.dart
+2
-0
ios_emulators.dart
packages/flutter_tools/lib/src/ios/ios_emulators.dart
+2
-3
ios_workflow.dart
packages/flutter_tools/lib/src/ios/ios_workflow.dart
+2
-3
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+1
-1
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+2
-3
xcode.dart
packages/flutter_tools/lib/src/macos/xcode.dart
+0
-3
xcode_validator.dart
packages/flutter_tools/lib/src/macos/xcode_validator.dart
+9
-8
build_test.dart
...ges/flutter_tools/test/general.shard/base/build_test.dart
+22
-22
macos_test.dart
...s/test/general.shard/build_system/targets/macos_test.dart
+6
-4
No files found.
packages/flutter_tools/lib/src/base/build.dart
View file @
91f7902a
...
...
@@ -244,12 +244,12 @@ class AOTSnapshotter {
final
String
assemblyO
=
globals
.
fs
.
path
.
join
(
outputPath
,
'snapshot_assembly.o'
);
List
<
String
>
isysrootArgs
;
if
(
isIOS
)
{
final
String
iPhoneSDKLocation
=
await
xcode
.
sdkLocation
(
SdkType
.
iPhone
);
final
String
iPhoneSDKLocation
=
await
globals
.
xcode
.
sdkLocation
(
SdkType
.
iPhone
);
if
(
iPhoneSDKLocation
!=
null
)
{
isysrootArgs
=
<
String
>[
'-isysroot'
,
iPhoneSDKLocation
];
}
}
final
RunResult
compileResult
=
await
xcode
.
cc
(<
String
>[
final
RunResult
compileResult
=
await
globals
.
xcode
.
cc
(<
String
>[
'-arch'
,
targetArch
,
if
(
isysrootArgs
!=
null
)
...
isysrootArgs
,
if
(
bitcode
)
embedBitcodeArg
,
...
...
@@ -277,7 +277,7 @@ class AOTSnapshotter {
'-o'
,
appLib
,
assemblyO
,
];
final
RunResult
linkResult
=
await
xcode
.
clang
(
linkArgs
);
final
RunResult
linkResult
=
await
globals
.
xcode
.
clang
(
linkArgs
);
if
(
linkResult
.
exitCode
!=
0
)
{
globals
.
printError
(
'Failed to link AOT snapshot. Linker terminated with exit code
${compileResult.exitCode}
'
);
}
...
...
packages/flutter_tools/lib/src/build_system/targets/ios.dart
View file @
91f7902a
...
...
@@ -179,7 +179,7 @@ Future<RunResult> createStubAppFramework(File outputFile, SdkType sdk) async {
];
}
return
await
xcode
.
clang
(<
String
>[
return
await
globals
.
xcode
.
clang
(<
String
>[
'-x'
,
'c'
,
...
archFlags
,
...
...
@@ -189,7 +189,7 @@ Future<RunResult> createStubAppFramework(File outputFile, SdkType sdk) async {
'-Xlinker'
,
'-rpath'
,
'-Xlinker'
,
'@executable_path/Frameworks'
,
'-Xlinker'
,
'-rpath'
,
'-Xlinker'
,
'@loader_path/Frameworks'
,
'-install_name'
,
'@rpath/App.framework/App'
,
'-isysroot'
,
await
xcode
.
sdkLocation
(
sdk
),
'-isysroot'
,
await
globals
.
xcode
.
sdkLocation
(
sdk
),
'-o'
,
outputFile
.
path
,
]);
}
finally
{
...
...
packages/flutter_tools/lib/src/build_system/targets/macos.dart
View file @
91f7902a
...
...
@@ -9,7 +9,6 @@ import '../../base/io.dart';
import
'../../base/process.dart'
;
import
'../../build_info.dart'
;
import
'../../globals.dart'
as
globals
;
import
'../../macos/xcode.dart'
;
import
'../build_system.dart'
;
import
'../depfile.dart'
;
import
'../exceptions.dart'
;
...
...
@@ -155,7 +154,7 @@ class DebugMacOSFramework extends Target {
..
writeAsStringSync
(
r''
'
static const int Moo = 88;
'''
);
final
RunResult
result
=
await
xcode
.
clang
(<
String
>[
final
RunResult
result
=
await
globals
.
xcode
.
clang
(<
String
>[
'-x'
,
'c'
,
debugApp
.
path
,
...
...
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
View file @
91f7902a
...
...
@@ -127,7 +127,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
if
(!
boolArg
(
'universal'
)
&&
!
boolArg
(
'xcframework'
))
{
throwToolExit
(
'--universal or --xcframework is required.'
);
}
if
(
boolArg
(
'xcframework'
)
&&
xcode
.
majorVersion
<
11
)
{
if
(
boolArg
(
'xcframework'
)
&&
globals
.
xcode
.
majorVersion
<
11
)
{
throwToolExit
(
'--xcframework requires Xcode 11.'
);
}
if
(
buildModes
.
isEmpty
)
{
...
...
packages/flutter_tools/lib/src/commands/clean.dart
View file @
91f7902a
...
...
@@ -11,7 +11,6 @@ import '../base/logger.dart';
import
'../build_info.dart'
;
import
'../globals.dart'
as
globals
;
import
'../ios/xcodeproj.dart'
;
import
'../macos/xcode.dart'
;
import
'../project.dart'
;
import
'../runner/flutter_command.dart'
;
...
...
@@ -34,7 +33,7 @@ class CleanCommand extends FlutterCommand {
// Clean Xcode to remove intermediate DerivedData artifacts.
// Do this before removing ephemeral directory, which would delete the xcworkspace.
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
if
(
xcode
.
isInstalledAndMeetsVersionCheck
)
{
if
(
globals
.
xcode
.
isInstalledAndMeetsVersionCheck
)
{
await
_cleanXcode
(
flutterProject
.
ios
);
await
_cleanXcode
(
flutterProject
.
macos
);
}
...
...
packages/flutter_tools/lib/src/globals.dart
View file @
91f7902a
...
...
@@ -14,6 +14,7 @@ import 'base/io.dart';
import
'base/logger.dart'
;
import
'base/terminal.dart'
;
import
'cache.dart'
;
import
'macos/xcode.dart'
;
Logger
get
logger
=>
context
.
get
<
Logger
>();
Cache
get
cache
=>
context
.
get
<
Cache
>();
...
...
@@ -40,6 +41,7 @@ const Platform _kLocalPlatform = LocalPlatform();
Platform
get
platform
=>
context
.
get
<
Platform
>()
??
_kLocalPlatform
;
Xcode
get
xcode
=>
context
.
get
<
Xcode
>();
/// Display an error level message to the user. Commands should use this if they
/// fail in some way.
...
...
packages/flutter_tools/lib/src/ios/ios_emulators.dart
View file @
91f7902a
...
...
@@ -8,7 +8,6 @@ import '../base/process.dart';
import
'../device.dart'
;
import
'../emulator.dart'
;
import
'../globals.dart'
as
globals
;
import
'../macos/xcode.dart'
;
import
'ios_workflow.dart'
;
import
'simulators.dart'
;
...
...
@@ -45,7 +44,7 @@ class IOSEmulator extends Emulator {
'open'
,
...
additionalArgs
,
'-a'
,
xcode
.
getSimulatorPath
(),
globals
.
xcode
.
getSimulatorPath
(),
];
final
RunResult
launchResult
=
await
processUtils
.
run
(
args
);
...
...
@@ -69,7 +68,7 @@ class IOSEmulator extends Emulator {
/// Return the list of iOS Simulators (there can only be zero or one).
List
<
IOSEmulator
>
getEmulators
()
{
final
String
simulatorPath
=
xcode
.
getSimulatorPath
();
final
String
simulatorPath
=
globals
.
xcode
.
getSimulatorPath
();
if
(
simulatorPath
==
null
)
{
return
<
IOSEmulator
>[];
}
...
...
packages/flutter_tools/lib/src/ios/ios_workflow.dart
View file @
91f7902a
...
...
@@ -5,7 +5,6 @@
import
'../base/context.dart'
;
import
'../doctor.dart'
;
import
'../globals.dart'
as
globals
;
import
'../macos/xcode.dart'
;
IOSWorkflow
get
iosWorkflow
=>
context
.
get
<
IOSWorkflow
>();
...
...
@@ -17,12 +16,12 @@ class IOSWorkflow implements Workflow {
// We need xcode (+simctl) to list simulator devices, and libimobiledevice to list real devices.
@override
bool
get
canListDevices
=>
xcode
.
isInstalledAndMeetsVersionCheck
&&
xcode
.
isSimctlInstalled
;
bool
get
canListDevices
=>
globals
.
xcode
.
isInstalledAndMeetsVersionCheck
&&
globals
.
xcode
.
isSimctlInstalled
;
// We need xcode to launch simulator devices, and ideviceinstaller and ios-deploy
// for real devices.
@override
bool
get
canLaunchDevices
=>
xcode
.
isInstalledAndMeetsVersionCheck
;
bool
get
canLaunchDevices
=>
globals
.
xcode
.
isInstalledAndMeetsVersionCheck
;
@override
bool
get
canListEmulators
=>
false
;
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
91f7902a
...
...
@@ -717,7 +717,7 @@ bool _checkXcodeVersion() {
globals
.
printError
(
'Cannot find "xcodebuild".
$_xcodeRequirement
'
);
return
false
;
}
if
(!
xcode
.
isVersionSatisfactory
)
{
if
(!
globals
.
xcode
.
isVersionSatisfactory
)
{
globals
.
printError
(
'Found "
${xcodeProjectInterpreter.versionText}
".
$_xcodeRequirement
'
);
return
false
;
}
...
...
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
91f7902a
...
...
@@ -19,7 +19,6 @@ import '../bundle.dart';
import
'../convert.dart'
;
import
'../device.dart'
;
import
'../globals.dart'
as
globals
;
import
'../macos/xcode.dart'
;
import
'../project.dart'
;
import
'../protocol_discovery.dart'
;
import
'ios_workflow.dart'
;
...
...
@@ -47,7 +46,7 @@ class IOSSimulatorUtils {
static
IOSSimulatorUtils
get
instance
=>
context
.
get
<
IOSSimulatorUtils
>();
Future
<
List
<
IOSSimulator
>>
getAttachedDevices
()
async
{
if
(!
xcode
.
isInstalledAndMeetsVersionCheck
)
{
if
(!
globals
.
xcode
.
isInstalledAndMeetsVersionCheck
)
{
return
<
IOSSimulator
>[];
}
...
...
@@ -519,7 +518,7 @@ class IOSSimulator extends Device {
}
bool
get
_xcodeVersionSupportsScreenshot
{
return
xcode
.
majorVersion
>
8
||
(
xcode
.
majorVersion
==
8
&&
xcode
.
minorVersion
>=
2
);
return
globals
.
xcode
.
majorVersion
>
8
||
(
globals
.
xcode
.
majorVersion
==
8
&&
globals
.
xcode
.
minorVersion
>=
2
);
}
@override
...
...
packages/flutter_tools/lib/src/macos/xcode.dart
View file @
91f7902a
...
...
@@ -9,7 +9,6 @@ import 'package:platform/platform.dart';
import
'package:process/process.dart'
;
import
'../base/common.dart'
;
import
'../base/context.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/logger.dart'
;
...
...
@@ -19,8 +18,6 @@ import '../ios/xcodeproj.dart';
const
int
kXcodeRequiredVersionMajor
=
10
;
const
int
kXcodeRequiredVersionMinor
=
2
;
Xcode
get
xcode
=>
context
.
get
<
Xcode
>();
enum
SdkType
{
iPhone
,
iPhoneSimulator
,
...
...
packages/flutter_tools/lib/src/macos/xcode_validator.dart
View file @
91f7902a
...
...
@@ -5,6 +5,7 @@
import
'../base/context.dart'
;
import
'../base/user_messages.dart'
;
import
'../doctor.dart'
;
import
'../globals.dart'
as
globals
;
import
'xcode.dart'
;
XcodeValidator
get
xcodeValidator
=>
context
.
get
<
XcodeValidator
>();
...
...
@@ -18,36 +19,36 @@ class XcodeValidator extends DoctorValidator {
ValidationType
xcodeStatus
=
ValidationType
.
missing
;
String
xcodeVersionInfo
;
if
(
xcode
.
isInstalled
)
{
if
(
globals
.
xcode
.
isInstalled
)
{
xcodeStatus
=
ValidationType
.
installed
;
messages
.
add
(
ValidationMessage
(
userMessages
.
xcodeLocation
(
xcode
.
xcodeSelectPath
)));
messages
.
add
(
ValidationMessage
(
userMessages
.
xcodeLocation
(
globals
.
xcode
.
xcodeSelectPath
)));
xcodeVersionInfo
=
xcode
.
versionText
;
xcodeVersionInfo
=
globals
.
xcode
.
versionText
;
if
(
xcodeVersionInfo
.
contains
(
','
))
{
xcodeVersionInfo
=
xcodeVersionInfo
.
substring
(
0
,
xcodeVersionInfo
.
indexOf
(
','
));
}
messages
.
add
(
ValidationMessage
(
xcode
.
versionText
));
messages
.
add
(
ValidationMessage
(
globals
.
xcode
.
versionText
));
if
(!
xcode
.
isInstalledAndMeetsVersionCheck
)
{
if
(!
globals
.
xcode
.
isInstalledAndMeetsVersionCheck
)
{
xcodeStatus
=
ValidationType
.
partial
;
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
xcodeOutdated
(
kXcodeRequiredVersionMajor
,
kXcodeRequiredVersionMinor
)
));
}
if
(!
xcode
.
eulaSigned
)
{
if
(!
globals
.
xcode
.
eulaSigned
)
{
xcodeStatus
=
ValidationType
.
partial
;
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
xcodeEula
));
}
if
(!
xcode
.
isSimctlInstalled
)
{
if
(!
globals
.
xcode
.
isSimctlInstalled
)
{
xcodeStatus
=
ValidationType
.
partial
;
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
xcodeMissingSimct
));
}
}
else
{
xcodeStatus
=
ValidationType
.
missing
;
if
(
xcode
.
xcodeSelectPath
==
null
||
xcode
.
xcodeSelectPath
.
isEmpty
)
{
if
(
globals
.
xcode
.
xcodeSelectPath
==
null
||
globals
.
xcode
.
xcodeSelectPath
.
isEmpty
)
{
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
xcodeMissing
));
}
else
{
messages
.
add
(
ValidationMessage
.
error
(
userMessages
.
xcodeIncomplete
));
...
...
packages/flutter_tools/test/general.shard/base/build_test.dart
View file @
91f7902a
...
...
@@ -308,8 +308,8 @@ void main() {
};
final
RunResult
successResult
=
RunResult
(
ProcessResult
(
1
,
0
,
''
,
''
),
<
String
>[
'command name'
,
'arguments...'
]);
when
(
x
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
x
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
final
int
genSnapshotExitCode
=
await
snapshotter
.
build
(
platform:
TargetPlatform
.
ios
,
...
...
@@ -334,14 +334,14 @@ void main() {
'main.dill'
,
]);
final
VerificationResult
toVerifyCC
=
verify
(
x
code
.
cc
(
captureAny
));
final
VerificationResult
toVerifyCC
=
verify
(
mockX
code
.
cc
(
captureAny
));
expect
(
toVerifyCC
.
callCount
,
1
);
final
dynamic
ccArgs
=
toVerifyCC
.
captured
.
first
;
expect
(
ccArgs
,
contains
(
'-fembed-bitcode'
));
expect
(
ccArgs
,
contains
(
'-isysroot'
));
expect
(
ccArgs
,
contains
(
kSDKPath
));
final
VerificationResult
toVerifyClang
=
verify
(
x
code
.
clang
(
captureAny
));
final
VerificationResult
toVerifyClang
=
verify
(
mockX
code
.
clang
(
captureAny
));
expect
(
toVerifyClang
.
callCount
,
1
);
final
dynamic
clangArgs
=
toVerifyClang
.
captured
.
first
;
expect
(
clangArgs
,
contains
(
'-fembed-bitcode'
));
...
...
@@ -365,8 +365,8 @@ void main() {
};
final
RunResult
successResult
=
RunResult
(
ProcessResult
(
1
,
0
,
''
,
''
),
<
String
>[
'command name'
,
'arguments...'
]);
when
(
x
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
x
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
final
int
genSnapshotExitCode
=
await
snapshotter
.
build
(
platform:
TargetPlatform
.
ios
,
...
...
@@ -391,14 +391,14 @@ void main() {
'main.dill'
,
]);
final
VerificationResult
toVerifyCC
=
verify
(
x
code
.
cc
(
captureAny
));
final
VerificationResult
toVerifyCC
=
verify
(
mockX
code
.
cc
(
captureAny
));
expect
(
toVerifyCC
.
callCount
,
1
);
final
dynamic
ccArgs
=
toVerifyCC
.
captured
.
first
;
expect
(
ccArgs
,
contains
(
'-fembed-bitcode'
));
expect
(
ccArgs
,
contains
(
'-isysroot'
));
expect
(
ccArgs
,
contains
(
kSDKPath
));
final
VerificationResult
toVerifyClang
=
verify
(
x
code
.
clang
(
captureAny
));
final
VerificationResult
toVerifyClang
=
verify
(
mockX
code
.
clang
(
captureAny
));
expect
(
toVerifyClang
.
callCount
,
1
);
final
dynamic
clangArgs
=
toVerifyClang
.
captured
.
first
;
expect
(
clangArgs
,
contains
(
'-fembed-bitcode'
));
...
...
@@ -425,8 +425,8 @@ void main() {
};
final
RunResult
successResult
=
RunResult
(
ProcessResult
(
1
,
0
,
''
,
''
),
<
String
>[
'command name'
,
'arguments...'
]);
when
(
x
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
x
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
final
int
genSnapshotExitCode
=
await
snapshotter
.
build
(
platform:
TargetPlatform
.
ios
,
...
...
@@ -450,11 +450,11 @@ void main() {
'--no-use-integer-division'
,
'main.dill'
,
]);
verifyNever
(
x
code
.
cc
(
argThat
(
contains
(
'-fembed-bitcode'
))));
verifyNever
(
x
code
.
clang
(
argThat
(
contains
(
'-fembed-bitcode'
))));
verifyNever
(
mockX
code
.
cc
(
argThat
(
contains
(
'-fembed-bitcode'
))));
verifyNever
(
mockX
code
.
clang
(
argThat
(
contains
(
'-fembed-bitcode'
))));
verify
(
x
code
.
cc
(
argThat
(
contains
(
'-isysroot'
)))).
called
(
1
);
verify
(
x
code
.
clang
(
argThat
(
contains
(
'-isysroot'
)))).
called
(
1
);
verify
(
mockX
code
.
cc
(
argThat
(
contains
(
'-isysroot'
)))).
called
(
1
);
verify
(
mockX
code
.
clang
(
argThat
(
contains
(
'-isysroot'
)))).
called
(
1
);
final
File
assemblyFile
=
globals
.
fs
.
file
(
assembly
);
expect
(
assemblyFile
.
existsSync
(),
true
);
...
...
@@ -472,8 +472,8 @@ void main() {
};
final
RunResult
successResult
=
RunResult
(
ProcessResult
(
1
,
0
,
''
,
''
),
<
String
>[
'command name'
,
'arguments...'
]);
when
(
x
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
x
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
final
int
genSnapshotExitCode
=
await
snapshotter
.
build
(
platform:
TargetPlatform
.
ios
,
...
...
@@ -508,8 +508,8 @@ void main() {
};
final
RunResult
successResult
=
RunResult
(
ProcessResult
(
1
,
0
,
''
,
''
),
<
String
>[
'command name'
,
'arguments...'
]);
when
(
x
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
x
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
final
int
genSnapshotExitCode
=
await
snapshotter
.
build
(
platform:
TargetPlatform
.
ios
,
...
...
@@ -546,8 +546,8 @@ void main() {
};
final
RunResult
successResult
=
RunResult
(
ProcessResult
(
1
,
0
,
''
,
''
),
<
String
>[
'command name'
,
'arguments...'
]);
when
(
x
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
x
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
final
int
genSnapshotExitCode
=
await
snapshotter
.
build
(
platform:
TargetPlatform
.
ios
,
...
...
@@ -640,8 +640,8 @@ void main() {
};
final
RunResult
successResult
=
RunResult
(
ProcessResult
(
1
,
0
,
''
,
''
),
<
String
>[
'command name'
,
'arguments...'
]);
when
(
x
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
x
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
cc
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
when
(
mockX
code
.
clang
(
any
)).
thenAnswer
((
_
)
=>
Future
<
RunResult
>.
value
(
successResult
));
final
int
genSnapshotExitCode
=
await
snapshotterWithTimings
.
build
(
platform:
TargetPlatform
.
android_arm
,
...
...
packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
View file @
91f7902a
...
...
@@ -49,6 +49,7 @@ void main() {
Testbed
testbed
;
Environment
environment
;
MockPlatform
mockPlatform
;
MockXcode
mockXcode
;
setUpAll
(()
{
Cache
.
disableLocking
();
...
...
@@ -56,6 +57,7 @@ void main() {
});
setUp
(()
{
mockXcode
=
MockXcode
();
mockPlatform
=
MockPlatform
();
when
(
mockPlatform
.
isWindows
).
thenReturn
(
false
);
when
(
mockPlatform
.
isMacOS
).
thenReturn
(
true
);
...
...
@@ -202,10 +204,10 @@ void main() {
environment
.
buildDir
.
childFile
(
'snapshot_assembly.S'
).
createSync
();
return
Future
<
int
>.
value
(
0
);
});
when
(
x
code
.
cc
(
any
)).
thenAnswer
((
Invocation
invocation
)
{
when
(
mockX
code
.
cc
(
any
)).
thenAnswer
((
Invocation
invocation
)
{
return
Future
<
RunResult
>.
value
(
RunResult
(
FakeProcessResult
()..
exitCode
=
0
,
<
String
>[
'test'
]));
});
when
(
x
code
.
clang
(
any
)).
thenAnswer
((
Invocation
invocation
)
{
when
(
mockX
code
.
clang
(
any
)).
thenAnswer
((
Invocation
invocation
)
{
return
Future
<
RunResult
>.
value
(
RunResult
(
FakeProcessResult
()..
exitCode
=
0
,
<
String
>[
'test'
]));
});
environment
.
buildDir
.
childFile
(
'app.dill'
).
createSync
(
recursive:
true
);
...
...
@@ -218,7 +220,7 @@ flutter_tools:lib/''');
await
const
CompileMacOSFramework
().
build
(
environment
..
defines
[
kBuildMode
]
=
'release'
);
},
overrides:
<
Type
,
Generator
>{
GenSnapshot:
()
=>
MockGenSnapshot
(),
Xcode:
()
=>
MockXCode
()
,
Xcode:
()
=>
mockXcode
,
}));
}
...
...
@@ -226,7 +228,7 @@ class MockPlatform extends Mock implements Platform {}
class
MockCocoaPods
extends
Mock
implements
CocoaPods
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockGenSnapshot
extends
Mock
implements
GenSnapshot
{}
class
MockX
C
ode
extends
Mock
implements
Xcode
{}
class
MockX
c
ode
extends
Mock
implements
Xcode
{}
class
FakeProcessResult
implements
ProcessResult
{
@override
int
exitCode
;
...
...
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