Re-land config lib dependencies for flavors (#34668)

This commit is contained in:
Emmanuel Garcia
2019-06-18 22:37:42 -07:00
committed by Todd Volkert
parent 4f5d901395
commit c50fa3d2bd
6 changed files with 170 additions and 106 deletions

View File

@@ -7,19 +7,26 @@ import 'dart:async';
import 'package:flutter_devicelab/framework/apk_utils.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
Future<void> main() async {
await task(() async {
try {
await runPluginProjectTest((FlutterPluginProject pluginProject) async {
await runProjectTest((FlutterProject project) async {
section('App bundle content for task bundleRelease without explicit target platform');
await pluginProject.runGradleTask('bundleRelease');
await project.runGradleTask('bundleRelease');
if (!pluginProject.hasReleaseBundle)
throw TaskResult.failure(
'Gradle did not produce a release aab file at: ${pluginProject.releaseBundlePath}');
final String releaseBundle = path.join(
project.rootPath,
'build',
'app',
'outputs',
'bundle',
'release',
'app.aab',
);
final Iterable<String> bundleFiles = await pluginProject.getFilesInAppBundle(pluginProject.releaseBundlePath);
final Iterable<String> bundleFiles = await getFilesInAppBundle(releaseBundle);
checkItContains<String>(<String>[
'base/manifest/AndroidManifest.xml',
@@ -31,16 +38,51 @@ Future<void> main() async {
], bundleFiles);
});
await runPluginProjectTest((FlutterPluginProject pluginProject) async {
await runProjectTest((FlutterProject project) async {
section('App bundle content using flavors without explicit target platform');
// Add a few flavors.
await project.addProductFlavors(<String> ['production', 'staging', 'development']);
// Build the production flavor in release mode.
await project.runGradleTask('bundleProductionRelease');
final String bundlePath = path.join(
project.rootPath,
'build',
'app',
'outputs',
'bundle',
'productionRelease',
'app.aab',
);
final Iterable<String> bundleFiles = await getFilesInAppBundle(bundlePath);
checkItContains<String>(<String>[
'base/manifest/AndroidManifest.xml',
'base/dex/classes.dex',
'base/lib/arm64-v8a/libapp.so',
'base/lib/arm64-v8a/libflutter.so',
'base/lib/armeabi-v7a/libapp.so',
'base/lib/armeabi-v7a/libflutter.so',
], bundleFiles);
});
await runProjectTest((FlutterProject project) async {
section('App bundle content for task bundleRelease with target platform = android-arm');
await pluginProject.runGradleTask('bundleRelease',
await project.runGradleTask('bundleRelease',
options: <String>['-Ptarget-platform=android-arm']);
if (!pluginProject.hasReleaseBundle)
throw TaskResult.failure(
'Gradle did not produce a release aab file at: ${pluginProject.releaseBundlePath}');
final String releaseBundle = path.join(
project.rootPath,
'build',
'app',
'outputs',
'bundle',
'release',
'app.aab',
);
final Iterable<String> bundleFiles = await pluginProject.getFilesInAppBundle(pluginProject.releaseBundlePath);
final Iterable<String> bundleFiles = await getFilesInAppBundle(releaseBundle);
checkItContains<String>(<String>[
'base/manifest/AndroidManifest.xml',