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
4ef8088c
Unverified
Commit
4ef8088c
authored
Aug 11, 2021
by
嘟囔
Committed by
GitHub
Aug 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: migrate macos/application_package.dart to null-safety (#87976)
parent
4ad8c15f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
20 deletions
+16
-20
application_package.dart
...ages/flutter_tools/lib/src/macos/application_package.dart
+16
-20
No files found.
packages/flutter_tools/lib/src/macos/application_package.dart
View file @
4ef8088c
...
...
@@ -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
'../base/io.dart'
;
...
...
@@ -20,7 +16,7 @@ bool _isBundleDirectory(FileSystemEntity entity) =>
entity
is
Directory
&&
entity
.
path
.
endsWith
(
'.app'
);
abstract
class
MacOSApp
extends
ApplicationPackage
{
MacOSApp
({
@
required
String
projectBundleId
})
:
super
(
id:
projectBundleId
);
MacOSApp
({
required
String
projectBundleId
})
:
super
(
id:
projectBundleId
);
/// Creates a new [MacOSApp] from a macOS project directory.
factory
MacOSApp
.
fromMacOSProject
(
MacOSProject
project
)
{
...
...
@@ -35,8 +31,8 @@ abstract class MacOSApp extends ApplicationPackage {
/// "~/Library/Developer/Xcode/DerivedData/" and contains an executable
/// which is expected to start the application and send the observatory
/// port over stdout.
factory
MacOSApp
.
fromPrebuiltApp
(
FileSystemEntity
applicationBinary
)
{
final
_BundleInfo
bundleInfo
=
_executableFromBundle
(
applicationBinary
);
static
MacOSApp
?
fromPrebuiltApp
(
FileSystemEntity
applicationBinary
)
{
final
_BundleInfo
?
bundleInfo
=
_executableFromBundle
(
applicationBinary
);
if
(
bundleInfo
==
null
)
{
return
null
;
}
...
...
@@ -50,7 +46,7 @@ abstract class MacOSApp extends ApplicationPackage {
}
/// Look up the executable name for a macOS application bundle.
static
_BundleInfo
_executableFromBundle
(
FileSystemEntity
applicationBundle
)
{
static
_BundleInfo
?
_executableFromBundle
(
FileSystemEntity
applicationBundle
)
{
final
FileSystemEntityType
entityType
=
globals
.
fs
.
typeSync
(
applicationBundle
.
path
);
if
(
entityType
==
FileSystemEntityType
.
notFound
)
{
globals
.
printError
(
'File "
${applicationBundle.path}
" does not exist.'
);
...
...
@@ -109,17 +105,17 @@ abstract class MacOSApp extends ApplicationPackage {
@override
String
get
displayName
=>
id
;
String
applicationBundle
(
BuildMode
buildMode
);
String
?
applicationBundle
(
BuildMode
buildMode
);
String
executable
(
BuildMode
buildMode
);
String
?
executable
(
BuildMode
buildMode
);
}
class
PrebuiltMacOSApp
extends
MacOSApp
{
PrebuiltMacOSApp
({
@
required
this
.
bundleDir
,
@
required
this
.
bundleName
,
@
required
this
.
projectBundleId
,
@
required
String
executable
,
required
this
.
bundleDir
,
required
this
.
bundleName
,
required
this
.
projectBundleId
,
required
String
executable
,
})
:
_executable
=
executable
,
super
(
projectBundleId:
projectBundleId
);
...
...
@@ -133,10 +129,10 @@ class PrebuiltMacOSApp extends MacOSApp {
String
get
name
=>
bundleName
;
@override
String
applicationBundle
(
BuildMode
buildMode
)
=>
bundleDir
.
path
;
String
?
applicationBundle
(
BuildMode
buildMode
)
=>
bundleDir
.
path
;
@override
String
executable
(
BuildMode
buildMode
)
=>
_executable
;
String
?
executable
(
BuildMode
buildMode
)
=>
_executable
;
}
class
BuildableMacOSApp
extends
MacOSApp
{
...
...
@@ -148,7 +144,7 @@ class BuildableMacOSApp extends MacOSApp {
String
get
name
=>
'macOS'
;
@override
String
applicationBundle
(
BuildMode
buildMode
)
{
String
?
applicationBundle
(
BuildMode
buildMode
)
{
final
File
appBundleNameFile
=
project
.
nameFile
;
if
(!
appBundleNameFile
.
existsSync
())
{
globals
.
printError
(
'Unable to find app name.
${appBundleNameFile.path}
does not exist'
);
...
...
@@ -163,12 +159,12 @@ class BuildableMacOSApp extends MacOSApp {
}
@override
String
executable
(
BuildMode
buildMode
)
{
final
String
directory
=
applicationBundle
(
buildMode
);
String
?
executable
(
BuildMode
buildMode
)
{
final
String
?
directory
=
applicationBundle
(
buildMode
);
if
(
directory
==
null
)
{
return
null
;
}
final
_BundleInfo
bundleInfo
=
MacOSApp
.
_executableFromBundle
(
globals
.
fs
.
directory
(
directory
));
final
_BundleInfo
?
bundleInfo
=
MacOSApp
.
_executableFromBundle
(
globals
.
fs
.
directory
(
directory
));
return
bundleInfo
?.
executable
;
}
}
...
...
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