From e3792a8df4a303a5790ad232569ae6f7c1b1b740 Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Mon, 23 Dec 2024 11:13:36 -0800 Subject: [PATCH 1/3] [tool] Remove null-awareness from newly non-null field. --- .../lib/src/common/package_looping_command.dart | 4 ++-- .../lib/src/create_all_packages_app_command.dart | 4 ++-- script/tool/lib/src/pubspec_check_command.dart | 4 ++-- script/tool/lib/src/update_min_sdk_command.dart | 2 +- .../test/create_all_packages_app_command_test.dart | 2 +- script/tool/test/update_min_sdk_command_test.dart | 14 +++++++------- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/script/tool/lib/src/common/package_looping_command.dart b/script/tool/lib/src/common/package_looping_command.dart index 9dc32279e92..b9c7a87c067 100644 --- a/script/tool/lib/src/common/package_looping_command.dart +++ b/script/tool/lib/src/common/package_looping_command.dart @@ -340,7 +340,7 @@ abstract class PackageLoopingCommand extends PackageCommand { if (minFlutterVersion != null) { final Pubspec pubspec = package.parsePubspec(); final VersionConstraint? flutterConstraint = - pubspec.environment?['flutter']; + pubspec.environment['flutter']; if (flutterConstraint != null && !flutterConstraint.allows(minFlutterVersion)) { return PackageResult.skip( @@ -350,7 +350,7 @@ abstract class PackageLoopingCommand extends PackageCommand { if (minDartVersion != null) { final Pubspec pubspec = package.parsePubspec(); - final VersionConstraint? dartConstraint = pubspec.environment?['sdk']; + final VersionConstraint? dartConstraint = pubspec.environment['sdk']; if (dartConstraint != null && !dartConstraint.allows(minDartVersion)) { return PackageResult.skip('Does not support Dart $minDartVersion'); } diff --git a/script/tool/lib/src/create_all_packages_app_command.dart b/script/tool/lib/src/create_all_packages_app_command.dart index ab6b5637dd7..812c32133b2 100644 --- a/script/tool/lib/src/create_all_packages_app_command.dart +++ b/script/tool/lib/src/create_all_packages_app_command.dart @@ -277,7 +277,7 @@ dependencies {} final Pubspec originalPubspec = app.parsePubspec(); const String dartSdkKey = 'sdk'; final VersionConstraint dartSdkConstraint = - originalPubspec.environment?[dartSdkKey] ?? + originalPubspec.environment[dartSdkKey] ?? VersionConstraint.compatibleWith( Version.parse('3.0.0'), ); @@ -342,7 +342,7 @@ publish_to: none version: ${pubspec.version} -environment:${_pubspecMapString(pubspec.environment!)} +environment:${_pubspecMapString(pubspec.environment)} dependencies:${_pubspecMapString(pubspec.dependencies)} diff --git a/script/tool/lib/src/pubspec_check_command.dart b/script/tool/lib/src/pubspec_check_command.dart index 66ac470d823..d8fafb1b2b6 100644 --- a/script/tool/lib/src/pubspec_check_command.dart +++ b/script/tool/lib/src/pubspec_check_command.dart @@ -488,9 +488,9 @@ class PubspecCheckCommand extends PackageLoopingCommand { } final Version? dartConstraintMin = - _minimumForConstraint(pubspec.environment?['sdk']); + _minimumForConstraint(pubspec.environment['sdk']); final Version? flutterConstraintMin = - _minimumForConstraint(pubspec.environment?['flutter']); + _minimumForConstraint(pubspec.environment['flutter']); // Validate the Flutter constraint, if any. if (flutterConstraintMin != null && minMinFlutterVersion != null) { diff --git a/script/tool/lib/src/update_min_sdk_command.dart b/script/tool/lib/src/update_min_sdk_command.dart index 429036a47ef..603886ce94a 100644 --- a/script/tool/lib/src/update_min_sdk_command.dart +++ b/script/tool/lib/src/update_min_sdk_command.dart @@ -87,7 +87,7 @@ class UpdateMinSdkCommand extends PackageLoopingCommand { /// Returns the given "environment" section's [key] constraint as a range, /// if the key is present and has a range. VersionRange? _sdkRange(Pubspec pubspec, String key) { - final VersionConstraint? constraint = pubspec.environment?[key]; + final VersionConstraint? constraint = pubspec.environment[key]; if (constraint is VersionRange) { return constraint; } diff --git a/script/tool/test/create_all_packages_app_command_test.dart b/script/tool/test/create_all_packages_app_command_test.dart index bed615f12b6..b65371a1971 100644 --- a/script/tool/test/create_all_packages_app_command_test.dart +++ b/script/tool/test/create_all_packages_app_command_test.dart @@ -356,7 +356,7 @@ android { final Pubspec generatedPubspec = command.app.parsePubspec(); const String dartSdkKey = 'sdk'; - expect(generatedPubspec.environment?[dartSdkKey].toString(), + expect(generatedPubspec.environment[dartSdkKey].toString(), existingSdkConstraint); }); diff --git a/script/tool/test/update_min_sdk_command_test.dart b/script/tool/test/update_min_sdk_command_test.dart index 52d69ccb7bd..d9bc93f2310 100644 --- a/script/tool/test/update_min_sdk_command_test.dart +++ b/script/tool/test/update_min_sdk_command_test.dart @@ -50,7 +50,7 @@ void main() { ]); final String dartVersion = - package.parsePubspec().environment?['sdk'].toString() ?? ''; + package.parsePubspec().environment['sdk'].toString(); expect(dartVersion, '^3.1.0'); }); @@ -65,7 +65,7 @@ void main() { ]); final String dartVersion = - package.parsePubspec().environment?['sdk'].toString() ?? ''; + package.parsePubspec().environment['sdk'].toString(); expect(dartVersion, '^3.1.0'); }); @@ -80,7 +80,7 @@ void main() { ]); final String dartVersion = - package.parsePubspec().environment?['sdk'].toString() ?? ''; + package.parsePubspec().environment['sdk'].toString(); expect(dartVersion, '^3.2.0'); }); @@ -98,9 +98,9 @@ void main() { ]); final String dartVersion = - package.parsePubspec().environment?['sdk'].toString() ?? ''; + package.parsePubspec().environment['sdk'].toString(); final String flutterVersion = - package.parsePubspec().environment?['flutter'].toString() ?? ''; + package.parsePubspec().environment['flutter'].toString(); expect(dartVersion, '^3.1.0'); expect(flutterVersion, '>=3.13.0'); }); @@ -119,9 +119,9 @@ void main() { ]); final String dartVersion = - package.parsePubspec().environment?['sdk'].toString() ?? ''; + package.parsePubspec().environment['sdk'].toString(); final String flutterVersion = - package.parsePubspec().environment?['flutter'].toString() ?? ''; + package.parsePubspec().environment['flutter'].toString(); expect(dartVersion, '^3.2.0'); expect(flutterVersion, '>=3.16.0'); }); From f535b9559e978040a68dc370c82354c8fd34089a Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Mon, 23 Dec 2024 11:21:21 -0800 Subject: [PATCH 2/3] Skip network-dependent tests in Android. --- .../integration_test/video_player_test.dart | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/video_player/video_player/example/integration_test/video_player_test.dart b/packages/video_player/video_player/example/integration_test/video_player_test.dart index 0acebb548c2..a431ece7bcf 100644 --- a/packages/video_player/video_player/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player/example/integration_test/video_player_test.dart @@ -56,6 +56,15 @@ void main() { testWidgets( 'live stream duration != 0', (WidgetTester tester) async { + // This test requires network access, and won't pass until a LUCI recipe + // change is made. + // TODO(camsim99): Remove once https://github.com/flutter/flutter/issues/160797 is fixed. + if (!kIsWeb && Platform.isAndroid) { + markTestSkipped( + 'Skipping due to https://github.com/flutter/flutter/issues/160797'); + return; + } + final VideoPlayerController networkController = VideoPlayerController.networkUrl( Uri.parse( @@ -266,6 +275,15 @@ void main() { testWidgets( 'reports buffering status', (WidgetTester tester) async { + // This test requires network access, and won't pass until a LUCI recipe + // change is made. + // TODO(camsim99): Remove once https://github.com/flutter/flutter/issues/160797 is fixed. + if (!kIsWeb && Platform.isAndroid) { + markTestSkipped( + 'Skipping due to https://github.com/flutter/flutter/issues/160797'); + return; + } + await controller.initialize(); // Mute to allow playing without DOM interaction on Web. // See https://developers.google.com/web/updates/2017/09/autoplay-policy-changes From 84fb55ba6913c6e5d4253a59322ca45e2b758f16 Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Mon, 23 Dec 2024 14:22:02 -0800 Subject: [PATCH 3/3] Bump version of pubspec_parse to ensure we always use the new API. --- script/tool/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/tool/pubspec.yaml b/script/tool/pubspec.yaml index d5ea5b93447..7bd5de4dde3 100644 --- a/script/tool/pubspec.yaml +++ b/script/tool/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: path: ^1.8.3 platform: ^3.0.2 pub_semver: ^2.0.0 - pubspec_parse: ^1.2.2 + pubspec_parse: ^1.4.0 quiver: ^3.0.1 test: ^1.24.0 uuid: ^4.5.1