[camera_android] Downgrade to AGP 7.3.0 to fix build_alll_packages test failures (#4997)

Fixes the current failures of the build_all_packages tests that were caused in https://github.com/flutter/packages/pull/4951/files.
This commit is contained in:
Gray Mackall
2023-09-26 11:01:58 -04:00
committed by GitHub
parent 619af75f79
commit a9a8cc640c
6 changed files with 55 additions and 11 deletions

View File

@ -1,3 +1,7 @@
## 0.10.8+11
* Downgrades AGP version for compatibility with legacy projects.
## 0.10.8+10
* Sets android.defaults.buildfeatures.buildconfig to true for compatibility with AGP 8.0+.

View File

@ -9,7 +9,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.1'
classpath 'com.android.tools.build:gradle:7.3.0'
}
}

View File

@ -3,7 +3,7 @@ description: Android implementation of the camera plugin.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.10.8+10
version: 0.10.8+11
environment:
sdk: ">=2.19.0 <4.0.0"

View File

@ -6,15 +6,8 @@
# updating multiple packages for a breaking change in a common dependency in
# cases where using a relaxed version constraint isn't possible.
# An application cannot depend directly on multiple federated implementations
# of the same plugin for the same platform, which means the app cannot
# directly depend on both camera_android and camera_android_androidx.
# Since camera_android is endorsed, it will be included transitively
# already, so exclude it from the direct dependency list to allow including
# camera_android_androidx to ensure that they don't conflict at build time
# (if they did, it would be impossible to use camera_android_androidx while
# camera_android is endorsed).
- camera_android
# NOTE: camera_android is semi-excluded via special casing in the repo tools.
# See create_all_packages_app_command.dart.
# This is a permament entry, as it should never be a direct app dependency.
- plugin_platform_interface

View File

@ -293,6 +293,20 @@ dependencies {}
},
dependencyOverrides: pluginDeps,
);
// An application cannot depend directly on multiple federated
// implementations of the same plugin for the same platform, which means the
// app cannot directly depend on both camera_android and
// camera_android_androidx. Since camera_android is endorsed, it will be
// included transitively already, so exclude it from the direct dependency
// list to allow including camera_android_androidx to ensure that they don't
// conflict at build time (if they did, it would be impossible to use
// camera_android_androidx while camera_android is endorsed).
// This is special-cased here, rather than being done via the normal
// exclusion config file mechanism, because it still needs to be in the
// depenedency overrides list to ensure that the version from path is used.
pubspec.dependencies.remove('camera_android');
app.pubspecFile.writeAsStringSync(_pubspecToString(pubspec));
}

View File

@ -10,6 +10,7 @@ import 'package:file/memory.dart';
import 'package:flutter_plugin_tools/src/common/core.dart';
import 'package:flutter_plugin_tools/src/create_all_packages_app_command.dart';
import 'package:platform/platform.dart';
import 'package:pubspec_parse/pubspec_parse.dart';
import 'package:test/test.dart';
import 'mocks.dart';
@ -205,6 +206,38 @@ project 'Runner', {
]));
});
test(
'pubspec special-cases camera_android to remove it from deps but not overrides',
() async {
writeFakeFlutterCreateOutput(testRoot);
final Directory cameraDir = packagesDir.childDirectory('camera');
createFakePlugin('camera', cameraDir);
createFakePlugin('camera_android', cameraDir);
createFakePlugin('camera_android_camerax', cameraDir);
await runCapturingPrint(runner, <String>['create-all-packages-app']);
final Pubspec pubspec = command.app.parsePubspec();
final Dependency? cameraDependency = pubspec.dependencies['camera'];
final Dependency? cameraAndroidDependency =
pubspec.dependencies['camera_android'];
final Dependency? cameraCameraXDependency =
pubspec.dependencies['camera_android_camerax'];
expect(cameraDependency, isA<PathDependency>());
expect((cameraDependency! as PathDependency).path,
endsWith('/packages/camera/camera'));
expect(cameraCameraXDependency, isA<PathDependency>());
expect((cameraCameraXDependency! as PathDependency).path,
endsWith('/packages/camera/camera_android_camerax'));
expect(cameraAndroidDependency, null);
final Dependency? cameraAndroidOverride =
pubspec.dependencyOverrides['camera_android'];
expect(cameraAndroidOverride, isA<PathDependency>());
expect((cameraAndroidOverride! as PathDependency).path,
endsWith('/packages/camera/camera_android'));
});
test('legacy files are copied when requested', () async {
writeFakeFlutterCreateOutput(testRoot);
createFakePlugin('plugina', packagesDir);