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`
This commit is contained in:
committed by
Michael Klimushyn
parent
10d8758b2f
commit
9223a44b8a
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user