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
125451bc
Unverified
Commit
125451bc
authored
Aug 25, 2021
by
Jenn Magder
Committed by
GitHub
Aug 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate mac.dart to null safety (#88846)
parent
a1cd3f45
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
167 additions
and
87 deletions
+167
-87
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+67
-60
xcodeproj.dart
packages/flutter_tools/lib/src/ios/xcodeproj.dart
+1
-1
ios_device_start_nonprebuilt_test.dart
.../general.shard/ios/ios_device_start_nonprebuilt_test.dart
+90
-15
mac_test.dart
packages/flutter_tools/test/general.shard/ios/mac_test.dart
+9
-11
No files found.
packages/flutter_tools/lib/src/ios/mac.dart
View file @
125451bc
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/ios/xcodeproj.dart
View file @
125451bc
...
...
@@ -373,7 +373,7 @@ class XcodeProjectBuildContext {
///
/// Represents the output of `xcodebuild -list`.
class
XcodeProjectInfo
{
XcodeProjectInfo
(
const
XcodeProjectInfo
(
this
.
targets
,
this
.
buildConfigurations
,
this
.
schemes
,
...
...
packages/flutter_tools/test/general.shard/ios/ios_device_start_nonprebuilt_test.dart
View file @
125451bc
...
...
@@ -86,18 +86,88 @@ void main() {
BufferLogger
logger
;
Xcode
xcode
;
FakeXcodeProjectInterpreter
fakeXcodeProjectInterpreter
;
XcodeProjectInfo
projectInfo
;
setUp
(()
{
logger
=
BufferLogger
.
test
();
fileSystem
=
MemoryFileSystem
.
test
();
processManager
=
FakeProcessManager
.
empty
();
fakeXcodeProjectInterpreter
=
FakeXcodeProjectInterpreter
();
projectInfo
=
XcodeProjectInfo
(
<
String
>[
'Runner'
],
<
String
>[
'Debug'
,
'Release'
],
<
String
>[
'Runner'
],
logger
,
);
fakeXcodeProjectInterpreter
=
FakeXcodeProjectInterpreter
(
projectInfo:
projectInfo
);
xcode
=
Xcode
.
test
(
processManager:
FakeProcessManager
.
any
(),
xcodeProjectInterpreter:
fakeXcodeProjectInterpreter
);
fileSystem
.
file
(
'foo/.packages'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'
\n
'
);
});
testUsingContext
(
'missing TARGET_BUILD_DIR'
,
()
async
{
final
IOSDevice
iosDevice
=
setUpIOSDevice
(
fileSystem:
fileSystem
,
processManager:
processManager
,
logger:
logger
,
artifacts:
artifacts
,
);
setUpIOSProject
(
fileSystem
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
final
BuildableIOSApp
buildableIOSApp
=
BuildableIOSApp
(
flutterProject
.
ios
,
'flutter'
,
'My Super Awesome App.app'
);
processManager
.
addCommand
(
FakeCommand
(
command:
_xattrArgs
(
flutterProject
)));
processManager
.
addCommand
(
const
FakeCommand
(
command:
kRunReleaseArgs
));
final
LaunchResult
launchResult
=
await
iosDevice
.
startApp
(
buildableIOSApp
,
debuggingOptions:
DebuggingOptions
.
disabled
(
BuildInfo
.
release
),
platformArgs:
<
String
,
Object
>{},
);
expect
(
launchResult
.
started
,
false
);
expect
(
logger
.
errorText
,
contains
(
'Xcode build is missing expected TARGET_BUILD_DIR build setting'
));
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
FileSystem:
()
=>
fileSystem
,
Logger:
()
=>
logger
,
Platform:
()
=>
macPlatform
,
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreter
(
buildSettings:
const
<
String
,
String
>{
'WRAPPER_NAME'
:
'My Super Awesome App.app'
,
'DEVELOPMENT_TEAM'
:
'3333CCCC33'
,
},
projectInfo:
projectInfo
),
Xcode:
()
=>
xcode
,
});
testUsingContext
(
'missing project info'
,
()
async
{
final
IOSDevice
iosDevice
=
setUpIOSDevice
(
fileSystem:
fileSystem
,
processManager:
FakeProcessManager
.
any
(),
logger:
logger
,
artifacts:
artifacts
,
);
setUpIOSProject
(
fileSystem
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fileSystem
.
currentDirectory
);
final
BuildableIOSApp
buildableIOSApp
=
BuildableIOSApp
(
flutterProject
.
ios
,
'flutter'
,
'My Super Awesome App.app'
);
final
LaunchResult
launchResult
=
await
iosDevice
.
startApp
(
buildableIOSApp
,
debuggingOptions:
DebuggingOptions
.
disabled
(
BuildInfo
.
release
),
platformArgs:
<
String
,
Object
>{},
);
expect
(
launchResult
.
started
,
false
);
expect
(
logger
.
errorText
,
contains
(
'Xcode project not found'
));
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FileSystem:
()
=>
fileSystem
,
Logger:
()
=>
logger
,
Platform:
()
=>
macPlatform
,
XcodeProjectInterpreter:
()
=>
FakeXcodeProjectInterpreter
(
projectInfo:
null
),
Xcode:
()
=>
xcode
,
});
testUsingContext
(
'with buildable app'
,
()
async
{
final
IOSDevice
iosDevice
=
setUpIOSDevice
(
fileSystem:
fileSystem
,
...
...
@@ -244,7 +314,8 @@ IOSDevice setUpIOSDevice({
);
logger
??=
BufferLogger
.
test
();
return
IOSDevice
(
'123'
,
return
IOSDevice
(
'123'
,
name:
'iPhone 1'
,
sdkVersion:
sdkVersion
,
fileSystem:
fileSystem
??
MemoryFileSystem
.
test
(),
...
...
@@ -270,12 +341,27 @@ IOSDevice setUpIOSDevice({
}
class
FakeXcodeProjectInterpreter
extends
Fake
implements
XcodeProjectInterpreter
{
FakeXcodeProjectInterpreter
({
@required
this
.
projectInfo
,
this
.
buildSettings
=
const
<
String
,
String
>{
'TARGET_BUILD_DIR'
:
'build/ios/Release-iphoneos'
,
'WRAPPER_NAME'
:
'My Super Awesome App.app'
,
'DEVELOPMENT_TEAM'
:
'3333CCCC33'
,
},
});
final
Map
<
String
,
String
>
buildSettings
;
final
XcodeProjectInfo
projectInfo
;
@override
final
bool
isInstalled
=
true
;
@override
final
Version
version
=
Version
(
1000
,
0
,
0
);
@override
String
get
versionText
=>
version
.
toString
();
@override
List
<
String
>
xcrunCommand
()
=>
<
String
>[
'xcrun'
];
...
...
@@ -283,23 +369,12 @@ class FakeXcodeProjectInterpreter extends Fake implements XcodeProjectInterprete
Future
<
XcodeProjectInfo
>
getInfo
(
String
projectPath
,
{
String
projectFilename
,
})
async
=>
XcodeProjectInfo
(
<
String
>[
'Runner'
],
<
String
>[
'Debug'
,
'Release'
],
<
String
>[
'Runner'
],
BufferLogger
.
test
(),
);
})
async
=>
projectInfo
;
@override
Future
<
Map
<
String
,
String
>>
getBuildSettings
(
String
projectPath
,
{
@required
XcodeProjectBuildContext
buildContext
,
Duration
timeout
=
const
Duration
(
minutes:
1
),
})
async
=>
<
String
,
String
>{
'TARGET_BUILD_DIR'
:
'build/ios/Release-iphoneos'
,
'WRAPPER_NAME'
:
'My Super Awesome App.app'
,
'DEVELOPMENT_TEAM'
:
'3333CCCC33'
,
};
})
async
=>
buildSettings
;
}
packages/flutter_tools/test/general.shard/ios/mac_test.dart
View file @
125451bc
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
...
...
@@ -23,15 +21,15 @@ import '../../src/fake_process_manager.dart';
import
'../../src/fakes.dart'
;
void
main
(
)
{
BufferLogger
logger
;
late
BufferLogger
logger
;
setUp
(()
{
logger
=
BufferLogger
.
test
();
});
group
(
'IMobileDevice'
,
()
{
Artifacts
artifacts
;
Cache
cache
;
late
Artifacts
artifacts
;
late
Cache
cache
;
setUp
(()
{
artifacts
=
Artifacts
.
test
();
...
...
@@ -44,8 +42,8 @@ void main() {
});
group
(
'screenshot'
,
()
{
FakeProcessManager
fakeProcessManager
;
File
outputFile
;
late
FakeProcessManager
fakeProcessManager
;
late
File
outputFile
;
setUp
(()
{
fakeProcessManager
=
FakeProcessManager
.
empty
();
...
...
@@ -131,8 +129,8 @@ void main() {
});
group
(
'Diagnose Xcode build failure'
,
()
{
Map
<
String
,
String
>
buildSettings
;
TestUsage
testUsage
;
late
Map
<
String
,
String
>
buildSettings
;
late
TestUsage
testUsage
;
setUp
(()
{
buildSettings
=
<
String
,
String
>{
...
...
@@ -445,7 +443,7 @@ Exited (sigterm)''',
});
group('remove Finder extended attributes', () {
Directory projectDirectory;
late
Directory projectDirectory;
setUp(() {
final MemoryFileSystem fs = MemoryFileSystem.test();
projectDirectory = fs.directory('flutter_project');
...
...
@@ -494,5 +492,5 @@ class FakeIosProject extends Fake implements IosProject {
Future<String> hostAppBundleName(BuildInfo buildInfo) async => 'UnitTestRunner.app';
@override
final Directory xcodeProject = null
;
Directory get xcodeProject => xcodeProjectInfoFile.fileSystem.directory('Runner.xcodeproj')
;
}
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