Skip to content
Permalink
Browse files

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: #31028

This fixes an issue mentioned [here](#28805) where the androidX flag for a module is not set when creating a new project:

`flutter create --androidx -t module my_flutter`
  • Loading branch information...
athornz authored and mklim committed Jun 7, 2019
1 parent 10d8758 commit 9223a44b8a9e88f3207e023b4ad68d12b1f63f74
@@ -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);

0 comments on commit 9223a44

Please sign in to comment.
You can’t perform that action at this time.