Skip to content

Commit

Permalink
Remove isNewAndroidEmbeddingEnabled flag when reading an existing pro… (
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Garcia committed Oct 16, 2019
1 parent 1dc09e4 commit 0a93f4e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 20 deletions.
4 changes: 2 additions & 2 deletions dev/integration_tests/release_smoke_test/pubspec.yaml
Expand Up @@ -17,7 +17,7 @@ dev_dependencies:
flutter_test:
sdk: flutter

instrumentation_adapter: 0.1.3
e2e: 0.2.1

archive: 2.0.10 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
args: 1.5.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
Expand All @@ -40,4 +40,4 @@ dev_dependencies:
test_api: 0.2.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
xml: 3.5.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"

# PUBSPEC CHECKSUM: 8361
# PUBSPEC CHECKSUM: 669f
Expand Up @@ -4,10 +4,10 @@

import 'package:flutter_test/flutter_test.dart';
import 'package:release_smoke_test/main.dart' as smoke;
import 'package:instrumentation_adapter/instrumentation_adapter.dart';
import 'package:e2e/e2e.dart';

void main() {
InstrumentationAdapterFlutterBinding.ensureInitialized();
E2EWidgetsFlutterBinding.ensureInitialized();

testWidgets('Hello world smoke test', (WidgetTester tester) async {
smoke.main(); // builds the app and schedules a frame but doesn't trigger one
Expand Down
4 changes: 0 additions & 4 deletions packages/flutter_tools/lib/src/platform_plugins.dart
Expand Up @@ -7,7 +7,6 @@ import 'package:yaml/yaml.dart';

import 'base/common.dart';
import 'base/file_system.dart';
import 'features.dart';

/// Marker interface for all platform specific plugin config impls.
abstract class PluginPlatform {
Expand Down Expand Up @@ -75,9 +74,6 @@ class AndroidPlugin extends PluginPlatform {
String get _embeddingVersion => _cachedEmbeddingVersion ??= _getEmbeddingVersion();

String _getEmbeddingVersion() {
if (!featureFlags.isNewAndroidEmbeddingEnabled) {
return '1';
}
assert(pluginPath != null);
final String baseMainPath = fs.path.join(
pluginPath,
Expand Down
3 changes: 0 additions & 3 deletions packages/flutter_tools/lib/src/plugins.dart
Expand Up @@ -360,9 +360,6 @@ List<Map<String, dynamic>> _extractPlatformMaps(List<Plugin> plugins, String typ
/// Returns the version of the Android embedding that the current
/// [project] is using.
String _getAndroidEmbeddingVersion(FlutterProject project) {
if (!featureFlags.isNewAndroidEmbeddingEnabled) {
return '1';
}
assert(project.android != null);
final File androidManifest = project.android.appManifestFile;
assert(androidManifest.existsSync());
Expand Down
Expand Up @@ -273,7 +273,7 @@ void main() {
..writeAsStringSync('Existing release config');

final FlutterProject project = FlutterProject.fromPath('project');
await injectPlugins(project);
await injectPlugins(project, checkProjects: true);

final String debugContents = projectUnderTest.ios.xcodeConfigFor('Debug').readAsStringSync();
expect(debugContents, contains(
Expand Down
21 changes: 14 additions & 7 deletions packages/flutter_tools/test/general.shard/plugins_test.dart
Expand Up @@ -148,7 +148,13 @@ flutter:

testUsingContext('Registrant uses old embedding in app project', () async {
when(flutterProject.isModule).thenReturn(false);
when(featureFlags.isNewAndroidEmbeddingEnabled).thenReturn(false);

final File androidManifest = flutterProject.directory
.childDirectory('android')
.childFile('AndroidManifest.xml')
..createSync(recursive: true)
..writeAsStringSync(kAndroidManifestUsingOldEmbedding);
when(androidProject.appManifestFile).thenReturn(androidManifest);

await injectPlugins(flutterProject);

Expand All @@ -167,7 +173,6 @@ flutter:

testUsingContext('Registrant uses new embedding if app uses new embedding', () async {
when(flutterProject.isModule).thenReturn(false);
when(featureFlags.isNewAndroidEmbeddingEnabled).thenReturn(true);

final File androidManifest = flutterProject.directory
.childDirectory('android')
Expand All @@ -193,7 +198,6 @@ flutter:

testUsingContext('Registrant uses shim for plugins using old embedding if app uses new embedding', () async {
when(flutterProject.isModule).thenReturn(false);
when(featureFlags.isNewAndroidEmbeddingEnabled).thenReturn(true);

final File androidManifest = flutterProject.directory
.childDirectory('android')
Expand Down Expand Up @@ -291,7 +295,6 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()}

testUsingContext('Registrant doesn\'t use new embedding if app doesn\'t use new embedding', () async {
when(flutterProject.isModule).thenReturn(false);
when(featureFlags.isNewAndroidEmbeddingEnabled).thenReturn(true);

final File androidManifest = flutterProject.directory
.childDirectory('android')
Expand All @@ -317,7 +320,13 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()}

testUsingContext('Registrant uses old embedding in module project', () async {
when(flutterProject.isModule).thenReturn(true);
when(featureFlags.isNewAndroidEmbeddingEnabled).thenReturn(false);

final File androidManifest = flutterProject.directory
.childDirectory('android')
.childFile('AndroidManifest.xml')
..createSync(recursive: true)
..writeAsStringSync(kAndroidManifestUsingOldEmbedding);
when(androidProject.appManifestFile).thenReturn(androidManifest);

await injectPlugins(flutterProject);

Expand All @@ -336,7 +345,6 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()}

testUsingContext('Registrant uses new embedding if module uses new embedding', () async {
when(flutterProject.isModule).thenReturn(true);
when(featureFlags.isNewAndroidEmbeddingEnabled).thenReturn(true);

final File androidManifest = flutterProject.directory
.childDirectory('android')
Expand All @@ -362,7 +370,6 @@ plugin3:${pluginUsingOldEmbeddingDir.childDirectory('lib').uri.toString()}

testUsingContext('Registrant doesn\'t use new embedding if module doesn\'t use new embedding', () async {
when(flutterProject.isModule).thenReturn(true);
when(featureFlags.isNewAndroidEmbeddingEnabled).thenReturn(true);

final File androidManifest = flutterProject.directory
.childDirectory('android')
Expand Down
7 changes: 6 additions & 1 deletion packages/flutter_tools/test/general.shard/project_test.dart
Expand Up @@ -531,7 +531,12 @@ Future<FlutterProject> someProject() async {
final Directory directory = fs.directory('some_project');
directory.childFile('.packages').createSync(recursive: true);
directory.childDirectory('ios').createSync(recursive: true);
directory.childDirectory('android').createSync(recursive: true);
final Directory androidDirectory = directory
.childDirectory('android')
..createSync(recursive: true);
androidDirectory
.childFile('AndroidManifest.xml')
.writeAsStringSync('<manifest></manifest>');
return FlutterProject.fromDirectory(directory);
}

Expand Down

0 comments on commit 0a93f4e

Please sign in to comment.