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 committed Nov 20, 2018
1 parent 30d2512 commit 4525f7b
Show file tree
Hide file tree
Showing 28 changed files with 177 additions and 169 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 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
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
97 changes: 52 additions & 45 deletions packages/firebase_auth/ios/Classes/FirebaseAuthPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
} else if ([@"signInWithGoogle" isEqualToString:call.method]) {
NSString *idToken = call.arguments[@"idToken"];
NSString *accessToken = call.arguments[@"accessToken"];
FIRAuthCredential *credential =
[FIRGoogleAuthProvider credentialWithIDToken:idToken accessToken:accessToken];
FIRAuthCredential *credential = [FIRGoogleAuthProvider credentialWithIDToken:idToken
accessToken:accessToken];
[[self getAuth:call.arguments] signInWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
[self sendResult:result forUser:user error:error];
Expand All @@ -95,8 +95,8 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
} else if ([@"signInWithTwitter" isEqualToString:call.method]) {
NSString *authToken = call.arguments[@"authToken"];
NSString *authTokenSecret = call.arguments[@"authTokenSecret"];
FIRAuthCredential *credential =
[FIRTwitterAuthProvider credentialWithToken:authToken secret:authTokenSecret];
FIRAuthCredential *credential = [FIRTwitterAuthProvider credentialWithToken:authToken
secret:authTokenSecret];
[[self getAuth:call.arguments] signInWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
[self sendResult:result forUser:user error:error];
Expand Down Expand Up @@ -139,11 +139,12 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
}];
} else if ([@"sendPasswordResetEmail" isEqualToString:call.method]) {
NSString *email = call.arguments[@"email"];
[[self getAuth:call.arguments]
sendPasswordResetWithEmail:email
completion:^(NSError *error) {
[self sendResult:result forUser:nil error:error];
}];
[[self getAuth:call.arguments] sendPasswordResetWithEmail:email
completion:^(NSError *error) {
[self sendResult:result
forUser:nil
error:error];
}];
} else if ([@"signInWithEmailAndPassword" isEqualToString:call.method]) {
NSString *email = call.arguments[@"email"];
NSString *password = call.arguments[@"password"];
Expand Down Expand Up @@ -171,49 +172,54 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
} else if ([@"linkWithEmailAndPassword" isEqualToString:call.method]) {
NSString *email = call.arguments[@"email"];
NSString *password = call.arguments[@"password"];
FIRAuthCredential *credential =
[FIREmailAuthProvider credentialWithEmail:email password:password];
[[self getAuth:call.arguments].currentUser
linkWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
[self sendResult:result forUser:user error:error];
}];
FIRAuthCredential *credential = [FIREmailAuthProvider credentialWithEmail:email
password:password];
[[self getAuth:call.arguments].currentUser linkWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
[self sendResult:result
forUser:user
error:error];
}];
} else if ([@"linkWithGoogleCredential" isEqualToString:call.method]) {
NSString *idToken = call.arguments[@"idToken"];
NSString *accessToken = call.arguments[@"accessToken"];
FIRAuthCredential *credential =
[FIRGoogleAuthProvider credentialWithIDToken:idToken accessToken:accessToken];
[[self getAuth:call.arguments].currentUser
linkWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
[self sendResult:result forUser:user error:error];
}];
FIRAuthCredential *credential = [FIRGoogleAuthProvider credentialWithIDToken:idToken
accessToken:accessToken];
[[self getAuth:call.arguments].currentUser linkWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
[self sendResult:result
forUser:user
error:error];
}];
} else if ([@"linkWithFacebookCredential" isEqualToString:call.method]) {
NSString *accessToken = call.arguments[@"accessToken"];
FIRAuthCredential *credential = [FIRFacebookAuthProvider credentialWithAccessToken:accessToken];
[[self getAuth:call.arguments].currentUser
linkWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
[self sendResult:result forUser:user error:error];
}];
[[self getAuth:call.arguments].currentUser linkWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
[self sendResult:result
forUser:user
error:error];
}];
} else if ([@"linkWithTwitterCredential" isEqualToString:call.method]) {
NSString *authToken = call.arguments[@"authToken"];
NSString *authTokenSecret = call.arguments[@"authTokenSecret"];
FIRAuthCredential *credential =
[FIRTwitterAuthProvider credentialWithToken:authToken secret:authTokenSecret];
[[self getAuth:call.arguments].currentUser
linkWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
[self sendResult:result forUser:user error:error];
}];
FIRAuthCredential *credential = [FIRTwitterAuthProvider credentialWithToken:authToken
secret:authTokenSecret];
[[self getAuth:call.arguments].currentUser linkWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
[self sendResult:result
forUser:user
error:error];
}];
} else if ([@"linkWithGithubCredential" isEqualToString:call.method]) {
NSString *token = call.arguments[@"token"];
FIRAuthCredential *credential = [FIRGitHubAuthProvider credentialWithToken:token];
[[self getAuth:call.arguments].currentUser
linkWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
[self sendResult:result forUser:user error:error];
}];
[[self getAuth:call.arguments].currentUser linkWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
[self sendResult:result
forUser:user
error:error];
}];
} else if ([@"updateEmail" isEqualToString:call.method]) {
NSString *email = call.arguments[@"email"];
[[self getAuth:call.arguments].currentUser updateEmail:email
Expand All @@ -222,11 +228,12 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
}];
} else if ([@"updatePassword" isEqualToString:call.method]) {
NSString *password = call.arguments[@"password"];
[[self getAuth:call.arguments].currentUser
updatePassword:password
completion:^(NSError *error) {
[self sendResult:result forUser:nil error:error];
}];
[[self getAuth:call.arguments].currentUser updatePassword:password
completion:^(NSError *error) {
[self sendResult:result
forUser:nil
error:error];
}];
} else if ([@"updateProfile" isEqualToString:call.method]) {
FIRUserProfileChangeRequest *changeRequest =
[[self getAuth:call.arguments].currentUser profileChangeRequest];
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_core/ios/Classes/FirebaseCorePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

#import <Flutter/Flutter.h>

@interface FLTFirebaseCorePlugin : NSObject<FlutterPlugin>
@interface FLTFirebaseCorePlugin : NSObject <FlutterPlugin>
@end
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#import <Flutter/Flutter.h>

@interface FLTFirebaseDatabasePlugin : NSObject<FlutterPlugin>
@interface FLTFirebaseDatabasePlugin : NSObject <FlutterPlugin>

@property(nonatomic) NSMutableDictionary *updatedSnapshots;

Expand Down

0 comments on commit 4525f7b

Please sign in to comment.