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
483f71ae
Unverified
Commit
483f71ae
authored
Jun 10, 2021
by
Jenn Magder
Committed by
GitHub
Jun 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate application_package to null safety (#83956)
parent
efe0c5eb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
33 deletions
+44
-33
application_package.dart
packages/flutter_tools/lib/src/ios/application_package.dart
+22
-24
application_package_test.dart
...er_tools/test/general.shard/application_package_test.dart
+11
-0
ios_device_install_test.dart
...tools/test/general.shard/ios/ios_device_install_test.dart
+10
-9
ios_device_start_prebuilt_test.dart
...est/general.shard/ios/ios_device_start_prebuilt_test.dart
+1
-0
No files found.
packages/flutter_tools/lib/src/ios/application_package.dart
View file @
483f71ae
...
...
@@ -2,10 +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:meta/meta.dart'
;
import
'../application_package.dart'
;
import
'../base/file_system.dart'
;
import
'../build_info.dart'
;
...
...
@@ -13,15 +9,14 @@ import '../globals_null_migrated.dart' as globals;
import
'../project.dart'
;
import
'plist_parser.dart'
;
/// Tests whether a [Directory] is an iOS bundle directory.
bool
_isBundleDirectory
(
Directory
dir
)
=>
dir
.
path
.
endsWith
(
'.app'
);
abstract
class
IOSApp
extends
ApplicationPackage
{
IOSApp
({
@
required
String
projectBundleId
})
:
super
(
id:
projectBundleId
);
IOSApp
({
required
String
projectBundleId
})
:
super
(
id:
projectBundleId
);
/// Creates a new IOSApp from an existing app bundle or IPA.
factory
IOSApp
.
fromPrebuiltApp
(
FileSystemEntity
applicationBinary
)
{
static
IOSApp
?
fromPrebuiltApp
(
FileSystemEntity
applicationBinary
)
{
final
FileSystemEntityType
entityType
=
globals
.
fs
.
typeSync
(
applicationBinary
.
path
);
if
(
entityType
==
FileSystemEntityType
.
notFound
)
{
globals
.
printError
(
...
...
@@ -61,7 +56,7 @@ abstract class IOSApp extends ApplicationPackage {
globals
.
printError
(
'Invalid prebuilt iOS app. Does not contain Info.plist.'
);
return
null
;
}
final
String
id
=
globals
.
plistParser
.
getValueFromFile
(
final
String
?
id
=
globals
.
plistParser
.
getValueFromFile
(
plistPath
,
PlistParser
.
kCFBundleIdentifierKey
,
);
...
...
@@ -77,7 +72,7 @@ abstract class IOSApp extends ApplicationPackage {
);
}
static
Future
<
IOSApp
>
fromIosProject
(
IosProject
project
,
BuildInfo
buildInfo
)
{
static
Future
<
IOSApp
?>
fromIosProject
(
IosProject
project
,
BuildInfo
buildInfo
)
async
{
if
(!
globals
.
platform
.
isMacOS
)
{
return
null
;
}
...
...
@@ -106,26 +101,29 @@ abstract class IOSApp extends ApplicationPackage {
/// Directory used by ios-deploy to store incremental installation metadata for
/// faster second installs.
Directory
get
appDeltaDirectory
;
Directory
?
get
appDeltaDirectory
;
}
class
BuildableIOSApp
extends
IOSApp
{
BuildableIOSApp
(
this
.
project
,
String
projectBundleId
,
String
hostAppBundleName
)
BuildableIOSApp
(
this
.
project
,
String
projectBundleId
,
String
?
hostAppBundleName
)
:
_hostAppBundleName
=
hostAppBundleName
,
super
(
projectBundleId:
projectBundleId
);
static
Future
<
BuildableIOSApp
>
fromProject
(
IosProject
project
,
BuildInfo
buildInfo
)
async
{
final
String
projectBundleId
=
await
project
.
productBundleIdentifier
(
buildInfo
);
final
String
hostAppBundleName
=
await
project
.
hostAppBundleName
(
buildInfo
);
return
BuildableIOSApp
(
project
,
projectBundleId
,
hostAppBundleName
);
static
Future
<
BuildableIOSApp
?>
fromProject
(
IosProject
project
,
BuildInfo
buildInfo
)
async
{
final
String
?
hostAppBundleName
=
await
project
.
hostAppBundleName
(
buildInfo
);
final
String
?
projectBundleId
=
await
project
.
productBundleIdentifier
(
buildInfo
);
if
(
projectBundleId
!=
null
)
{
return
BuildableIOSApp
(
project
,
projectBundleId
,
hostAppBundleName
);
}
return
null
;
}
final
IosProject
project
;
final
String
_hostAppBundleName
;
final
String
?
_hostAppBundleName
;
@override
String
get
name
=>
_hostAppBundleName
;
String
?
get
name
=>
_hostAppBundleName
;
@override
String
get
simulatorBundlePath
=>
_buildAppPath
(
'iphonesimulator'
);
...
...
@@ -139,8 +137,8 @@ class BuildableIOSApp extends IOSApp {
// Xcode uses this path for the final archive bundle location,
// not a top-level output directory.
// Specifying `build/ios/archive/Runner` will result in `build/ios/archive/Runner.xcarchive`.
String
get
archiveBundlePath
=>
globals
.
fs
.
path
.
join
(
getIosBuildDirectory
(),
'archive'
,
globals
.
fs
.
path
.
withoutExtension
(
_hostAppBundleName
));
String
get
archiveBundlePath
=>
globals
.
fs
.
path
.
join
(
getIosBuildDirectory
(),
'archive'
,
_hostAppBundleName
==
null
?
'Runner'
:
globals
.
fs
.
path
.
withoutExtension
(
_hostAppBundleName
!
));
// The output xcarchive bundle path `build/ios/archive/Runner.xcarchive`.
String
get
archiveBundleOutputPath
=>
...
...
@@ -156,19 +154,19 @@ class BuildableIOSApp extends IOSApp {
class
PrebuiltIOSApp
extends
IOSApp
{
PrebuiltIOSApp
({
this
.
bundleDir
,
required
this
.
bundleDir
,
this
.
bundleName
,
@
required
String
projectBundleId
,
required
String
projectBundleId
,
})
:
super
(
projectBundleId:
projectBundleId
);
final
Directory
bundleDir
;
final
String
bundleName
;
final
String
?
bundleName
;
@override
final
Directory
appDeltaDirectory
=
null
;
final
Directory
?
appDeltaDirectory
=
null
;
@override
String
get
name
=>
bundleName
;
String
?
get
name
=>
bundleName
;
@override
String
get
simulatorBundlePath
=>
_bundlePath
;
...
...
packages/flutter_tools/test/general.shard/application_package_test.dart
View file @
483f71ae
...
...
@@ -381,6 +381,17 @@ void main() {
expect
(
iosApp
,
null
);
},
overrides:
overrides
);
testUsingContext
(
'returns null when there with no product identifier'
,
()
async
{
globals
.
fs
.
file
(
'pubspec.yaml'
).
createSync
();
globals
.
fs
.
file
(
'.packages'
).
createSync
();
final
Directory
project
=
globals
.
fs
.
directory
(
'ios/Runner.xcodeproj'
)..
createSync
(
recursive:
true
);
project
.
childFile
(
'project.pbxproj'
).
createSync
();
final
BuildableIOSApp
iosApp
=
await
IOSApp
.
fromIosProject
(
FlutterProject
.
fromDirectory
(
globals
.
fs
.
currentDirectory
).
ios
,
null
)
as
BuildableIOSApp
;
expect
(
iosApp
,
null
);
},
overrides:
overrides
);
});
group
(
'FuchsiaApp'
,
()
{
...
...
packages/flutter_tools/test/general.shard/ios/ios_device_install_test.dart
View file @
483f71ae
...
...
@@ -30,14 +30,17 @@ const Map<String, String> kDyLdLibEntry = <String, String>{
void
main
(
)
{
Artifacts
artifacts
;
String
iosDeployPath
;
FileSystem
fileSystem
;
Directory
bundleDirectory
;
setUp
(()
{
artifacts
=
Artifacts
.
test
();
fileSystem
=
MemoryFileSystem
.
test
();
bundleDirectory
=
fileSystem
.
directory
(
'bundle'
);
iosDeployPath
=
artifacts
.
getHostArtifact
(
HostArtifact
.
iosDeploy
).
path
;
});
testWithoutContext
(
'IOSDevice.installApp calls ios-deploy correctly with USB'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
,
bundleDir:
fileSystem
.
currentDirectory
,
...
...
@@ -68,7 +71,6 @@ void main() {
});
testWithoutContext
(
'IOSDevice.installApp calls ios-deploy correctly with network'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
,
bundleDir:
fileSystem
.
currentDirectory
,
...
...
@@ -98,7 +100,7 @@ void main() {
});
testWithoutContext
(
'IOSDevice.uninstallApp calls ios-deploy correctly'
,
()
async
{
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
,
bundleDir:
bundleDirectory
);
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
<
String
>[
iosDeployPath
,
...
...
@@ -121,7 +123,7 @@ void main() {
group
(
'isAppInstalled'
,
()
{
testWithoutContext
(
'catches ProcessException from ios-deploy'
,
()
async
{
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
,
bundleDir:
bundleDirectory
);
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
<
String
>[
iosDeployPath
,
...
...
@@ -145,7 +147,7 @@ void main() {
});
testWithoutContext
(
'returns true when app is installed'
,
()
async
{
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
,
bundleDir:
bundleDirectory
);
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
<
String
>[
iosDeployPath
,
...
...
@@ -169,7 +171,7 @@ void main() {
});
testWithoutContext
(
'returns false when app is not installed'
,
()
async
{
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
,
bundleDir:
bundleDirectory
);
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
<
String
>[
iosDeployPath
,
...
...
@@ -195,7 +197,7 @@ void main() {
});
testWithoutContext
(
'returns false on command timeout or other error'
,
()
async
{
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
,
bundleDir:
bundleDirectory
);
const
String
stderr
=
'2020-03-26 17:48:43.484 ios-deploy[21518:5501783] [ !! ] Timed out waiting for device'
;
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
<
String
>[
...
...
@@ -224,7 +226,6 @@ void main() {
});
testWithoutContext
(
'IOSDevice.installApp catches ProcessException from ios-deploy'
,
()
async
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
,
bundleDir:
fileSystem
.
currentDirectory
,
...
...
@@ -249,7 +250,7 @@ void main() {
});
testWithoutContext
(
'IOSDevice.uninstallApp catches ProcessException from ios-deploy'
,
()
async
{
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
);
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
,
bundleDir:
bundleDirectory
);
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
<
String
>[
iosDeployPath
,
...
...
packages/flutter_tools/test/general.shard/ios/ios_device_start_prebuilt_test.dart
View file @
483f71ae
...
...
@@ -93,6 +93,7 @@ void main() {
final
IOSApp
iosApp
=
PrebuiltIOSApp
(
projectBundleId:
'app'
,
bundleName:
'Runner'
,
bundleDir:
MemoryFileSystem
.
test
().
directory
(
'bundle'
),
);
device
.
portForwarder
=
devicePortForwarder
;
...
...
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