diff --git a/.ci/flutter_master.version b/.ci/flutter_master.version index 1626830f0a7d..27ecd1c9b3a2 100644 --- a/.ci/flutter_master.version +++ b/.ci/flutter_master.version @@ -1 +1 @@ -8591d0c16a6c7edfbea3b5b1bf08ae09db117b71 +29d40f7f68266dcb79c8fda98ccdbe4dccb96281 diff --git a/.github/labeler.yml b/.github/labeler.yml index ec925d3343e0..c7d1a1d531e6 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -68,6 +68,12 @@ - any-glob-to-any-file: - packages/flutter_plugin_android_lifecycle/**/* +'p: flutter_svg': + - changed-files: + - any-glob-to-any-file: + - third_party/packages/flutter_svg/**/* + - third_party/packages/flutter_svg_test/**/* + 'p: flutter_template_images': - changed-files: - any-glob-to-any-file: @@ -188,6 +194,13 @@ - any-glob-to-any-file: - packages/url_launcher/**/* +'p: vector_graphics': + - changed-files: + - any-glob-to-any-file: + - packages/vector_graphics/**/* + - packages/vector_graphics_codec/**/* + - packages/vector_graphics_compiler/**/* + 'p: video_player': - changed-files: - any-glob-to-any-file: diff --git a/packages/camera/camera_avfoundation/CHANGELOG.md b/packages/camera/camera_avfoundation/CHANGELOG.md index 28882e058282..a1b18e61ed4c 100644 --- a/packages/camera/camera_avfoundation/CHANGELOG.md +++ b/packages/camera/camera_avfoundation/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.9.17+5 + +* Adds ability to use any supported FPS and fixes crash when using unsupported FPS. + ## 0.9.17+4 * Updates Pigeon for non-nullable collection type support. @@ -13,7 +17,7 @@ ## 0.9.17+1 -* Fixes a crash due to appending sample buffers when readyForMoreMediaData is NO +* Fixes a crash due to appending sample buffers when readyForMoreMediaData is NO. ## 0.9.17 diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSettingsTests.m b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSettingsTests.m index 039ce122174e..9bed6bea4883 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSettingsTests.m +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSettingsTests.m @@ -202,4 +202,20 @@ - (void)testSettings_ShouldBeSupportedByMethodCall { XCTAssertNotNil(resultValue); } +- (void)testSettings_ShouldSelectFormatWhichSupports60FPS { + FCPPlatformMediaSettings *settings = + [FCPPlatformMediaSettings makeWithResolutionPreset:gTestResolutionPreset + framesPerSecond:@(60) + videoBitrate:@(gTestVideoBitrate) + audioBitrate:@(gTestAudioBitrate) + enableAudio:gTestEnableAudio]; + + FLTCam *camera = FLTCreateCamWithCaptureSessionQueueAndMediaSettings( + dispatch_queue_create("test", NULL), settings, nil, nil); + + AVFrameRateRange *range = camera.captureDevice.activeFormat.videoSupportedFrameRateRanges[0]; + XCTAssertLessThanOrEqual(range.minFrameRate, 60); + XCTAssertGreaterThanOrEqual(range.maxFrameRate, 60); +} + @end diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraTestUtils.m b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraTestUtils.m index e1a3aaec702e..503a5c255c59 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraTestUtils.m +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraTestUtils.m @@ -52,6 +52,36 @@ OCMStub([audioSessionMock addInputWithNoConnections:[OCMArg any]]); OCMStub([audioSessionMock canSetSessionPreset:[OCMArg any]]).andReturn(YES); + id frameRateRangeMock1 = OCMClassMock([AVFrameRateRange class]); + OCMStub([frameRateRangeMock1 minFrameRate]).andReturn(3); + OCMStub([frameRateRangeMock1 maxFrameRate]).andReturn(30); + id captureDeviceFormatMock1 = OCMClassMock([AVCaptureDeviceFormat class]); + OCMStub([captureDeviceFormatMock1 videoSupportedFrameRateRanges]).andReturn(@[ + frameRateRangeMock1 + ]); + + id frameRateRangeMock2 = OCMClassMock([AVFrameRateRange class]); + OCMStub([frameRateRangeMock2 minFrameRate]).andReturn(3); + OCMStub([frameRateRangeMock2 maxFrameRate]).andReturn(60); + id captureDeviceFormatMock2 = OCMClassMock([AVCaptureDeviceFormat class]); + OCMStub([captureDeviceFormatMock2 videoSupportedFrameRateRanges]).andReturn(@[ + frameRateRangeMock2 + ]); + + id captureDeviceMock = OCMClassMock([AVCaptureDevice class]); + OCMStub([captureDeviceMock lockForConfiguration:[OCMArg setTo:nil]]).andReturn(YES); + OCMStub([captureDeviceMock formats]).andReturn((@[ + captureDeviceFormatMock1, captureDeviceFormatMock2 + ])); + __block AVCaptureDeviceFormat *format = captureDeviceFormatMock1; + OCMStub([captureDeviceMock setActiveFormat:[OCMArg any]]).andDo(^(NSInvocation *invocation) { + [invocation retainArguments]; + [invocation getArgument:&format atIndex:2]; + }); + OCMStub([captureDeviceMock activeFormat]).andDo(^(NSInvocation *invocation) { + [invocation setReturnValue:&format]; + }); + id fltCam = [[FLTCam alloc] initWithMediaSettings:mediaSettings mediaSettingsAVWrapper:mediaSettingsAVWrapper orientation:UIDeviceOrientationPortrait @@ -59,7 +89,7 @@ audioCaptureSession:audioSessionMock captureSessionQueue:captureSessionQueue captureDeviceFactory:captureDeviceFactory ?: ^AVCaptureDevice *(void) { - return [AVCaptureDevice deviceWithUniqueID:@"camera"]; + return captureDeviceMock; } videoDimensionsForFormat:^CMVideoDimensions(AVCaptureDeviceFormat *format) { return CMVideoFormatDescriptionGetDimensions(format.formatDescription); diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCam.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCam.m index 4c3a72c48c9c..0b065026f10e 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCam.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FLTCam.m @@ -153,6 +153,59 @@ - (instancetype)initWithCameraName:(NSString *)cameraName error:error]; } +// Returns frame rate supported by format closest to targetFrameRate. +static double bestFrameRateForFormat(AVCaptureDeviceFormat *format, double targetFrameRate) { + double bestFrameRate = 0; + double minDistance = DBL_MAX; + for (AVFrameRateRange *range in format.videoSupportedFrameRateRanges) { + double frameRate = MIN(MAX(targetFrameRate, range.minFrameRate), range.maxFrameRate); + double distance = fabs(frameRate - targetFrameRate); + if (distance < minDistance) { + bestFrameRate = frameRate; + minDistance = distance; + } + } + return bestFrameRate; +} + +// Finds format with same resolution as current activeFormat in captureDevice for which +// bestFrameRateForFormat returned frame rate closest to mediaSettings.framesPerSecond. +// Preferred are formats with the same subtype as current activeFormat. Sets this format +// as activeFormat and also updates mediaSettings.framesPerSecond to value which +// bestFrameRateForFormat returned for that format. +static void selectBestFormatForRequestedFrameRate( + AVCaptureDevice *captureDevice, FCPPlatformMediaSettings *mediaSettings, + VideoDimensionsForFormat videoDimensionsForFormat) { + CMVideoDimensions targetResolution = videoDimensionsForFormat(captureDevice.activeFormat); + double targetFrameRate = mediaSettings.framesPerSecond.doubleValue; + FourCharCode preferredSubType = + CMFormatDescriptionGetMediaSubType(captureDevice.activeFormat.formatDescription); + AVCaptureDeviceFormat *bestFormat = captureDevice.activeFormat; + double bestFrameRate = bestFrameRateForFormat(bestFormat, targetFrameRate); + double minDistance = fabs(bestFrameRate - targetFrameRate); + BOOL isBestSubTypePreferred = YES; + for (AVCaptureDeviceFormat *format in captureDevice.formats) { + CMVideoDimensions resolution = videoDimensionsForFormat(format); + if (resolution.width != targetResolution.width || + resolution.height != targetResolution.height) { + continue; + } + double frameRate = bestFrameRateForFormat(format, targetFrameRate); + double distance = fabs(frameRate - targetFrameRate); + FourCharCode subType = CMFormatDescriptionGetMediaSubType(format.formatDescription); + BOOL isSubTypePreferred = subType == preferredSubType; + if (distance < minDistance || + (distance == minDistance && isSubTypePreferred && !isBestSubTypePreferred)) { + bestFormat = format; + bestFrameRate = frameRate; + minDistance = distance; + isBestSubTypePreferred = isSubTypePreferred; + } + } + captureDevice.activeFormat = bestFormat; + mediaSettings.framesPerSecond = @(bestFrameRate); +} + - (instancetype)initWithMediaSettings:(FCPPlatformMediaSettings *)mediaSettings mediaSettingsAVWrapper:(FLTCamMediaSettingsAVWrapper *)mediaSettingsAVWrapper orientation:(UIDeviceOrientation)orientation @@ -226,6 +279,9 @@ - (instancetype)initWithMediaSettings:(FCPPlatformMediaSettings *)mediaSettings return nil; } + selectBestFormatForRequestedFrameRate(_captureDevice, _mediaSettings, + _videoDimensionsForFormat); + // Set frame rate with 1/10 precision allowing not integral values. int fpsNominator = floor([_mediaSettings.framesPerSecond doubleValue] * 10.0); CMTime duration = CMTimeMake(10, fpsNominator); @@ -474,11 +530,6 @@ - (BOOL)setCaptureSessionPreset:(FCPPlatformResolutionPreset)resolutionPreset // Set the best device format found and finish the device configuration. _captureDevice.activeFormat = bestFormat; [_captureDevice unlockForConfiguration]; - - // Set the preview size based on values from the current capture device. - _previewSize = - CGSizeMake(_captureDevice.activeFormat.highResolutionStillImageDimensions.width, - _captureDevice.activeFormat.highResolutionStillImageDimensions.height); break; } } @@ -486,44 +537,35 @@ - (BOOL)setCaptureSessionPreset:(FCPPlatformResolutionPreset)resolutionPreset case FCPPlatformResolutionPresetUltraHigh: if ([_videoCaptureSession canSetSessionPreset:AVCaptureSessionPreset3840x2160]) { _videoCaptureSession.sessionPreset = AVCaptureSessionPreset3840x2160; - _previewSize = CGSizeMake(3840, 2160); break; } if ([_videoCaptureSession canSetSessionPreset:AVCaptureSessionPresetHigh]) { _videoCaptureSession.sessionPreset = AVCaptureSessionPresetHigh; - _previewSize = - CGSizeMake(_captureDevice.activeFormat.highResolutionStillImageDimensions.width, - _captureDevice.activeFormat.highResolutionStillImageDimensions.height); break; } case FCPPlatformResolutionPresetVeryHigh: if ([_videoCaptureSession canSetSessionPreset:AVCaptureSessionPreset1920x1080]) { _videoCaptureSession.sessionPreset = AVCaptureSessionPreset1920x1080; - _previewSize = CGSizeMake(1920, 1080); break; } case FCPPlatformResolutionPresetHigh: if ([_videoCaptureSession canSetSessionPreset:AVCaptureSessionPreset1280x720]) { _videoCaptureSession.sessionPreset = AVCaptureSessionPreset1280x720; - _previewSize = CGSizeMake(1280, 720); break; } case FCPPlatformResolutionPresetMedium: if ([_videoCaptureSession canSetSessionPreset:AVCaptureSessionPreset640x480]) { _videoCaptureSession.sessionPreset = AVCaptureSessionPreset640x480; - _previewSize = CGSizeMake(640, 480); break; } case FCPPlatformResolutionPresetLow: if ([_videoCaptureSession canSetSessionPreset:AVCaptureSessionPreset352x288]) { _videoCaptureSession.sessionPreset = AVCaptureSessionPreset352x288; - _previewSize = CGSizeMake(352, 288); break; } default: if ([_videoCaptureSession canSetSessionPreset:AVCaptureSessionPresetLow]) { _videoCaptureSession.sessionPreset = AVCaptureSessionPresetLow; - _previewSize = CGSizeMake(352, 288); } else { if (error != nil) { *error = @@ -537,23 +579,33 @@ - (BOOL)setCaptureSessionPreset:(FCPPlatformResolutionPreset)resolutionPreset return NO; } } + CMVideoDimensions size = self.videoDimensionsForFormat(_captureDevice.activeFormat); + _previewSize = CGSizeMake(size.width, size.height); _audioCaptureSession.sessionPreset = _videoCaptureSession.sessionPreset; return YES; } /// Finds the highest available resolution in terms of pixel count for the given device. +/// Preferred are formats with the same subtype as current activeFormat. - (AVCaptureDeviceFormat *)highestResolutionFormatForCaptureDevice: (AVCaptureDevice *)captureDevice { + FourCharCode preferredSubType = + CMFormatDescriptionGetMediaSubType(_captureDevice.activeFormat.formatDescription); AVCaptureDeviceFormat *bestFormat = nil; NSUInteger maxPixelCount = 0; + BOOL isBestSubTypePreferred = NO; for (AVCaptureDeviceFormat *format in _captureDevice.formats) { CMVideoDimensions res = self.videoDimensionsForFormat(format); NSUInteger height = res.height; NSUInteger width = res.width; NSUInteger pixelCount = height * width; - if (pixelCount > maxPixelCount) { - maxPixelCount = pixelCount; + FourCharCode subType = CMFormatDescriptionGetMediaSubType(format.formatDescription); + BOOL isSubTypePreferred = subType == preferredSubType; + if (pixelCount > maxPixelCount || + (pixelCount == maxPixelCount && isSubTypePreferred && !isBestSubTypePreferred)) { bestFormat = format; + maxPixelCount = pixelCount; + isBestSubTypePreferred = isSubTypePreferred; } } return bestFormat; diff --git a/packages/camera/camera_avfoundation/pubspec.yaml b/packages/camera/camera_avfoundation/pubspec.yaml index 2fbbddb34c88..6ceb0b934f6e 100644 --- a/packages/camera/camera_avfoundation/pubspec.yaml +++ b/packages/camera/camera_avfoundation/pubspec.yaml @@ -2,7 +2,7 @@ name: camera_avfoundation description: iOS implementation of the camera plugin. repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_avfoundation issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.9.17+4 +version: 0.9.17+5 environment: sdk: ^3.3.0 diff --git a/packages/file_selector/file_selector/example/ios/Podfile b/packages/file_selector/file_selector/example/ios/Podfile index 279576f3884f..01d4aa611bb9 100644 --- a/packages/file_selector/file_selector/example/ios/Podfile +++ b/packages/file_selector/file_selector/example/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/file_selector/file_selector/example/macos/Podfile b/packages/file_selector/file_selector/example/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/file_selector/file_selector/example/macos/Podfile +++ b/packages/file_selector/file_selector/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/file_selector/file_selector_ios/example/ios/Podfile b/packages/file_selector/file_selector_ios/example/ios/Podfile index d97f17e223fb..e549ee22f3b0 100644 --- a/packages/file_selector/file_selector_ios/example/ios/Podfile +++ b/packages/file_selector/file_selector_ios/example/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/packages/file_selector/file_selector_macos/example/macos/Podfile b/packages/file_selector/file_selector_macos/example/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/file_selector/file_selector_macos/example/macos/Podfile +++ b/packages/file_selector/file_selector_macos/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/flutter_image/example/ios/Podfile b/packages/flutter_image/example/ios/Podfile index 279576f3884f..01d4aa611bb9 100644 --- a/packages/flutter_image/example/ios/Podfile +++ b/packages/flutter_image/example/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/flutter_image/example/macos/Podfile b/packages/flutter_image/example/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/flutter_image/example/macos/Podfile +++ b/packages/flutter_image/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/go_router/example/ios/Podfile b/packages/go_router/example/ios/Podfile index 279576f3884f..01d4aa611bb9 100644 --- a/packages/go_router/example/ios/Podfile +++ b/packages/go_router/example/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/go_router/example/macos/Podfile b/packages/go_router/example/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/go_router/example/macos/Podfile +++ b/packages/go_router/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Podfile b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Podfile index b1a5e23c9ff5..391330adc7d6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Podfile +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/ios/Podfile b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/ios/Podfile index a41a54965ba3..37d20e51d606 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/ios/Podfile +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/packages/google_sign_in/google_sign_in/example/macos/Podfile b/packages/google_sign_in/google_sign_in/example/macos/Podfile index 9ec46f8cd53c..66f6172bbb39 100644 --- a/packages/google_sign_in/google_sign_in/example/macos/Podfile +++ b/packages/google_sign_in/google_sign_in/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/google_sign_in/google_sign_in_ios/example/macos/Podfile b/packages/google_sign_in/google_sign_in_ios/example/macos/Podfile index 39a6656a7742..587228d11c23 100644 --- a/packages/google_sign_in/google_sign_in_ios/example/macos/Podfile +++ b/packages/google_sign_in/google_sign_in_ios/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/packages/image_picker/image_picker/example/macos/Podfile b/packages/image_picker/image_picker/example/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/image_picker/image_picker/example/macos/Podfile +++ b/packages/image_picker/image_picker/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/image_picker/image_picker_macos/example/macos/Podfile b/packages/image_picker/image_picker_macos/example/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/image_picker/image_picker_macos/example/macos/Podfile +++ b/packages/image_picker/image_picker_macos/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/in_app_purchase/in_app_purchase/example/macos/Podfile b/packages/in_app_purchase/in_app_purchase/example/macos/Podfile index 9ec46f8cd53c..66f6172bbb39 100644 --- a/packages/in_app_purchase/in_app_purchase/example/macos/Podfile +++ b/packages/in_app_purchase/in_app_purchase/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/in_app_purchase/in_app_purchase_storekit/example/macos/Podfile b/packages/in_app_purchase/in_app_purchase_storekit/example/macos/Podfile index 0fcebfff8580..b687011ee229 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/example/macos/Podfile +++ b/packages/in_app_purchase/in_app_purchase_storekit/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) diff --git a/packages/interactive_media_ads/example/ios/Podfile b/packages/interactive_media_ads/example/ios/Podfile index d97f17e223fb..e549ee22f3b0 100644 --- a/packages/interactive_media_ads/example/ios/Podfile +++ b/packages/interactive_media_ads/example/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/packages/ios_platform_images/example/ios/Podfile b/packages/ios_platform_images/example/ios/Podfile index d97f17e223fb..e549ee22f3b0 100644 --- a/packages/ios_platform_images/example/ios/Podfile +++ b/packages/ios_platform_images/example/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/packages/local_auth/local_auth/example/macos/Podfile b/packages/local_auth/local_auth/example/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/local_auth/local_auth/example/macos/Podfile +++ b/packages/local_auth/local_auth/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/local_auth/local_auth_darwin/example/macos/Podfile b/packages/local_auth/local_auth_darwin/example/macos/Podfile index c795730db8ed..29c8eb3294cb 100644 --- a/packages/local_auth/local_auth_darwin/example/macos/Podfile +++ b/packages/local_auth/local_auth_darwin/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/packages/path_provider/path_provider/example/macos/Podfile b/packages/path_provider/path_provider/example/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/path_provider/path_provider/example/macos/Podfile +++ b/packages/path_provider/path_provider/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/path_provider/path_provider_foundation/example/ios/Podfile b/packages/path_provider/path_provider_foundation/example/ios/Podfile index 4edba1e1fa01..61fe86ef4128 100644 --- a/packages/path_provider/path_provider_foundation/example/ios/Podfile +++ b/packages/path_provider/path_provider_foundation/example/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) diff --git a/packages/path_provider/path_provider_foundation/example/macos/Podfile b/packages/path_provider/path_provider_foundation/example/macos/Podfile index 47c1b18fedae..dd603efb9895 100644 --- a/packages/path_provider/path_provider_foundation/example/macos/Podfile +++ b/packages/path_provider/path_provider_foundation/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) diff --git a/packages/pigeon/example/app/ios/Podfile b/packages/pigeon/example/app/ios/Podfile index 88359b225fa1..5fbdfa333224 100644 --- a/packages/pigeon/example/app/ios/Podfile +++ b/packages/pigeon/example/app/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/pigeon/example/app/macos/Podfile b/packages/pigeon/example/app/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/pigeon/example/app/macos/Podfile +++ b/packages/pigeon/example/app/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Podfile b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Podfile index c795730db8ed..29c8eb3294cb 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Podfile +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/packages/pigeon/platform_tests/test_plugin/example/ios/Podfile b/packages/pigeon/platform_tests/test_plugin/example/ios/Podfile index b2f29723d1a8..6f5730c5fed8 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/ios/Podfile +++ b/packages/pigeon/platform_tests/test_plugin/example/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) diff --git a/packages/pigeon/platform_tests/test_plugin/example/macos/Podfile b/packages/pigeon/platform_tests/test_plugin/example/macos/Podfile index aca033923efb..71619503cdb0 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/macos/Podfile +++ b/packages/pigeon/platform_tests/test_plugin/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) diff --git a/packages/pointer_interceptor/pointer_interceptor/example/ios/Podfile b/packages/pointer_interceptor/pointer_interceptor/example/ios/Podfile index 279576f3884f..01d4aa611bb9 100644 --- a/packages/pointer_interceptor/pointer_interceptor/example/ios/Podfile +++ b/packages/pointer_interceptor/pointer_interceptor/example/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/pointer_interceptor/pointer_interceptor_ios/example/ios/Podfile b/packages/pointer_interceptor/pointer_interceptor_ios/example/ios/Podfile index d97f17e223fb..e549ee22f3b0 100644 --- a/packages/pointer_interceptor/pointer_interceptor_ios/example/ios/Podfile +++ b/packages/pointer_interceptor/pointer_interceptor_ios/example/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/packages/rfw/example/remote/ios/Podfile b/packages/rfw/example/remote/ios/Podfile index 279576f3884f..01d4aa611bb9 100644 --- a/packages/rfw/example/remote/ios/Podfile +++ b/packages/rfw/example/remote/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/rfw/example/remote/macos/Podfile b/packages/rfw/example/remote/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/rfw/example/remote/macos/Podfile +++ b/packages/rfw/example/remote/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/rfw/example/wasm/macos/Podfile b/packages/rfw/example/wasm/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/rfw/example/wasm/macos/Podfile +++ b/packages/rfw/example/wasm/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/shared_preferences/shared_preferences/example/macos/Podfile b/packages/shared_preferences/shared_preferences/example/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/shared_preferences/shared_preferences/example/macos/Podfile +++ b/packages/shared_preferences/shared_preferences/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/shared_preferences/shared_preferences_foundation/example/ios/Podfile b/packages/shared_preferences/shared_preferences_foundation/example/ios/Podfile index d97f17e223fb..e549ee22f3b0 100644 --- a/packages/shared_preferences/shared_preferences_foundation/example/ios/Podfile +++ b/packages/shared_preferences/shared_preferences_foundation/example/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/packages/shared_preferences/shared_preferences_foundation/example/macos/Podfile b/packages/shared_preferences/shared_preferences_foundation/example/macos/Podfile index 47c1b18fedae..dd603efb9895 100644 --- a/packages/shared_preferences/shared_preferences_foundation/example/macos/Podfile +++ b/packages/shared_preferences/shared_preferences_foundation/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) diff --git a/packages/url_launcher/url_launcher/example/macos/Podfile b/packages/url_launcher/url_launcher/example/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/url_launcher/url_launcher/example/macos/Podfile +++ b/packages/url_launcher/url_launcher/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/url_launcher/url_launcher_macos/example/macos/Podfile b/packages/url_launcher/url_launcher_macos/example/macos/Podfile index 47c1b18fedae..dd603efb9895 100644 --- a/packages/url_launcher/url_launcher_macos/example/macos/Podfile +++ b/packages/url_launcher/url_launcher_macos/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) diff --git a/packages/vector_graphics/CHANGELOG.md b/packages/vector_graphics/CHANGELOG.md index de88a770fce1..a51da2ef8737 100644 --- a/packages/vector_graphics/CHANGELOG.md +++ b/packages/vector_graphics/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.14 + +* Relaxes dependency constraint on vector_graphics_codec. + ## 1.1.13 * Fix execution on the web with WebAssembly. diff --git a/packages/vector_graphics/pubspec.yaml b/packages/vector_graphics/pubspec.yaml index 4c86eb5cdf99..2b74c23555ab 100644 --- a/packages/vector_graphics/pubspec.yaml +++ b/packages/vector_graphics/pubspec.yaml @@ -2,10 +2,7 @@ name: vector_graphics description: A vector graphics rendering package for Flutter using a binary encoding. repository: https://github.com/flutter/packages/tree/main/packages/vector_graphics issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+vector_graphics%22 -# See https://github.com/flutter/flutter/issues/157626 before publishing a new -# version. -publish_to: none -version: 1.1.13 +version: 1.1.14 environment: sdk: ^3.4.0 @@ -15,14 +12,12 @@ dependencies: flutter: sdk: flutter http: ^1.0.0 - # See https://github.com/flutter/flutter/issues/157626 - vector_graphics_codec: ">=1.1.11+1 <= 1.1.12" + vector_graphics_codec: ^1.1.11+1 dev_dependencies: flutter_test: sdk: flutter - # See https://github.com/flutter/flutter/issues/157626 - vector_graphics_compiler: ^1.1.13 + vector_graphics_compiler: ^1.1.11+1 platforms: android: diff --git a/packages/vector_graphics_codec/pubspec.yaml b/packages/vector_graphics_codec/pubspec.yaml index ae46c84c6fec..78af4cdae4a1 100644 --- a/packages/vector_graphics_codec/pubspec.yaml +++ b/packages/vector_graphics_codec/pubspec.yaml @@ -2,9 +2,6 @@ name: vector_graphics_codec description: An encoding library for the binary format used in `package:vector_graphics` repository: https://github.com/flutter/packages/tree/main/packages/vector_graphics_codec issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+vector_graphics%22 -# See https://github.com/flutter/flutter/issues/157626 before publishing a new -# version. -publish_to: none version: 1.1.12 environment: diff --git a/packages/vector_graphics_compiler/CHANGELOG.md b/packages/vector_graphics_compiler/CHANGELOG.md index 51e080adfa83..adc696ab5efa 100644 --- a/packages/vector_graphics_compiler/CHANGELOG.md +++ b/packages/vector_graphics_compiler/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.1.14 + +* Makes the package WASM compatible. + +## 1.1.13 + +* Relaxes dependency constraint on vector_graphics_codec. + ## 1.1.12 * Transfers the package source from https://github.com/dnfield/vector_graphics diff --git a/packages/vector_graphics_compiler/lib/vector_graphics_compiler.dart b/packages/vector_graphics_compiler/lib/vector_graphics_compiler.dart index c4a8efe3b27a..206041b7d264 100644 --- a/packages/vector_graphics_compiler/lib/vector_graphics_compiler.dart +++ b/packages/vector_graphics_compiler/lib/vector_graphics_compiler.dart @@ -18,9 +18,9 @@ import 'src/svg/theme.dart'; import 'src/vector_instructions.dart'; export 'src/_initialize_path_ops_io.dart' - if (dart.library.html) 'src/_initialize_path_ops_web.dart'; + if (dart.library.js_interop) 'src/_initialize_path_ops_web.dart'; export 'src/_initialize_tessellator_io.dart' - if (dart.library.html) 'src/_initialize_tessellator_web.dart'; + if (dart.library.js_interop) 'src/_initialize_tessellator_web.dart'; export 'src/geometry/basic_types.dart'; export 'src/geometry/matrix.dart'; export 'src/geometry/path.dart'; diff --git a/packages/vector_graphics_compiler/pubspec.yaml b/packages/vector_graphics_compiler/pubspec.yaml index ae92d689012e..6c86d50b38af 100644 --- a/packages/vector_graphics_compiler/pubspec.yaml +++ b/packages/vector_graphics_compiler/pubspec.yaml @@ -2,10 +2,7 @@ name: vector_graphics_compiler description: A compiler to convert SVGs to the binary format used by `package:vector_graphics`. repository: https://github.com/flutter/packages/tree/main/packages/vector_graphics_compiler issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+vector_graphics%22 -# See https://github.com/flutter/flutter/issues/157626 before publishing a new -# version. -publish_to: none -version: 1.1.12 +version: 1.1.14 executables: vector_graphics_compiler: @@ -18,8 +15,7 @@ dependencies: meta: ^1.7.0 path: ^1.8.0 path_parsing: ^1.0.1 - # See https://github.com/flutter/flutter/issues/157626 - vector_graphics_codec: ">=1.1.11+1 <= 1.1.12" + vector_graphics_codec: ^1.1.11+1 # This uses an exact upper range because it is an external dependency (see # https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#dependencies # for more information), and this mitigates transitive risk exposure to @@ -35,8 +31,7 @@ dev_dependencies: flutter_test: sdk: flutter test: ^1.20.1 - # See https://github.com/flutter/flutter/issues/157626 - vector_graphics: ">=1.1.11+1 <= 1.1.12" + vector_graphics: ^1.1.13 vector_math: ^2.1.2 platforms: diff --git a/packages/video_player/video_player/example/macos/Podfile b/packages/video_player/video_player/example/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/video_player/video_player/example/macos/Podfile +++ b/packages/video_player/video_player/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/video_player/video_player_avfoundation/example/macos/Podfile b/packages/video_player/video_player_avfoundation/example/macos/Podfile index c795730db8ed..29c8eb3294cb 100644 --- a/packages/video_player/video_player_avfoundation/example/macos/Podfile +++ b/packages/video_player/video_player_avfoundation/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/packages/webview_flutter/webview_flutter/example/macos/Podfile b/packages/webview_flutter/webview_flutter/example/macos/Podfile index 049abe295427..ae77cc1d4269 100644 --- a/packages/webview_flutter/webview_flutter/example/macos/Podfile +++ b/packages/webview_flutter/webview_flutter/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/macos/Podfile b/packages/webview_flutter/webview_flutter_wkwebview/example/macos/Podfile index c795730db8ed..29c8eb3294cb 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/macos/Podfile +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/macos/Podfile @@ -28,7 +28,6 @@ flutter_macos_podfile_setup target 'Runner' do use_frameworks! - use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/script/tool/lib/src/common/core.dart b/script/tool/lib/src/common/core.dart index a26c8391596a..9fef751ab56d 100644 --- a/script/tool/lib/src/common/core.dart +++ b/script/tool/lib/src/common/core.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'package:file/file.dart'; +import 'package:platform/platform.dart'; import 'package:pub_semver/pub_semver.dart'; /// The signature for a print handler for commands that allow overriding the @@ -127,3 +128,13 @@ const int exitCommandFoundErrors = 1; /// A exit code for [ToolExit] for a failure to run due to invalid arguments. const int exitInvalidArguments = 2; + +/// The directory to which to write logs and other artifacts, if set in CI. +Directory? ciLogsDirectory(Platform platform, FileSystem fileSystem) { + final String? logsDirectoryPath = platform.environment['FLUTTER_LOGS_DIR']; + Directory? logsDirectory; + if (logsDirectoryPath != null) { + logsDirectory = fileSystem.directory(logsDirectoryPath); + } + return logsDirectory; +} diff --git a/script/tool/lib/src/common/xcode.dart b/script/tool/lib/src/common/xcode.dart index 4a4bf03ba549..7ba23fc000d3 100644 --- a/script/tool/lib/src/common/xcode.dart +++ b/script/tool/lib/src/common/xcode.dart @@ -6,7 +6,9 @@ import 'dart:convert'; import 'dart:io' as io; import 'package:file/file.dart'; +import 'package:platform/platform.dart'; +import 'core.dart'; import 'output_utils.dart'; import 'process_runner.dart'; @@ -33,36 +35,81 @@ class Xcode { /// Runs an `xcodebuild` in [directory] with the given parameters. Future runXcodeBuild( Directory exampleDirectory, - String platform, { + String targetPlatform, { List actions = const ['build'], required String workspace, required String scheme, String? configuration, List extraFlags = const [], - }) { - File? disabledSandboxEntitlementFile; - if (actions.contains('test') && platform.toLowerCase() == 'macos') { - disabledSandboxEntitlementFile = _createDisabledSandboxEntitlementFile( - exampleDirectory.childDirectory(platform.toLowerCase()), - configuration ?? 'Debug', - ); - } - final List args = [ - _xcodeBuildCommand, - ...actions, - ...['-workspace', workspace], - ...['-scheme', scheme], - if (configuration != null) ...['-configuration', configuration], - ...extraFlags, - if (disabledSandboxEntitlementFile != null) - 'CODE_SIGN_ENTITLEMENTS=${disabledSandboxEntitlementFile.path}', - ]; - final String completeTestCommand = '$_xcRunCommand ${args.join(' ')}'; - if (log) { - print(completeTestCommand); + required Platform hostPlatform, + }) async { + final FileSystem fileSystem = exampleDirectory.fileSystem; + String? resultBundlePath; + final Directory? logsDirectory = ciLogsDirectory(hostPlatform, fileSystem); + Directory? resultBundleTemp; + try { + if (logsDirectory != null) { + resultBundleTemp = + fileSystem.systemTempDirectory.createTempSync('flutter_xcresult.'); + resultBundlePath = resultBundleTemp.childDirectory('result').path; + } + File? disabledSandboxEntitlementFile; + if (actions.contains('test') && targetPlatform.toLowerCase() == 'macos') { + disabledSandboxEntitlementFile = _createDisabledSandboxEntitlementFile( + exampleDirectory.childDirectory(targetPlatform.toLowerCase()), + configuration ?? 'Debug', + ); + } + final List args = [ + _xcodeBuildCommand, + ...actions, + ...['-workspace', workspace], + ...['-scheme', scheme], + if (resultBundlePath != null) ...[ + '-resultBundlePath', + resultBundlePath + ], + if (configuration != null) ...['-configuration', configuration], + ...extraFlags, + if (disabledSandboxEntitlementFile != null) + 'CODE_SIGN_ENTITLEMENTS=${disabledSandboxEntitlementFile.path}', + ]; + final String completeTestCommand = '$_xcRunCommand ${args.join(' ')}'; + if (log) { + print(completeTestCommand); + } + final int resultExit = await processRunner + .runAndStream(_xcRunCommand, args, workingDir: exampleDirectory); + + if (resultExit != 0 && resultBundleTemp != null) { + final Directory xcresultBundle = + resultBundleTemp.childDirectory('result.xcresult'); + if (logsDirectory != null) { + if (xcresultBundle.existsSync()) { + // Zip the test results to the artifacts directory for upload. + final File zipPath = logsDirectory.childFile( + 'xcodebuild-${DateTime.now().toLocal().toIso8601String()}.zip'); + await processRunner.run( + 'zip', + [ + '-r', + '-9', + '-q', + zipPath.path, + xcresultBundle.basename, + ], + workingDir: resultBundleTemp, + ); + } else { + print( + 'xcresult bundle ${xcresultBundle.path} does not exist, skipping upload'); + } + } + } + return resultExit; + } finally { + resultBundleTemp?.deleteSync(recursive: true); } - return processRunner.runAndStream(_xcRunCommand, args, - workingDir: exampleDirectory); } /// Returns true if [project], which should be an .xcodeproj directory, diff --git a/script/tool/lib/src/drive_examples_command.dart b/script/tool/lib/src/drive_examples_command.dart index a5ddd3bd4a9d..8ae124856021 100644 --- a/script/tool/lib/src/drive_examples_command.dart +++ b/script/tool/lib/src/drive_examples_command.dart @@ -228,8 +228,12 @@ class DriveExamplesCommand extends PackageLoopingCommand { } for (final File driver in drivers) { final List failingTargets = await _driveTests( - example, driver, testTargets, - deviceFlags: deviceFlags); + example, + driver, + testTargets, + deviceFlags: deviceFlags, + exampleName: exampleName, + ); for (final File failingTarget in failingTargets) { errors.add( getRelativePosixPath(failingTarget, from: package.directory)); @@ -376,10 +380,16 @@ class DriveExamplesCommand extends PackageLoopingCommand { File driver, List targets, { required List deviceFlags, + required String exampleName, }) async { final List failures = []; final String enableExperiment = getStringArg(kEnableExperiment); + final String screenshotBasename = + '${exampleName.replaceAll(platform.pathSeparator, '_')}-drive'; + final Directory? screenshotDirectory = + ciLogsDirectory(platform, driver.fileSystem) + ?.childDirectory(screenshotBasename); for (final File target in targets) { final int exitCode = await processRunner.runAndStream( @@ -389,6 +399,8 @@ class DriveExamplesCommand extends PackageLoopingCommand { ...deviceFlags, if (enableExperiment.isNotEmpty) '--enable-experiment=$enableExperiment', + if (screenshotDirectory != null) + '--screenshot=${screenshotDirectory.path}', '--driver', getRelativePosixPath(driver, from: example.directory), '--target', @@ -416,6 +428,8 @@ class DriveExamplesCommand extends PackageLoopingCommand { required List testFiles, }) async { final String enableExperiment = getStringArg(kEnableExperiment); + final Directory? logsDirectory = + ciLogsDirectory(platform, testFiles.first.fileSystem); // Workaround for https://github.com/flutter/flutter/issues/135673 // Once that is fixed on stable, this logic can be removed and the command @@ -438,6 +452,7 @@ class DriveExamplesCommand extends PackageLoopingCommand { ...deviceFlags, if (enableExperiment.isNotEmpty) '--enable-experiment=$enableExperiment', + if (logsDirectory != null) '--debug-logs-dir=${logsDirectory.path}', target, ], workingDir: example.directory); diff --git a/script/tool/lib/src/native_test_command.dart b/script/tool/lib/src/native_test_command.dart index 1cd7afb6b4ae..47fd57998765 100644 --- a/script/tool/lib/src/native_test_command.dart +++ b/script/tool/lib/src/native_test_command.dart @@ -431,7 +431,7 @@ this command. /// usually at "example/{ios,macos}/Runner.xcworkspace". Future<_PlatformResult> _runXcodeTests( RepositoryPackage plugin, - String platform, + String targetPlatform, _TestMode mode, { List extraFlags = const [], }) async { @@ -456,7 +456,7 @@ this command. final String? targetToCheck = testTarget ?? (mode.unit ? unitTestTarget : null); final Directory xcodeProject = example.directory - .childDirectory(platform.toLowerCase()) + .childDirectory(targetPlatform.toLowerCase()) .childDirectory('Runner.xcodeproj'); if (targetToCheck != null) { final bool? hasTarget = @@ -473,16 +473,17 @@ this command. } } - _printRunningExampleTestsMessage(example, platform); + _printRunningExampleTestsMessage(example, targetPlatform); final int exitCode = await _xcode.runXcodeBuild( example.directory, - platform, + targetPlatform, // Clean before testing to remove cached swiftmodules from previous // runs, which can cause conflicts. actions: ['clean', 'test'], - workspace: '${platform.toLowerCase()}/Runner.xcworkspace', + workspace: '${targetPlatform.toLowerCase()}/Runner.xcworkspace', scheme: 'Runner', configuration: 'Debug', + hostPlatform: platform, extraFlags: [ if (testTarget != null) '-only-testing:$testTarget', ...extraFlags, @@ -494,9 +495,10 @@ this command. const int xcodebuildNoTestExitCode = 66; switch (exitCode) { case xcodebuildNoTestExitCode: - _printNoExampleTestsMessage(example, platform); + _printNoExampleTestsMessage(example, targetPlatform); case 0: - printSuccess('Successfully ran $platform xctest for $exampleName'); + printSuccess( + 'Successfully ran $targetPlatform xctest for $exampleName'); // If this is the first test, assume success until something fails. if (overallResult == RunState.skipped) { overallResult = RunState.succeeded; diff --git a/script/tool/lib/src/podspec_check_command.dart b/script/tool/lib/src/podspec_check_command.dart index b8aa218ffbc3..e13a6cb02cac 100644 --- a/script/tool/lib/src/podspec_check_command.dart +++ b/script/tool/lib/src/podspec_check_command.dart @@ -152,7 +152,6 @@ class PodspecCheckCommand extends PackageLoopingCommand { podspecPath, '--configuration=Debug', // Release targets unsupported arm64 simulators. Use Debug to only build against targeted x86_64 simulator devices. '--skip-tests', - '--use-modular-headers', // Flutter sets use_modular_headers! in its templates. if (libraryLint) '--use-libraries' ]; diff --git a/script/tool/lib/src/xcode_analyze_command.dart b/script/tool/lib/src/xcode_analyze_command.dart index 707a3f08b6d6..ba4b3fb5e95b 100644 --- a/script/tool/lib/src/xcode_analyze_command.dart +++ b/script/tool/lib/src/xcode_analyze_command.dart @@ -97,10 +97,10 @@ class XcodeAnalyzeCommand extends PackageLoopingCommand { multiplePlatformsRequested ? failures : []); } - /// Analyzes [plugin] for [platform], returning true if it passed analysis. + /// Analyzes [plugin] for [targetPlatform], returning true if it passed analysis. Future _analyzePlugin( RepositoryPackage plugin, - String platform, { + String targetPlatform, { List extraFlags = const [], }) async { bool passing = true; @@ -108,25 +108,26 @@ class XcodeAnalyzeCommand extends PackageLoopingCommand { // Running tests and static analyzer. final String examplePath = getRelativePosixPath(example.directory, from: plugin.directory.parent); - print('Running $platform tests and analyzer for $examplePath...'); + print('Running $targetPlatform tests and analyzer for $examplePath...'); final int exitCode = await _xcode.runXcodeBuild( example.directory, - platform, + targetPlatform, // Clean before analyzing to remove cached swiftmodules from previous // runs, which can cause conflicts. actions: ['clean', 'analyze'], - workspace: '${platform.toLowerCase()}/Runner.xcworkspace', + workspace: '${targetPlatform.toLowerCase()}/Runner.xcworkspace', scheme: 'Runner', configuration: 'Debug', + hostPlatform: platform, extraFlags: [ ...extraFlags, 'GCC_TREAT_WARNINGS_AS_ERRORS=YES', ], ); if (exitCode == 0) { - printSuccess('$examplePath ($platform) passed analysis.'); + printSuccess('$examplePath ($targetPlatform) passed analysis.'); } else { - printError('$examplePath ($platform) failed analysis.'); + printError('$examplePath ($targetPlatform) failed analysis.'); passing = false; } } diff --git a/script/tool/test/common/xcode_test.dart b/script/tool/test/common/xcode_test.dart index 8fd415160015..4d27372890fb 100644 --- a/script/tool/test/common/xcode_test.dart +++ b/script/tool/test/common/xcode_test.dart @@ -165,6 +165,7 @@ void main() { 'ios', workspace: 'A.xcworkspace', scheme: 'AScheme', + hostPlatform: MockPlatform(), ); expect(exitCode, 0); @@ -193,6 +194,7 @@ void main() { workspace: 'A.xcworkspace', scheme: 'AScheme', configuration: 'Debug', + hostPlatform: MockPlatform(), extraFlags: ['-a', '-b', 'c=d']); expect(exitCode, 0); @@ -230,6 +232,7 @@ void main() { 'ios', workspace: 'A.xcworkspace', scheme: 'AScheme', + hostPlatform: MockPlatform(), ); expect(exitCode, 1); @@ -264,6 +267,7 @@ void main() { 'macos', workspace: 'A.xcworkspace', scheme: 'AScheme', + hostPlatform: MockPlatform(), actions: ['test'], ); diff --git a/script/tool/test/drive_examples_command_test.dart b/script/tool/test/drive_examples_command_test.dart index 6bbd5e301ad5..a1d48865bc4a 100644 --- a/script/tool/test/drive_examples_command_test.dart +++ b/script/tool/test/drive_examples_command_test.dart @@ -41,6 +41,7 @@ void main() { // TODO(dit): Clean this up, https://github.com/flutter/flutter/issues/151869 mockPlatform.environment['CHANNEL'] = 'master'; + mockPlatform.environment['FLUTTER_LOGS_DIR'] = '/path/to/logs'; }); void setMockFlutterDevicesOutput({ @@ -318,6 +319,57 @@ void main() { ]), ); + expect( + processRunner.recordedCalls, + orderedEquals([ + ProcessCall(getFlutterCommand(mockPlatform), + const ['devices', '--machine'], null), + ProcessCall( + getFlutterCommand(mockPlatform), + const [ + 'test', + '-d', + _fakeIOSDevice, + '--debug-logs-dir=/path/to/logs', + 'integration_test', + ], + pluginExampleDirectory.path), + ])); + }); + + test('handles missing CI debug logs directory', () async { + mockPlatform.environment.remove('FLUTTER_LOGS_DIR'); + + final RepositoryPackage plugin = createFakePlugin( + 'plugin', + packagesDir, + extraFiles: [ + 'example/integration_test/bar_test.dart', + 'example/integration_test/foo_test.dart', + 'example/integration_test/ignore_me.dart', + 'example/android/android.java', + 'example/ios/ios.m', + ], + platformSupport: { + platformAndroid: const PlatformDetails(PlatformSupport.inline), + platformIOS: const PlatformDetails(PlatformSupport.inline), + }, + ); + + final Directory pluginExampleDirectory = getExampleDir(plugin); + + setMockFlutterDevicesOutput(); + final List output = + await runCapturingPrint(runner, ['drive-examples', '--ios']); + + expect( + output, + containsAllInOrder([ + contains('Running for plugin'), + contains('No issues found!'), + ]), + ); + expect( processRunner.recordedCalls, orderedEquals([ @@ -396,6 +448,7 @@ void main() { 'test', '-d', 'linux', + '--debug-logs-dir=/path/to/logs', 'integration_test', ], pluginExampleDirectory.path), @@ -463,6 +516,7 @@ void main() { 'test', '-d', 'macos', + '--debug-logs-dir=/path/to/logs', 'integration_test', ], pluginExampleDirectory.path), @@ -510,6 +564,7 @@ void main() { 'test', '-d', 'macos', + '--debug-logs-dir=/path/to/logs', 'integration_test/first_test.dart', ], pluginExampleDirectory.path), @@ -519,6 +574,7 @@ void main() { 'test', '-d', 'macos', + '--debug-logs-dir=/path/to/logs', 'integration_test/second_test.dart', ], pluginExampleDirectory.path), @@ -565,6 +621,7 @@ void main() { 'test', '-d', 'linux', + '--debug-logs-dir=/path/to/logs', 'integration_test/first_test.dart', ], pluginExampleDirectory.path), @@ -574,6 +631,7 @@ void main() { 'test', '-d', 'linux', + '--debug-logs-dir=/path/to/logs', 'integration_test/second_test.dart', ], pluginExampleDirectory.path), @@ -620,6 +678,7 @@ void main() { 'test', '-d', 'windows', + '--debug-logs-dir=/path/to/logs', 'integration_test/first_test.dart', ], pluginExampleDirectory.path), @@ -629,6 +688,7 @@ void main() { 'test', '-d', 'windows', + '--debug-logs-dir=/path/to/logs', 'integration_test/second_test.dart', ], pluginExampleDirectory.path), @@ -700,6 +760,7 @@ void main() { '--web-port=7357', '--browser-name=chrome', '--web-renderer=canvaskit', + '--screenshot=/path/to/logs/plugin_example-drive', '--driver', 'test_driver/integration_test.dart', '--target', @@ -751,6 +812,7 @@ void main() { '--web-port=7357', '--browser-name=chrome', '--wasm', + '--screenshot=/path/to/logs/plugin_example-drive', '--driver', 'test_driver/integration_test.dart', '--target', @@ -805,6 +867,7 @@ void main() { '--web-port=7357', '--browser-name=chrome', '--web-renderer=html', + '--screenshot=/path/to/logs/plugin_example-drive', '--driver', 'test_driver/integration_test.dart', '--target', @@ -854,6 +917,7 @@ void main() { '--web-port=7357', '--browser-name=chrome', '--web-renderer=canvaskit', + '--screenshot=/path/to/logs/plugin_example-drive', '--driver', 'test_driver/integration_test.dart', '--target', @@ -907,6 +971,7 @@ void main() { '--browser-name=chrome', '--web-renderer=canvaskit', '--chrome-binary=/path/to/chrome', + '--screenshot=/path/to/logs/plugin_example-drive', '--driver', 'test_driver/integration_test.dart', '--target', @@ -977,6 +1042,7 @@ void main() { 'test', '-d', 'windows', + '--debug-logs-dir=/path/to/logs', 'integration_test', ], pluginExampleDirectory.path), @@ -1023,6 +1089,7 @@ void main() { 'test', '-d', _fakeAndroidDevice, + '--debug-logs-dir=/path/to/logs', 'integration_test', ], pluginExampleDirectory.path), @@ -1069,6 +1136,7 @@ void main() { 'test', '-d', _fakeAndroidDevice, + '--debug-logs-dir=/path/to/logs', 'integration_test', ], pluginExampleDirectory.path), @@ -1197,6 +1265,7 @@ void main() { '-d', _fakeIOSDevice, '--enable-experiment=exp1', + '--debug-logs-dir=/path/to/logs', 'integration_test', ], pluginExampleDirectory.path), @@ -1353,6 +1422,7 @@ void main() { '--web-port=7357', '--browser-name=chrome', '--web-renderer=canvaskit', + '--screenshot=/path/to/logs/plugin_example-drive', '--driver', 'test_driver/integration_test.dart', '--target', @@ -1368,6 +1438,7 @@ void main() { '--web-port=7357', '--browser-name=chrome', '--web-renderer=canvaskit', + '--screenshot=/path/to/logs/plugin_example-drive', '--driver', 'test_driver/integration_test.dart', '--target', @@ -1425,6 +1496,7 @@ void main() { 'test', '-d', _fakeIOSDevice, + '--debug-logs-dir=/path/to/logs', 'integration_test', ], pluginExampleDirectory.path), @@ -1454,6 +1526,52 @@ void main() { ]), ); + expect( + processRunner.recordedCalls, + orderedEquals([ + ProcessCall( + getFlutterCommand(mockPlatform), + const [ + 'drive', + '-d', + 'web-server', + '--web-port=7357', + '--browser-name=chrome', + '--web-renderer=canvaskit', + '--screenshot=/path/to/logs/a_package_example-drive', + '--driver', + 'test_driver/integration_test.dart', + '--target', + 'integration_test/foo_test.dart' + ], + exampleDirectory.path), + ])); + }); + + test('drive handles missing CI screenshot directory', () async { + mockPlatform.environment.remove('FLUTTER_LOGS_DIR'); + + final RepositoryPackage package = + createFakePackage('a_package', packagesDir, extraFiles: [ + 'example/integration_test/foo_test.dart', + 'example/test_driver/integration_test.dart', + 'example/web/index.html', + ]); + final Directory exampleDirectory = getExampleDir(package); + + final List output = await runCapturingPrint(runner, [ + 'drive-examples', + '--web', + ]); + + expect( + output, + containsAllInOrder([ + contains('Running for a_package'), + contains('No issues found!'), + ]), + ); + expect( processRunner.recordedCalls, orderedEquals([ @@ -1546,6 +1664,7 @@ void main() { '--web-port=7357', '--browser-name=chrome', '--web-renderer=canvaskit', + '--screenshot=/path/to/logs/a_package_example_with_web-drive', '--driver', 'test_driver/integration_test.dart', '--target', diff --git a/script/tool/test/mocks.dart b/script/tool/test/mocks.dart index 3ce9512ad018..2c84ecedd12c 100644 --- a/script/tool/test/mocks.dart +++ b/script/tool/test/mocks.dart @@ -33,6 +33,9 @@ class MockPlatform extends Mock implements Platform { @override Map environment = {}; + + @override + String get pathSeparator => isWindows ? r'\' : '/'; } class MockProcess extends Mock implements io.Process { diff --git a/script/tool/test/podspec_check_command_test.dart b/script/tool/test/podspec_check_command_test.dart index ddbf9db05a5a..fe20e992ab87 100644 --- a/script/tool/test/podspec_check_command_test.dart +++ b/script/tool/test/podspec_check_command_test.dart @@ -156,7 +156,6 @@ void main() { .path, '--configuration=Debug', '--skip-tests', - '--use-modular-headers', '--use-libraries' ], packagesDir.path), @@ -171,7 +170,6 @@ void main() { .path, '--configuration=Debug', '--skip-tests', - '--use-modular-headers', ], packagesDir.path), ]), @@ -212,7 +210,6 @@ void main() { .path, '--configuration=Debug', '--skip-tests', - '--use-modular-headers', '--use-libraries' ], packagesDir.path), @@ -227,7 +224,6 @@ void main() { .path, '--configuration=Debug', '--skip-tests', - '--use-modular-headers', ], packagesDir.path), ]), diff --git a/third_party/packages/flutter_svg/CHANGELOG.md b/third_party/packages/flutter_svg/CHANGELOG.md index 12f175ece137..1adca859374c 100644 --- a/third_party/packages/flutter_svg/CHANGELOG.md +++ b/third_party/packages/flutter_svg/CHANGELOG.md @@ -1,7 +1,12 @@ -## 2.0.13 +## 2.0.14 * Makes the package WASM compatible. +## 2.0.13 + +* Relaxes the dependency constraints on vector_graphics, vector_graphics_codec, + and vector_graphics_compiler. + ## 2.0.12 * Adds `missing_code_block_language_in_doc_comment` lint. diff --git a/third_party/packages/flutter_svg/pubspec.yaml b/third_party/packages/flutter_svg/pubspec.yaml index 8ff19eb6c5ec..b493599dc0f3 100644 --- a/third_party/packages/flutter_svg/pubspec.yaml +++ b/third_party/packages/flutter_svg/pubspec.yaml @@ -2,7 +2,7 @@ name: flutter_svg description: An SVG rendering and widget library for Flutter, which allows painting and displaying Scalable Vector Graphics 1.1 files. repository: https://github.com/flutter/packages/tree/main/third_party/packages/flutter_svg issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_svg%22 -version: 2.0.13 +version: 2.0.14 environment: sdk: ^3.4.0 @@ -12,9 +12,8 @@ dependencies: flutter: sdk: flutter http: ^1.0.0 - # See https://github.com/flutter/flutter/issues/157626 vector_graphics: ^1.1.13 - vector_graphics_codec: ">=1.1.11+1 <= 1.1.12" + vector_graphics_codec: ^1.1.11+1 vector_graphics_compiler: ^1.1.13 dev_dependencies: