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
639c9935
Unverified
Commit
639c9935
authored
Jun 03, 2019
by
Dan Field
Committed by
GitHub
Jun 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wire in fuchsiaApp (#33781)
parent
9474a9f3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
2 deletions
+63
-2
application_package.dart
packages/flutter_tools/lib/src/application_package.dart
+5
-2
application_package.dart
...es/flutter_tools/lib/src/fuchsia/application_package.dart
+11
-0
application_package_test.dart
packages/flutter_tools/test/application_package_test.dart
+47
-0
No files found.
packages/flutter_tools/lib/src/application_package.dart
View file @
639c9935
...
...
@@ -387,10 +387,11 @@ class PrebuiltIOSApp extends IOSApp {
}
class
ApplicationPackageStore
{
ApplicationPackageStore
({
this
.
android
,
this
.
iOS
});
ApplicationPackageStore
({
this
.
android
,
this
.
iOS
,
this
.
fuchsia
});
AndroidApk
android
;
IOSApp
iOS
;
FuchsiaApp
fuchsia
;
Future
<
ApplicationPackage
>
getPackageForPlatform
(
TargetPlatform
platform
)
async
{
switch
(
platform
)
{
...
...
@@ -403,10 +404,12 @@ class ApplicationPackageStore {
case
TargetPlatform
.
ios
:
iOS
??=
IOSApp
.
fromIosProject
(
FlutterProject
.
current
().
ios
);
return
iOS
;
case
TargetPlatform
.
fuchsia
:
fuchsia
??=
FuchsiaApp
.
fromFuchsiaProject
(
FlutterProject
.
current
().
fuchsia
);
return
fuchsia
;
case
TargetPlatform
.
darwin_x64
:
case
TargetPlatform
.
linux_x64
:
case
TargetPlatform
.
windows_x64
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
tester
:
case
TargetPlatform
.
web
:
return
null
;
...
...
packages/flutter_tools/lib/src/fuchsia/application_package.dart
View file @
639c9935
...
...
@@ -7,6 +7,7 @@ import 'package:meta/meta.dart';
import
'../application_package.dart'
;
import
'../base/file_system.dart'
;
import
'../build_info.dart'
;
import
'../globals.dart'
;
import
'../project.dart'
;
abstract
class
FuchsiaApp
extends
ApplicationPackage
{
...
...
@@ -14,6 +15,11 @@ abstract class FuchsiaApp extends ApplicationPackage {
/// Creates a new [FuchsiaApp] from a fuchsia sub project.
factory
FuchsiaApp
.
fromFuchsiaProject
(
FuchsiaProject
project
)
{
if
(!
project
.
existsSync
())
{
// If the project doesn't exist at all the current hint to run flutter
// create is accurate.
return
null
;
}
return
BuildableFuchsiaApp
(
project:
project
,
);
...
...
@@ -23,6 +29,11 @@ abstract class FuchsiaApp extends ApplicationPackage {
///
/// [applicationBinary] is the path to the .far archive.
factory
FuchsiaApp
.
fromPrebuiltApp
(
FileSystemEntity
applicationBinary
)
{
final
FileSystemEntityType
entityType
=
fs
.
typeSync
(
applicationBinary
.
path
);
if
(
entityType
!=
FileSystemEntityType
.
file
)
{
printError
(
'File "
${applicationBinary.path}
" does not exist or is not a .far file. Use far archive.'
);
return
null
;
}
return
PrebuiltFuchsiaApp
(
farArchive:
applicationBinary
.
path
,
);
...
...
packages/flutter_tools/test/application_package_test.dart
View file @
639c9935
...
...
@@ -10,6 +10,7 @@ import 'package:file/memory.dart';
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/fuchsia/application_package.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:mockito/mockito.dart'
;
...
...
@@ -305,6 +306,52 @@ void main() {
expect
(
iosApp
,
null
);
},
overrides:
overrides
);
});
group
(
'FuchsiaApp'
,
()
{
final
Map
<
Type
,
Generator
>
overrides
=
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
Platform:
_kNoColorTerminalPlatform
,
OperatingSystemUtils:
()
=>
MockOperatingSystemUtils
(),
};
testUsingContext
(
'Error on non-existing file'
,
()
{
final
PrebuiltFuchsiaApp
fuchsiaApp
=
FuchsiaApp
.
fromPrebuiltApp
(
fs
.
file
(
'not_existing.far'
));
expect
(
fuchsiaApp
,
isNull
);
final
BufferLogger
logger
=
context
.
get
<
Logger
>();
expect
(
logger
.
errorText
,
'File "not_existing.far" does not exist or is not a .far file. Use far archive.
\n
'
,
);
},
overrides:
overrides
);
testUsingContext
(
'Error on non-far file'
,
()
{
fs
.
directory
(
'regular_folder'
).
createSync
();
final
PrebuiltFuchsiaApp
fuchsiaApp
=
FuchsiaApp
.
fromPrebuiltApp
(
fs
.
file
(
'regular_folder'
));
expect
(
fuchsiaApp
,
isNull
);
final
BufferLogger
logger
=
context
.
get
<
Logger
>();
expect
(
logger
.
errorText
,
'File "regular_folder" does not exist or is not a .far file. Use far archive.
\n
'
,
);
},
overrides:
overrides
);
testUsingContext
(
'Success with far file'
,
()
{
fs
.
file
(
'bundle.far'
).
createSync
();
final
PrebuiltFuchsiaApp
fuchsiaApp
=
FuchsiaApp
.
fromPrebuiltApp
(
fs
.
file
(
'bundle.far'
));
final
BufferLogger
logger
=
context
.
get
<
Logger
>();
expect
(
logger
.
errorText
,
isEmpty
);
expect
(
fuchsiaApp
.
id
,
'bundle.far'
);
},
overrides:
overrides
);
testUsingContext
(
'returns null when there is no fuchsia'
,
()
async
{
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
final
BuildableFuchsiaApp
fuchsiaApp
=
FuchsiaApp
.
fromFuchsiaProject
(
FlutterProject
.
fromDirectory
(
fs
.
currentDirectory
).
fuchsia
);
expect
(
fuchsiaApp
,
null
);
},
overrides:
overrides
);
});
}
const
String
_aaptDataWithExplicitEnabledAndMainLauncherActivity
=
...
...
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