Skip to content

Commit 1d9bb05

Browse files
authored
Fix AppCheck Catalyst build on Xcode 12.4 (#8184)
1 parent acf106a commit 1d9bb05

File tree

7 files changed

+28
-5
lines changed

7 files changed

+28
-5
lines changed

.github/workflows/app_check.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ jobs:
2222
- name: FirebaseAppCheck
2323
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseAppCheck.podspec --platforms=${{ matrix.target }}
2424

25+
catalyst:
26+
# Don't run on private repo unless it is a PR.
27+
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
28+
runs-on: macOS-latest
29+
steps:
30+
- uses: actions/checkout@v2
31+
- name: Setup Bundler
32+
run: scripts/setup_bundler.sh
33+
- name: Setup project and Build for Catalyst
34+
run: scripts/test_catalyst.sh FirebaseAppCheck test FirebaseAppCheck-Unit-unit
35+
2536
diagnostics:
2637
# Don't run on private repo unless it is a PR.
2738
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'

FirebaseAppCheck/Sources/AppAttestProvider/DCAppAttestService+FIRAppAttestService.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
// Currently DCAppAttestService is available on iOS only.
18-
#if TARGET_OS_IOS
18+
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST // Catalyst should be possible with Xcode 12.5+
1919

2020
#import <DeviceCheck/DeviceCheck.h>
2121

@@ -31,4 +31,4 @@ API_UNAVAILABLE(macos, tvos, watchos)
3131

3232
NS_ASSUME_NONNULL_END
3333

34-
#endif // TARGET_OS_IOS
34+
#endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST

FirebaseAppCheck/Sources/AppAttestProvider/FIRAppAttestProvider.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ - (instancetype)initWithAppAttestService:(id<FIRAppAttestService>)appAttestServi
132132
}
133133

134134
- (nullable instancetype)initWithApp:(FIRApp *)app {
135-
#if TARGET_OS_IOS
135+
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST // Catalyst should be possible with Xcode 12.5+
136136
NSURLSession *URLSession = [NSURLSession
137137
sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration]];
138138

@@ -159,9 +159,9 @@ - (nullable instancetype)initWithApp:(FIRApp *)app {
159159
APIService:appAttestAPIService
160160
keyIDStorage:keyIDStorage
161161
artifactStorage:artifactStorage];
162-
#else // TARGET_OS_IOS
162+
#else // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
163163
return nil;
164-
#endif // TARGET_OS_IOS
164+
#endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
165165
}
166166

167167
#pragma mark - FIRAppCheckProvider

FirebaseAppCheck/Tests/Unit/AppAttestProvider/FIRAppAttestProviderTests.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ - (void)tearDown {
9292

9393
#pragma mark - Init tests
9494

95+
#if !TARGET_OS_MACCATALYST // Catalyst should be possible with Xcode 12.5+
96+
// Keychain dependent logic require additional configuration on Catalyst (enabling Keychain
97+
// sharing). For now, keychain dependent tests are disabled for Catalyst.
9598
- (void)testInitWithValidApp {
9699
FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:@"app_id" GCMSenderID:@"sender_id"];
97100
options.APIKey = @"api_key";
@@ -100,6 +103,7 @@ - (void)testInitWithValidApp {
100103

101104
XCTAssertNotNil([[FIRAppAttestProvider alloc] initWithApp:app]);
102105
}
106+
#endif // !TARGET_OS_MACCATALYST
103107

104108
#pragma mark - Initial handshake (attestation)
105109

FirebaseAppCheck/Tests/Unit/AppAttestProvider/Storage/FIRAppAttestArtifactStorageTests.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ - (void)tearDown {
4646
[super tearDown];
4747
}
4848

49+
#if !TARGET_OS_MACCATALYST // Catalyst should be possible with Xcode 12.5+
50+
4951
- (void)testSetAndGetArtifact {
5052
[self assertSetGetForStorage];
5153
}
@@ -185,5 +187,6 @@ - (void)assertIndependentSetGetForStoragesWithAppName1:(NSString *)appName1
185187
[storage2 setArtifact:nil forKey:keyID];
186188
XCTAssert(FBLWaitForPromisesWithTimeout(0.5));
187189
}
190+
#endif // !TARGET_OS_MACCATALYST
188191

189192
@end

FirebaseAppCheck/Tests/Unit/Core/FIRAppCheckIntegrationTests.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ - (void)testDefaultAppCheckProvider {
125125
}
126126
}
127127

128+
#if !TARGET_OS_MACCATALYST // Catalyst should be possible with Xcode 12.5+
128129
- (void)testSetAppCheckProviderFactoryWithDefaultApp {
129130
NSString *appName = kFIRDefaultAppName;
130131

@@ -168,6 +169,7 @@ - (void)testSetAppCheckProviderFactoryWithDefaultApp {
168169
OCMVerifyAll(self.mockProviderFactory);
169170
OCMVerifyAll(self.mockAppCheckProvider);
170171
}
172+
#endif // !TARGET_OS_MACCATALYST
171173

172174
#pragma mark - Helpers
173175

FirebaseAppCheck/Tests/Unit/Core/FIRAppCheckStorageTests.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ - (void)tearDown {
4545
[super tearDown];
4646
}
4747

48+
#if !TARGET_OS_MACCATALYST // Catalyst should be possible with Xcode 12.5+
49+
4850
- (void)testSetAndGetToken {
4951
FIRAppCheckToken *tokenToStore = [[FIRAppCheckToken alloc] initWithToken:@"token"
5052
expirationDate:[NSDate distantPast]];
@@ -93,5 +95,6 @@ - (void)testSetTokenPerApp {
9395
XCTAssertNil(getPromise.value);
9496
XCTAssertNil(getPromise.error);
9597
}
98+
#endif // !TARGET_OS_MACCATALYST
9699

97100
@end

0 commit comments

Comments
 (0)