Commit 9223a44b authored by Josh Burton's avatar Josh Burton Committed by Michael Klimushyn

Adds the androidX flag to a modules pubspec.yaml template so it is se… (#34066)

This is a small follow up to the previous AndroidX PR: https://github.com/flutter/flutter/pull/31028

This fixes an issue mentioned [here](https://github.com/flutter/flutter/issues/28805) where the androidX flag for a module is not set when creating a new project:

`flutter create --androidx -t module my_flutter`
parent 10d8758b
......@@ -85,5 +85,6 @@ flutter:
# They also do not have any bearing on your native host application's
# identifiers, which may be completely independent or the same as these.
module:
androidX: {{androidX}}
androidPackage: {{androidIdentifier}}
iosBundleIdentifier: {{iosIdentifier}}
......@@ -421,6 +421,40 @@ void main() {
expect(actualContents.contains('useAndroidX'), false);
}, timeout: allowForCreateFlutterProject);
testUsingContext('androidx app module', () async {
Cache.flutterRoot = '../..';
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--template=module', '--no-pub', '--androidx', projectDir.path]);
final FlutterProject project = FlutterProject.fromDirectory(projectDir);
expect(
project.usesAndroidX,
true,
);
}, timeout: allowForCreateFlutterProject);
testUsingContext('non androidx app module', () async {
Cache.flutterRoot = '../..';
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--template=module', '--no-pub', '--no-androidx', projectDir.path]);
final FlutterProject project = FlutterProject.fromDirectory(projectDir);
expect(
project.usesAndroidX,
false,
);
}, timeout: allowForCreateFlutterProject);
testUsingContext('androidx plugin project', () async {
Cache.flutterRoot = '../..';
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment