Skip to content

Commit 98b6eef

Browse files
authored
Split GoogleUtilities from FirebaseCore (#1370)
1 parent a3f792f commit 98b6eef

File tree

60 files changed

+1541
-817
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1541
-817
lines changed

.travis.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,50 +52,60 @@ jobs:
5252
- stage: test
5353
env:
5454
- PROJECT=Firebase PLATFORM=iOS METHOD=pod-lib-lint
55+
# Set ALT_SOURCES like the following to continue lint testing until release when Utilities
56+
# or Core APIs change. GoogleUtilities.podspec and FirebaseCore.podspec should be
57+
# manually pushed to a temporary Specs repo. See
58+
# https://guides.cocoapods.org/making/private-cocoapods.
59+
# ALT_SOURCES="[email protected]:paulb777/Specs.git,https://github.com/CocoaPods/Specs.git"
60+
- ALT_SOURCES="--sources=https://github.com/paulb777/Specs.git,https://github.com/CocoaPods/Specs.git"
5561
before_install:
5662
- ./scripts/if_changed.sh ./scripts/install_prereqs.sh
5763
script:
58-
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseCore.podspec
59-
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseAuth.podspec
60-
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseDatabase.podspec
61-
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseMessaging.podspec
62-
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseStorage.podspec
63-
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseFunctions.podspec
64+
- ./scripts/if_changed.sh bundle exec pod lib lint GoogleUtilities.podspec
65+
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseCore.podspec $ALT_SOURCES
66+
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseAuth.podspec $ALT_SOURCES
67+
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseDatabase.podspec $ALT_SOURCES
68+
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseMessaging.podspec $ALT_SOURCES
69+
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseStorage.podspec $ALT_SOURCES
70+
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseFunctions.podspec $ALT_SOURCES
6471

6572
- stage: test
6673
env:
6774
- PROJECT=Firestore PLATFORM=iOS METHOD=pod-lib-lint
75+
- ALT_SOURCES="--sources=https://github.com/paulb777/Specs.git,https://github.com/CocoaPods/Specs.git"
6876
before_install:
6977
- ./scripts/if_changed.sh ./scripts/install_prereqs.sh
7078
script:
7179
# Eliminate the one warning from BoringSSL when CocoaPods 1.6.0 is available.
7280
# The travis_wait is necessary because the command takes more than 10 minutes.
73-
- travis_wait ./scripts/if_changed.sh bundle exec pod lib lint FirebaseFirestore.podspec --allow-warnings --no-subspecs
81+
- travis_wait ./scripts/if_changed.sh bundle exec pod lib lint FirebaseFirestore.podspec --allow-warnings --no-subspecs $ALT_SOURCES
7482

7583
# pod lib lint to check build and warnings for static library build - only on cron jobs
7684
- stage: test
7785
env:
7886
- PROJECT=Firebase PLATFORM=iOS METHOD=pod-lib-lint
87+
- ALT_SOURCES="--sources=https://github.com/paulb777/Specs.git,https://github.com/CocoaPods/Specs.git"
7988
before_install:
8089
- ./scripts/if_cron.sh ./scripts/install_prereqs.sh
8190
script:
82-
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseCore.podspec --use-libraries
83-
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseAuth.podspec --use-libraries
84-
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseDatabase.podspec --use-libraries
91+
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseCore.podspec --use-libraries $ALT_SOURCES
92+
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseAuth.podspec --use-libraries $ALT_SOURCES
93+
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseDatabase.podspec --use-libraries $ALT_SOURCES
8594
# The Protobuf dependency of FirebaseMessaging has warnings with --use-libraries
86-
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseMessaging.podspec --use-libraries --allow-warnings
87-
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseStorage.podspec --use-libraries
88-
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseFunctions.podspec --use-libraries
95+
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseMessaging.podspec --use-libraries --allow-warnings $ALT_SOURCES
96+
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseStorage.podspec --use-libraries $ALT_SOURCES
97+
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseFunctions.podspec --use-libraries $ALT_SOURCES
8998

9099
- stage: test
91100
env:
92101
- PROJECT=Firestore PLATFORM=iOS METHOD=pod-lib-lint
102+
- ALT_SOURCES="--sources=https://github.com/paulb777/Specs.git,https://github.com/CocoaPods/Specs.git"
93103
before_install:
94104
- ./scripts/if_cron.sh ./scripts/install_prereqs.sh
95105
script:
96106
# TBD - non-portable path warnings
97107
# The travis_wait is necessary because the command takes more than 10 minutes.
98-
- travis_wait ./scripts/if_cron.sh bundle exec pod lib lint FirebaseFirestore.podspec --use-libraries --allow-warnings --no-subspecs
108+
- travis_wait ./scripts/if_cron.sh bundle exec pod lib lint FirebaseFirestore.podspec --use-libraries --allow-warnings --no-subspecs $ALT_SOURCES
99109

100110
# Alternative platforms
101111

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ enable_testing()
5050
# These are ordered by a topological sort on DEPENDS attributes. This is
5151
# required because CMake fails the build if you have a DEPENDS on a target that
5252
# does not exist yet.
53+
include(external/GoogleUtilities)
5354
include(external/FirebaseCore)
5455
include(external/googletest)
5556
include(external/zlib)

Example/Core/Tests/FIRAppEnvironmentUtilTest.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
#import <Foundation/Foundation.h>
1616
#import <XCTest/XCTest.h>
1717

18-
#import <FirebaseCore/FIRAppEnvironmentUtil.h>
18+
#import <GoogleUtilities/GULAppEnvironmentUtil.h>
1919

2020
#import "FIRTestCase.h"
2121

22-
@interface FIRAppEnvironmentUtilTest : FIRTestCase
22+
@interface GULAppEnvironmentUtilTest : FIRTestCase
2323

2424
@property(nonatomic) id processInfoMock;
2525

2626
@end
2727

28-
@implementation FIRAppEnvironmentUtilTest
28+
@implementation GULAppEnvironmentUtilTest
2929

3030
- (void)setUp {
3131
[super setUp];
@@ -43,21 +43,21 @@ - (void)testSystemVersionInfoMajorOnly {
4343
NSOperatingSystemVersion osTen = {.majorVersion = 10, .minorVersion = 0, .patchVersion = 0};
4444
OCMStub([self.processInfoMock operatingSystemVersion]).andReturn(osTen);
4545

46-
XCTAssertTrue([[FIRAppEnvironmentUtil systemVersion] isEqualToString:@"10.0"]);
46+
XCTAssertTrue([[GULAppEnvironmentUtil systemVersion] isEqualToString:@"10.0"]);
4747
}
4848

4949
- (void)testSystemVersionInfoMajorMinor {
5050
NSOperatingSystemVersion osTenTwo = {.majorVersion = 10, .minorVersion = 2, .patchVersion = 0};
5151
OCMStub([self.processInfoMock operatingSystemVersion]).andReturn(osTenTwo);
5252

53-
XCTAssertTrue([[FIRAppEnvironmentUtil systemVersion] isEqualToString:@"10.2"]);
53+
XCTAssertTrue([[GULAppEnvironmentUtil systemVersion] isEqualToString:@"10.2"]);
5454
}
5555

5656
- (void)testSystemVersionInfoMajorMinorPatch {
5757
NSOperatingSystemVersion osTenTwoOne = {.majorVersion = 10, .minorVersion = 2, .patchVersion = 1};
5858
OCMStub([self.processInfoMock operatingSystemVersion]).andReturn(osTenTwoOne);
5959

60-
XCTAssertTrue([[FIRAppEnvironmentUtil systemVersion] isEqualToString:@"10.2.1"]);
60+
XCTAssertTrue([[GULAppEnvironmentUtil systemVersion] isEqualToString:@"10.2.1"]);
6161
}
6262

6363
@end

Example/Core/Tests/FIRLoggerTest.m

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,30 @@
1717

1818
#import "FIRTestCase.h"
1919

20+
// TODO - FIRLoggerTest should be split into a separate FIRLoggerTest and GULLoggerTest.
21+
// No test should include both includes.
2022
#import <FirebaseCore/FIRLogger.h>
23+
#import <GoogleUtilities/GULLogger.h>
2124

2225
#import <asl.h>
2326

2427
// The following constants are exposed from FIRLogger for unit tests.
2528
extern NSString *const kFIRDisableDebugModeApplicationArgument;
2629
extern NSString *const kFIREnableDebugModeApplicationArgument;
2730

28-
extern NSString *const kFIRPersistedDebugModeKey;
31+
extern NSString *const kGULPersistedDebugModeKey;
2932

30-
extern const char *kFIRLoggerASLClientFacilityName;
33+
extern const char *kGULLoggerASLClientFacilityName;
3134

3235
extern void FIRResetLogger(void);
3336

3437
extern void FIRSetLoggerUserDefaults(NSUserDefaults *defaults);
3538

36-
extern aslclient getFIRLoggerClient(void);
39+
extern aslclient getGULLoggerClient(void);
3740

38-
extern dispatch_queue_t getFIRClientQueue(void);
41+
extern dispatch_queue_t getGULClientQueue(void);
3942

40-
extern BOOL getFIRLoggerDebugMode(void);
43+
extern BOOL getGULLoggerDebugMode(void);
4144

4245
static NSString *const kMessageCode = @"I-COR000001";
4346

@@ -95,9 +98,11 @@ - (void)testInitializeASLForNonDebugMode {
9598
FIRLogError(kFIRLoggerCore, kMessageCode, @"Some error.");
9699

97100
// Assert.
98-
NSNumber *debugMode = [self.defaults objectForKey:kFIRPersistedDebugModeKey];
101+
#if MAKE_THREAD_SAFE
102+
NSNumber *debugMode = [self.defaults objectForKey:kGULPersistedDebugModeKey];
99103
XCTAssertNil(debugMode);
100-
XCTAssertFalse(getFIRLoggerDebugMode());
104+
XCTAssertFalse(getGULLoggerDebugMode());
105+
#endif
101106

102107
// Stop.
103108
[processInfoMock stopMocking];
@@ -112,10 +117,12 @@ - (void)testInitializeASLForDebugModeWithArgument {
112117
// Test.
113118
FIRLogError(kFIRLoggerCore, kMessageCode, @"Some error.");
114119

120+
#ifdef MAKE_THREAD_SAFE
115121
// Assert.
116-
NSNumber *debugMode = [self.defaults objectForKey:kFIRPersistedDebugModeKey];
122+
NSNumber *debugMode = [self.defaults objectForKey:kGULPersistedDebugModeKey];
117123
XCTAssertTrue(debugMode.boolValue);
118-
XCTAssertTrue(getFIRLoggerDebugMode());
124+
XCTAssertTrue(getGULLoggerDebugMode());
125+
#endif
119126

120127
// Stop.
121128
[processInfoMock stopMocking];
@@ -124,15 +131,17 @@ - (void)testInitializeASLForDebugModeWithArgument {
124131
- (void)testInitializeASLForDebugModeWithUserDefaults {
125132
// Stub.
126133
NSNumber *debugMode = @YES;
127-
[self.defaults setBool:debugMode.boolValue forKey:kFIRPersistedDebugModeKey];
134+
[self.defaults setBool:debugMode.boolValue forKey:kGULPersistedDebugModeKey];
128135

129136
// Test.
130137
FIRLogError(kFIRLoggerCore, kMessageCode, @"Some error.");
131138

132139
// Assert.
133-
debugMode = [self.defaults objectForKey:kFIRPersistedDebugModeKey];
140+
debugMode = [self.defaults objectForKey:kGULPersistedDebugModeKey];
134141
XCTAssertTrue(debugMode.boolValue);
135-
XCTAssertTrue(getFIRLoggerDebugMode());
142+
#if MAKE_THREAD_SAFE
143+
XCTAssertTrue(getGULLoggerDebugMode());
144+
#endif
136145
}
137146

138147
- (void)testMessageCodeFormat {
@@ -240,7 +249,7 @@ - (BOOL)logExists {
240249

241250
- (void)drainFIRClientQueue {
242251
dispatch_semaphore_t workerSemaphore = dispatch_semaphore_create(0);
243-
dispatch_async(getFIRClientQueue(), ^{
252+
dispatch_async(getGULClientQueue(), ^{
244253
dispatch_semaphore_signal(workerSemaphore);
245254
});
246255
dispatch_semaphore_wait(workerSemaphore, DISPATCH_TIME_FOREVER);
@@ -250,8 +259,8 @@ - (BOOL)messageWasLogged:(NSString *)message {
250259
#pragma clang diagnostic push
251260
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
252261
aslmsg query = asl_new(ASL_TYPE_QUERY);
253-
asl_set_query(query, ASL_KEY_FACILITY, kFIRLoggerASLClientFacilityName, ASL_QUERY_OP_EQUAL);
254-
aslresponse r = asl_search(getFIRLoggerClient(), query);
262+
asl_set_query(query, ASL_KEY_FACILITY, kGULLoggerASLClientFacilityName, ASL_QUERY_OP_EQUAL);
263+
aslresponse r = asl_search(getGULLoggerClient(), query);
255264
asl_free(query);
256265
aslmsg m;
257266
const char *val;

Example/Core/Tests/FIRMutableDictionaryTest.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@
1414

1515
#import "FIRTestCase.h"
1616

17-
#import <FirebaseCore/FIRMutableDictionary.h>
17+
#import <GoogleUtilities/GULMutableDictionary.h>
1818

1919
const static NSString *const kKey = @"testKey1";
2020
const static NSString *const kValue = @"testValue1";
2121
const static NSString *const kKey2 = @"testKey2";
2222
const static NSString *const kValue2 = @"testValue2";
2323

2424
@interface FIRMutableDictionaryTest : FIRTestCase
25-
@property(nonatomic) FIRMutableDictionary *dictionary;
25+
@property(nonatomic) GULMutableDictionary *dictionary;
2626
@end
2727

2828
@implementation FIRMutableDictionaryTest
2929

3030
- (void)setUp {
3131
[super setUp];
32-
self.dictionary = [[FIRMutableDictionary alloc] init];
32+
self.dictionary = [[GULMutableDictionary alloc] init];
3333
}
3434

3535
- (void)tearDown {

0 commit comments

Comments
 (0)