Skip to content

Commit

Permalink
Reconfigure Cirrus to use clang 7 (flutter#905)
Browse files Browse the repository at this point in the history
clang-format 5.0 formats ObjC files differently than newer versions, which results in the CI failing the format check for PRs formatted locally with a recent clang version.

The latest clang version available on the Ubuntu repositories for the Cirrus machines is 7, upgrading to that seems to be consistent with what I locally get with clang-format 8.0.

This PR also reformats all files with the new clang style.
  • Loading branch information
amirh authored Nov 20, 2018
1 parent 78e23e4 commit eaa1388
Show file tree
Hide file tree
Showing 63 changed files with 250 additions and 238 deletions.
6 changes: 3 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ task:
- name: test+format
install_script:
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main"
- sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main"
- sudo apt-get update
- sudo apt-get install -y --allow-unauthenticated clang-format-5.0
format_script: ./script/incremental_build.sh format --travis --clang-format=clang-format-5.0
- sudo apt-get install -y --allow-unauthenticated clang-format-7
format_script: ./script/incremental_build.sh format --travis --clang-format=clang-format-7
test_script: ./script/incremental_build.sh test
- name: analyze
script: ./script/incremental_build.sh analyze
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

#import <Flutter/Flutter.h>

@interface FLTAndroidAlarmManagerPlugin : NSObject<FlutterPlugin>
@interface FLTAndroidAlarmManagerPlugin : NSObject <FlutterPlugin>
@end
2 changes: 1 addition & 1 deletion packages/android_intent/ios/Classes/AndroidIntentPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

#import <Flutter/Flutter.h>

@interface FLTAndroidIntentPlugin : NSObject<FlutterPlugin>
@interface FLTAndroidIntentPlugin : NSObject <FlutterPlugin>
@end
2 changes: 1 addition & 1 deletion packages/battery/ios/Classes/BatteryPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

#import <Flutter/Flutter.h>

@interface FLTBatteryPlugin : NSObject<FlutterPlugin>
@interface FLTBatteryPlugin : NSObject <FlutterPlugin>
@end
2 changes: 1 addition & 1 deletion packages/battery/ios/Classes/BatteryPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#import "BatteryPlugin.h"

@interface FLTBatteryPlugin ()<FlutterStreamHandler>
@interface FLTBatteryPlugin () <FlutterStreamHandler>
@end

@implementation FLTBatteryPlugin {
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/ios/Classes/CameraPlugin.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import <Flutter/Flutter.h>

@interface CameraPlugin : NSObject<FlutterPlugin>
@interface CameraPlugin : NSObject <FlutterPlugin>
@end
33 changes: 18 additions & 15 deletions packages/camera/ios/Classes/CameraPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ - (FlutterError *)flutterError {
}
@end

@interface FLTSavePhotoDelegate : NSObject<AVCapturePhotoCaptureDelegate>
@interface FLTSavePhotoDelegate : NSObject <AVCapturePhotoCaptureDelegate>
@property(readonly, nonatomic) NSString *path;
@property(readonly, nonatomic) FlutterResult result;

Expand Down Expand Up @@ -59,8 +59,10 @@ - (void)captureOutput:(AVCapturePhotoOutput *)output
}
@end

@interface FLTCam : NSObject<FlutterTexture, AVCaptureVideoDataOutputSampleBufferDelegate,
AVCaptureAudioDataOutputSampleBufferDelegate, FlutterStreamHandler>
@interface FLTCam : NSObject <FlutterTexture,
AVCaptureVideoDataOutputSampleBufferDelegate,
AVCaptureAudioDataOutputSampleBufferDelegate,
FlutterStreamHandler>
@property(readonly, nonatomic) int64_t textureId;
@property(nonatomic, copy) void (^onFrameAvailable)();
@property(nonatomic) FlutterEventChannel *eventChannel;
Expand Down Expand Up @@ -111,8 +113,8 @@ - (instancetype)initWithCameraName:(NSString *)cameraName
_captureSession.sessionPreset = preset;
_captureDevice = [AVCaptureDevice deviceWithUniqueID:cameraName];
NSError *localError = nil;
_captureVideoInput =
[AVCaptureDeviceInput deviceInputWithDevice:_captureDevice error:&localError];
_captureVideoInput = [AVCaptureDeviceInput deviceInputWithDevice:_captureDevice
error:&localError];
if (localError) {
*error = localError;
return nil;
Expand All @@ -123,7 +125,7 @@ - (instancetype)initWithCameraName:(NSString *)cameraName

_captureVideoOutput = [AVCaptureVideoDataOutput new];
_captureVideoOutput.videoSettings =
@{(NSString *)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_32BGRA) };
@{(NSString *)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_32BGRA)};
[_captureVideoOutput setAlwaysDiscardsLateVideoFrames:YES];
[_captureVideoOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()];

Expand Down Expand Up @@ -154,9 +156,9 @@ - (void)stop {
- (void)captureToFile:(NSString *)path result:(FlutterResult)result {
AVCapturePhotoSettings *settings = [AVCapturePhotoSettings photoSettings];
[settings setHighResolutionPhotoEnabled:YES];
[_capturePhotoOutput
capturePhotoWithSettings:settings
delegate:[[FLTSavePhotoDelegate alloc] initWithPath:path result:result]];
[_capturePhotoOutput capturePhotoWithSettings:settings
delegate:[[FLTSavePhotoDelegate alloc] initWithPath:path
result:result]];
}

- (void)captureOutput:(AVCaptureOutput *)output
Expand Down Expand Up @@ -330,8 +332,9 @@ - (BOOL)setupWriterForPath:(NSString *)path {
if (!_isAudioSetup) {
[self setUpCaptureSessionForAudio];
}
_videoWriter =
[[AVAssetWriter alloc] initWithURL:outputURL fileType:AVFileTypeQuickTimeMovie error:&error];
_videoWriter = [[AVAssetWriter alloc] initWithURL:outputURL
fileType:AVFileTypeQuickTimeMovie
error:&error];
NSParameterAssert(_videoWriter);
if (error) {
_eventSink(@{@"event" : @"error", @"errorDescription" : error.description});
Expand Down Expand Up @@ -375,8 +378,8 @@ - (void)setUpCaptureSessionForAudio {
// Create a device input with the device and add it to the session.
// Setup the audio input.
AVCaptureDevice *audioDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
AVCaptureDeviceInput *audioInput =
[AVCaptureDeviceInput deviceInputWithDevice:audioDevice error:&error];
AVCaptureDeviceInput *audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioDevice
error:&error];
if (error) {
_eventSink(@{@"event" : @"error", @"errorDescription" : error.description});
}
Expand Down Expand Up @@ -411,8 +414,8 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
FlutterMethodChannel *channel =
[FlutterMethodChannel methodChannelWithName:@"plugins.flutter.io/camera"
binaryMessenger:[registrar messenger]];
CameraPlugin *instance =
[[CameraPlugin alloc] initWithRegistry:[registrar textures] messenger:[registrar messenger]];
CameraPlugin *instance = [[CameraPlugin alloc] initWithRegistry:[registrar textures]
messenger:[registrar messenger]];
[registrar addMethodCallDelegate:instance channel:channel];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

#import <Flutter/Flutter.h>

@interface FLTCloudFirestorePlugin : NSObject<FlutterPlugin>
@interface FLTCloudFirestorePlugin : NSObject <FlutterPlugin>
@end
33 changes: 17 additions & 16 deletions packages/cloud_firestore/ios/Classes/CloudFirestorePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -295,27 +295,28 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
result(error.flutterError);
};
if ([@"Firestore#runTransaction" isEqualToString:call.method]) {
[getFirestore(call.arguments) runTransactionWithBlock:^id(FIRTransaction *transaction,
NSError **pError) {
NSNumber *transactionId = call.arguments[@"transactionId"];
NSNumber *transactionTimeout = call.arguments[@"transactionTimeout"];
[getFirestore(call.arguments)
runTransactionWithBlock:^id(FIRTransaction *transaction, NSError **pError) {
NSNumber *transactionId = call.arguments[@"transactionId"];
NSNumber *transactionTimeout = call.arguments[@"transactionTimeout"];

self->transactions[transactionId] = transaction;
self->transactions[transactionId] = transaction;

dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);

[self.channel invokeMethod:@"DoTransaction"
arguments:call.arguments
result:^(id doTransactionResult) {
self->transactionResults[transactionId] = doTransactionResult;
dispatch_semaphore_signal(semaphore);
}];
[self.channel invokeMethod:@"DoTransaction"
arguments:call.arguments
result:^(id doTransactionResult) {
self->transactionResults[transactionId] = doTransactionResult;
dispatch_semaphore_signal(semaphore);
}];

dispatch_semaphore_wait(
semaphore, dispatch_time(DISPATCH_TIME_NOW, [transactionTimeout integerValue] * 1000000));
dispatch_semaphore_wait(
semaphore,
dispatch_time(DISPATCH_TIME_NOW, [transactionTimeout integerValue] * 1000000));

return self->transactionResults[transactionId];
}
return self->transactionResults[transactionId];
}
completion:^(id transactionResult, NSError *error) {
if (error != nil) {
result([FlutterError errorWithCode:[NSString stringWithFormat:@"%ld", error.code]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import <Flutter/Flutter.h>

@interface CloudFunctionsPlugin : NSObject<FlutterPlugin>
@interface CloudFunctionsPlugin : NSObject <FlutterPlugin>
@end
5 changes: 3 additions & 2 deletions packages/cloud_functions/ios/Classes/CloudFunctionsPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
message:@"Firebase function failed with exception."
details:details];
} else {
flutterError =
[FlutterError errorWithCode:nil message:error.localizedDescription details:nil];
flutterError = [FlutterError errorWithCode:nil
message:error.localizedDescription
details:nil];
}
result(flutterError);
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/connectivity/ios/Classes/ConnectivityPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

#import <Flutter/Flutter.h>

@interface FLTConnectivityPlugin : NSObject<FlutterPlugin>
@interface FLTConnectivityPlugin : NSObject <FlutterPlugin>
@end
2 changes: 1 addition & 1 deletion packages/connectivity/ios/Classes/ConnectivityPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#import "SystemConfiguration/CaptiveNetwork.h"

@interface FLTConnectivityPlugin ()<FlutterStreamHandler>
@interface FLTConnectivityPlugin () <FlutterStreamHandler>
@end

@implementation FLTConnectivityPlugin {
Expand Down
2 changes: 1 addition & 1 deletion packages/device_info/ios/Classes/DeviceInfoPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

#import <Flutter/Flutter.h>

@interface FLTDeviceInfoPlugin : NSObject<FlutterPlugin>
@interface FLTDeviceInfoPlugin : NSObject <FlutterPlugin>
@end
4 changes: 2 additions & 2 deletions packages/firebase_admob/ios/Classes/FLTMobileAd.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ typedef enum : NSUInteger {
- (void)dispose;
@end

@interface FLTBannerAd : FLTMobileAd<GADBannerViewDelegate>
@interface FLTBannerAd : FLTMobileAd <GADBannerViewDelegate>
+ (instancetype)withId:(NSNumber *)mobileAdId
adSize:(GADAdSize)adSize
channel:(FlutterMethodChannel *)channel;
@end

@interface FLTInterstitialAd : FLTMobileAd<GADInterstitialDelegate>
@interface FLTInterstitialAd : FLTMobileAd <GADInterstitialDelegate>
+ (instancetype)withId:(NSNumber *)mobileAdId channel:(FlutterMethodChannel *)channel;
@end
4 changes: 2 additions & 2 deletions packages/firebase_admob/ios/Classes/FLTRequestFactory.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ - (GADRequest *)createRequest {
request.requestAgent = requestAgent;
}

NSNumber *nonPersonalizedAds =
[self targetingInfoBoolForKey:@"nonPersonalizedAds" info:_targetingInfo];
NSNumber *nonPersonalizedAds = [self targetingInfoBoolForKey:@"nonPersonalizedAds"
info:_targetingInfo];
if (nonPersonalizedAds != nil && [nonPersonalizedAds boolValue]) {
GADExtras *extras = [[GADExtras alloc] init];
extras.additionalParameters = @{@"npa" : @"1"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

static NSDictionary *rewardedStatusToString = nil;

@interface FLTRewardedVideoAdWrapper ()<GADRewardBasedVideoAdDelegate>
@interface FLTRewardedVideoAdWrapper () <GADRewardBasedVideoAdDelegate>
@end

@implementation FLTRewardedVideoAdWrapper
Expand Down
5 changes: 2 additions & 3 deletions packages/firebase_admob/ios/Classes/FirebaseAdMobPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

#import <Flutter/Flutter.h>

#define FLTLogWarning(format, ...) \
NSLog((@"FirebaseAdMobPlugin <warning> " format), ##__VA_ARGS__)
#define FLTLogWarning(format, ...) NSLog((@"FirebaseAdMobPlugin <warning> " format), ##__VA_ARGS__)

@interface FLTFirebaseAdMobPlugin : NSObject<FlutterPlugin>
@interface FLTFirebaseAdMobPlugin : NSObject <FlutterPlugin>
@end
7 changes: 3 additions & 4 deletions packages/firebase_admob/ios/Classes/FirebaseAdMobPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,9 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result

NSNumber *mobileAdId = (NSNumber *)call.arguments[@"id"];
if (mobileAdId == nil) {
NSString *message =
@"FirebaseAdMobPlugin method calls for banners and "
@"interstitials must specify an "
@"integer mobile ad id";
NSString *message = @"FirebaseAdMobPlugin method calls for banners and "
@"interstitials must specify an "
@"integer mobile ad id";
result([FlutterError errorWithCode:@"no_id" message:message details:nil]);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_analytics/ios/Classes/FirebaseAnalyticsPlugin.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

#import <Flutter/Flutter.h>

@interface FLTFirebaseAnalyticsPlugin : NSObject<FlutterPlugin>
@interface FLTFirebaseAnalyticsPlugin : NSObject <FlutterPlugin>
@end
2 changes: 1 addition & 1 deletion packages/firebase_auth/ios/Classes/FirebaseAuthPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

#import <Flutter/Flutter.h>

@interface FLTFirebaseAuthPlugin : NSObject<FlutterPlugin>
@interface FLTFirebaseAuthPlugin : NSObject <FlutterPlugin>
@end
Loading

0 comments on commit eaa1388

Please sign in to comment.