Unverified Commit da4e997e authored by Gary Qian's avatar Gary Qian Committed by GitHub

Short circuit v1 deprecation warning on plugin projects (#94769)

parent 47a8f440
...@@ -417,6 +417,9 @@ class AndroidProject extends FlutterProjectPlatform { ...@@ -417,6 +417,9 @@ class AndroidProject extends FlutterProjectPlatform {
/// True if the parent Flutter project is a module. /// True if the parent Flutter project is a module.
bool get isModule => parent.isModule; bool get isModule => parent.isModule;
/// True if the parent Flutter project is a plugin.
bool get isPlugin => parent.isPlugin;
/// True if the Flutter project is using the AndroidX support library. /// True if the Flutter project is using the AndroidX support library.
bool get usesAndroidX => parent.usesAndroidX; bool get usesAndroidX => parent.usesAndroidX;
...@@ -595,6 +598,13 @@ The detected reason was: ...@@ -595,6 +598,13 @@ The detected reason was:
// only supports the V2 embedding. // only supports the V2 embedding.
return AndroidEmbeddingVersionResult(AndroidEmbeddingVersion.v2, 'Is add-to-app module'); return AndroidEmbeddingVersionResult(AndroidEmbeddingVersion.v2, 'Is add-to-app module');
} }
if (isPlugin) {
// Plugins do not use an appManifest, so we stop here.
//
// TODO(garyq): This method does not currently check for code references to
// the v1 embedding, we should check for this once removal is further along.
return AndroidEmbeddingVersionResult(AndroidEmbeddingVersion.v2, 'Is plugin');
}
if (appManifestFile == null || !appManifestFile.existsSync()) { if (appManifestFile == null || !appManifestFile.existsSync()) {
return AndroidEmbeddingVersionResult(AndroidEmbeddingVersion.v1, 'No `${appManifestFile.absolute.path}` file'); return AndroidEmbeddingVersionResult(AndroidEmbeddingVersion.v1, 'No `${appManifestFile.absolute.path}` file');
} }
......
...@@ -207,6 +207,13 @@ void main() { ...@@ -207,6 +207,13 @@ void main() {
project.checkForDeprecation(deprecationBehavior: DeprecationBehavior.ignore); project.checkForDeprecation(deprecationBehavior: DeprecationBehavior.ignore);
expect(testLogger.statusText, contains('https://flutter.dev/go/android-project-migration')); expect(testLogger.statusText, contains('https://flutter.dev/go/android-project-migration'));
}); });
_testInMemory('Android plugin project does not throw v1 embedding deprecation warning', () async {
final FlutterProject project = await aPluginProject();
project.checkForDeprecation(deprecationBehavior: DeprecationBehavior.exit);
expect(testLogger.statusText, isNot(contains('https://flutter.dev/go/android-project-migration')));
expect(testLogger.statusText, isNot(contains('No `<meta-data android:name="flutterEmbedding" android:value="2"/>` in ')));
});
_testInMemory('Android plugin without example app does not show a warning', () async { _testInMemory('Android plugin without example app does not show a warning', () async {
final FlutterProject project = await aPluginProject(); final FlutterProject project = await aPluginProject();
project.example.directory.deleteSync(); project.example.directory.deleteSync();
......
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