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
675fd554
Unverified
Commit
675fd554
authored
Jan 27, 2021
by
Jenn Magder
Committed by
GitHub
Jan 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace MockXcode with Xcode.test in unit tests (#74777)
parent
c6a428d5
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
140 additions
and
120 deletions
+140
-120
xcodeproj.dart
packages/flutter_tools/lib/src/ios/xcodeproj.dart
+66
-12
xcode.dart
packages/flutter_tools/lib/src/macos/xcode.dart
+26
-6
xcode_test.dart
...es/flutter_tools/test/general.shard/macos/xcode_test.dart
+48
-102
No files found.
packages/flutter_tools/lib/src/ios/xcodeproj.dart
View file @
675fd554
...
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:file/memory.dart'
;
import
'package:meta/meta.dart'
;
import
'package:process/process.dart'
;
...
...
@@ -229,13 +230,34 @@ List<String> _xcodeBuildSettingsLines({
/// Interpreter of Xcode projects.
class
XcodeProjectInterpreter
{
XcodeProjectInterpreter
({
factory
XcodeProjectInterpreter
({
@required
Platform
platform
,
@required
ProcessManager
processManager
,
@required
Logger
logger
,
@required
FileSystem
fileSystem
,
@required
Terminal
terminal
,
@required
Usage
usage
,
})
{
return
XcodeProjectInterpreter
.
_
(
platform:
platform
,
processManager:
processManager
,
logger:
logger
,
fileSystem:
fileSystem
,
terminal:
terminal
,
usage:
usage
,
);
}
XcodeProjectInterpreter
.
_
({
@required
Platform
platform
,
@required
ProcessManager
processManager
,
@required
Logger
logger
,
@required
FileSystem
fileSystem
,
@required
Terminal
terminal
,
@required
Usage
usage
,
int
majorVersion
,
int
minorVersion
,
int
patchVersion
,
})
:
_platform
=
platform
,
_fileSystem
=
fileSystem
,
_terminal
=
terminal
,
...
...
@@ -247,8 +269,40 @@ class XcodeProjectInterpreter {
platform:
platform
,
processManager:
processManager
,
),
_majorVersion
=
majorVersion
,
_minorVersion
=
minorVersion
,
_patchVersion
=
patchVersion
,
_usage
=
usage
;
/// Create an [XcodeProjectInterpreter] for testing.
///
/// Defaults to installed with sufficient version,
/// a memory file system, fake platform, buffer logger,
/// test [Usage], and test [Terminal].
/// Set [majorVersion] to null to simulate Xcode not being installed.
factory
XcodeProjectInterpreter
.
test
({
@required
ProcessManager
processManager
,
int
majorVersion
=
1000
,
int
minorVersion
=
0
,
int
patchVersion
=
0
,
})
{
final
Platform
platform
=
FakePlatform
(
operatingSystem:
'macos'
,
environment:
<
String
,
String
>{},
);
return
XcodeProjectInterpreter
.
_
(
fileSystem:
MemoryFileSystem
.
test
(),
platform:
platform
,
processManager:
processManager
,
usage:
Usage
.
test
(),
logger:
BufferLogger
.
test
(),
terminal:
Terminal
.
test
(),
majorVersion:
majorVersion
,
minorVersion:
minorVersion
,
patchVersion:
patchVersion
,
);
}
final
Platform
_platform
;
final
FileSystem
_fileSystem
;
final
ProcessUtils
_processUtils
;
...
...
packages/flutter_tools/lib/src/macos/xcode.dart
View file @
675fd554
...
...
@@ -4,6 +4,7 @@
import
'dart:async'
;
import
'package:file/memory.dart'
;
import
'package:meta/meta.dart'
;
import
'package:process/process.dart'
;
...
...
@@ -55,6 +56,30 @@ class Xcode {
_processUtils
=
ProcessUtils
(
logger:
logger
,
processManager:
processManager
);
/// Create an [Xcode] for testing.
///
/// Defaults to a memory file system, fake platform,
/// buffer logger, and test [XcodeProjectInterpreter].
@visibleForTesting
factory
Xcode
.
test
({
@required
ProcessManager
processManager
,
XcodeProjectInterpreter
xcodeProjectInterpreter
,
Platform
platform
,
FileSystem
fileSystem
,
})
{
platform
??=
FakePlatform
(
operatingSystem:
'macos'
,
environment:
<
String
,
String
>{},
);
return
Xcode
(
platform:
platform
,
processManager:
processManager
,
fileSystem:
fileSystem
??
MemoryFileSystem
.
test
(),
logger:
BufferLogger
.
test
(),
xcodeProjectInterpreter:
xcodeProjectInterpreter
??
XcodeProjectInterpreter
.
test
(
processManager:
processManager
),
);
}
final
Platform
_platform
;
final
ProcessUtils
_processUtils
;
final
FileSystem
_fileSystem
;
...
...
@@ -78,12 +103,7 @@ class Xcode {
return
_xcodeSelectPath
;
}
bool
get
isInstalled
{
if
(
xcodeSelectPath
==
null
||
xcodeSelectPath
.
isEmpty
)
{
return
false
;
}
return
_xcodeProjectInterpreter
.
isInstalled
;
}
bool
get
isInstalled
=>
_xcodeProjectInterpreter
.
isInstalled
;
Version
get
currentVersion
=>
Version
(
_xcodeProjectInterpreter
.
majorVersion
,
...
...
packages/flutter_tools/test/general.shard/macos/xcode_test.dart
View file @
675fd554
This diff is collapsed.
Click to expand it.
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