Materialize Flutter module, Android (#20520)

This commit is contained in:
Mikkel Nygaard Ravn
2018-08-16 13:21:55 +02:00
committed by GitHub
parent f17bb519b3
commit d4e5e1e11e
30 changed files with 398 additions and 86 deletions

View File

@@ -40,7 +40,12 @@ Future<Null> main() async {
'\ndependencies:\n battery:\n package_info:\n',
);
await pubspec.writeAsString(content, flush: true);
await inDirectory(new Directory(path.join(directory.path, 'hello')), () async {
await flutter(
'packages',
options: <String>['get'],
);
});
section('Build Flutter module library archive');
@@ -76,7 +81,7 @@ Future<Null> main() async {
);
});
final bool apkBuilt = exists(new File(path.join(
final bool ephemeralHostApkBuilt = exists(new File(path.join(
directory.path,
'hello',
'build',
@@ -87,10 +92,49 @@ Future<Null> main() async {
'app-release.apk',
)));
if (!apkBuilt) {
if (!ephemeralHostApkBuilt) {
return new TaskResult.failure('Failed to build ephemeral host .apk');
}
section('Clean build');
await inDirectory(new Directory(path.join(directory.path, 'hello')), () async {
await flutter('clean');
});
section('Materialize host app');
await inDirectory(new Directory(path.join(directory.path, 'hello')), () async {
await flutter(
'materialize',
options: <String>['android'],
);
});
section('Build materialized host app');
await inDirectory(new Directory(path.join(directory.path, 'hello')), () async {
await flutter(
'build',
options: <String>['apk'],
);
});
final bool materializedHostApkBuilt = exists(new File(path.join(
directory.path,
'hello',
'build',
'host',
'outputs',
'apk',
'release',
'app-release.apk',
)));
if (!materializedHostApkBuilt) {
return new TaskResult.failure('Failed to build materialized host .apk');
}
section('Add to Android app');
final Directory hostApp = new Directory(path.join(directory.path, 'hello_host_app'));