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
651c5ab3
Unverified
Commit
651c5ab3
authored
Aug 02, 2018
by
Mikkel Nygaard Ravn
Committed by
GitHub
Aug 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix latent type error in Flutter manifest (#20143)
parent
8380e20f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
12 deletions
+60
-12
flutter_manifest.dart
packages/flutter_tools/lib/src/flutter_manifest.dart
+32
-11
project.dart
packages/flutter_tools/lib/src/project.dart
+1
-1
flutter_manifest_test.dart
packages/flutter_tools/test/flutter_manifest_test.dart
+27
-0
No files found.
packages/flutter_tools/lib/src/flutter_manifest.dart
View file @
651c5ab3
...
...
@@ -23,8 +23,16 @@ class FlutterManifest {
/// Returns an empty manifest.
static
FlutterManifest
empty
()
{
final
FlutterManifest
manifest
=
new
FlutterManifest
.
_
();
manifest
.
_descriptor
=
<
String
,
dynamic
>{};
manifest
.
_flutterDescriptor
=
<
String
,
dynamic
>{};
manifest
.
_descriptor
=
const
<
String
,
dynamic
>{};
manifest
.
_flutterDescriptor
=
const
<
String
,
dynamic
>{};
return
manifest
;
}
/// Returns a mock manifest with the given contents.
static
FlutterManifest
mock
(
Map
<
String
,
dynamic
>
contents
)
{
final
FlutterManifest
manifest
=
new
FlutterManifest
.
_
();
manifest
.
_descriptor
=
contents
??
const
<
String
,
dynamic
>{};
manifest
.
_flutterDescriptor
=
manifest
.
_descriptor
[
'flutter'
]
??
const
<
String
,
dynamic
>{};
return
manifest
;
}
...
...
@@ -108,14 +116,6 @@ class FlutterManifest {
return
_flutterDescriptor
[
'uses-material-design'
]
??
false
;
}
/// Properties defining how to expose this Flutter project as a module
/// for integration into an unspecified host app.
YamlMap
get
moduleDescriptor
{
return
_flutterDescriptor
.
containsKey
(
'module'
)
?
_flutterDescriptor
[
'module'
]
??
const
<
String
,
dynamic
>{}
:
null
;
}
/// True if this manifest declares a Flutter module project.
///
/// A Flutter project is considered a module when it has a `module:`
...
...
@@ -123,7 +123,28 @@ class FlutterManifest {
/// existing host app.
///
/// Such a project can be created using `flutter create -t module`.
bool
get
isModule
=>
moduleDescriptor
!=
null
;
bool
get
isModule
=>
_flutterDescriptor
.
containsKey
(
'module'
);
/// True if this manifest declares a Flutter plugin project.
///
/// A Flutter project is considered a plugin when it has a `plugin:`
/// descriptor. A Flutter plugin project wraps custom Android and/or
/// iOS code in a Dart interface for consumption by other Flutter app
/// projects.
///
/// Such a project can be created using `flutter create -t plugin`.
bool
get
isPlugin
=>
_flutterDescriptor
.
containsKey
(
'plugin'
);
/// Returns the Android package declared by this manifest in its
/// module or plugin descriptor. Returns null, if there is no
/// such declaration.
String
get
androidPackage
{
if
(
isModule
)
return
_flutterDescriptor
[
'module'
][
'androidPackage'
];
if
(
isPlugin
)
return
_flutterDescriptor
[
'plugin'
][
'androidPackage'
];
return
null
;
}
List
<
Map
<
String
,
dynamic
>>
get
fontsDescriptor
{
final
List
<
dynamic
>
fontList
=
_flutterDescriptor
[
'fonts'
];
...
...
packages/flutter_tools/lib/src/project.dart
View file @
651c5ab3
...
...
@@ -231,7 +231,7 @@ class AndroidModuleProject {
template
.
render
(
directory
,
<
String
,
dynamic
>{
'androidIdentifier'
:
project
.
manifest
.
moduleDescriptor
[
'androidPackage'
]
,
'androidIdentifier'
:
project
.
manifest
.
androidPackage
,
},
printStatusWhenWriting:
false
,
);
...
...
packages/flutter_tools/test/flutter_manifest_test.dart
View file @
651c5ab3
...
...
@@ -360,6 +360,33 @@ flutter:
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
expect
(
flutterManifest
.
isEmpty
,
false
);
expect
(
flutterManifest
.
isModule
,
false
);
expect
(
flutterManifest
.
isPlugin
,
false
);
expect
(
flutterManifest
.
androidPackage
,
null
);
});
test
(
'allows a module declaration'
,
()
async
{
const
String
manifest
=
'''
name: test
flutter:
module:
androidPackage: com.example
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
expect
(
flutterManifest
.
isModule
,
true
);
expect
(
flutterManifest
.
androidPackage
,
'com.example'
);
});
test
(
'allows a plugin declaration'
,
()
async
{
const
String
manifest
=
'''
name: test
flutter:
plugin:
androidPackage: com.example
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
expect
(
flutterManifest
.
isPlugin
,
true
);
expect
(
flutterManifest
.
androidPackage
,
'com.example'
);
});
Future
<
void
>
checkManifestVersion
({
...
...
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