-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Split GoogleUtilities from FirebaseCore #1370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 48 commits
03676a5
22f72f8
d9c9a08
958cde6
c06da6c
3c2c4a6
001a21f
94be7d2
9509e41
49c1f64
ef909e2
253e4bf
cb29d53
23e830c
96c7363
ca7ca3e
ea4d3f2
ab81c54
abf110c
f1bfad2
6562098
bedc87a
0e3e504
ed43b69
dc9e6f0
fe777a9
3b83363
fd568e0
11ed49f
e8fd9e7
e1555da
ce59ba2
6d49931
e022441
970f8c3
739e6c0
a123f6e
9c8f282
74d74bf
4bc7166
640550b
df4c242
bce3438
aa2f13f
1592bf9
9c26db1
988aee0
c2e9973
aeb878b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,50 +52,60 @@ jobs: | |
- stage: test | ||
env: | ||
- PROJECT=Firebase PLATFORM=iOS METHOD=pod-lib-lint | ||
# Set ALT_SOURCES like the following to continue lint testing until release when Utilities | ||
# or Core APIs change. GoogleUtilities.podspec and FirebaseCore.podspec should be | ||
# manually pushed to a temporary Specs repo. See | ||
# https://guides.cocoapods.org/making/private-cocoapods. | ||
# ALT_SOURCES="[email protected]:paulb777/Specs.git,https://github.com/CocoaPods/Specs.git" | ||
- ALT_SOURCES="--sources=https://github.com/paulb777/Specs.git,https://github.com/CocoaPods/Specs.git" | ||
before_install: | ||
- ./scripts/if_changed.sh ./scripts/install_prereqs.sh | ||
script: | ||
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseCore.podspec | ||
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseAuth.podspec | ||
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseDatabase.podspec | ||
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseMessaging.podspec | ||
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseStorage.podspec | ||
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseFunctions.podspec | ||
- ./scripts/if_changed.sh bundle exec pod lib lint GoogleUtilities.podspec | ||
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseCore.podspec $ALT_SOURCES | ||
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseAuth.podspec $ALT_SOURCES | ||
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseDatabase.podspec $ALT_SOURCES | ||
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseMessaging.podspec $ALT_SOURCES | ||
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseStorage.podspec $ALT_SOURCES | ||
- ./scripts/if_changed.sh bundle exec pod lib lint FirebaseFunctions.podspec $ALT_SOURCES | ||
|
||
- stage: test | ||
env: | ||
- PROJECT=Firestore PLATFORM=iOS METHOD=pod-lib-lint | ||
- ALT_SOURCES="--sources=https://github.com/paulb777/Specs.git,https://github.com/CocoaPods/Specs.git" | ||
before_install: | ||
- ./scripts/if_changed.sh ./scripts/install_prereqs.sh | ||
script: | ||
# Eliminate the one warning from BoringSSL when CocoaPods 1.6.0 is available. | ||
# The travis_wait is necessary because the command takes more than 10 minutes. | ||
- travis_wait ./scripts/if_changed.sh bundle exec pod lib lint FirebaseFirestore.podspec --allow-warnings --no-subspecs | ||
- travis_wait ./scripts/if_changed.sh bundle exec pod lib lint FirebaseFirestore.podspec --allow-warnings --no-subspecs $ALT_SOURCES | ||
|
||
# pod lib lint to check build and warnings for static library build - only on cron jobs | ||
- stage: test | ||
env: | ||
- PROJECT=Firebase PLATFORM=iOS METHOD=pod-lib-lint | ||
- ALT_SOURCES="--sources=https://github.com/paulb777/Specs.git,https://github.com/CocoaPods/Specs.git" | ||
before_install: | ||
- ./scripts/if_cron.sh ./scripts/install_prereqs.sh | ||
script: | ||
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseCore.podspec --use-libraries | ||
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseAuth.podspec --use-libraries | ||
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseDatabase.podspec --use-libraries | ||
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseCore.podspec --use-libraries $ALT_SOURCES | ||
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseAuth.podspec --use-libraries $ALT_SOURCES | ||
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseDatabase.podspec --use-libraries $ALT_SOURCES | ||
# The Protobuf dependency of FirebaseMessaging has warnings with --use-libraries | ||
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseMessaging.podspec --use-libraries --allow-warnings | ||
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseStorage.podspec --use-libraries | ||
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseFunctions.podspec --use-libraries | ||
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseMessaging.podspec --use-libraries --allow-warnings $ALT_SOURCES | ||
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseStorage.podspec --use-libraries $ALT_SOURCES | ||
- ./scripts/if_cron.sh bundle exec pod lib lint FirebaseFunctions.podspec --use-libraries $ALT_SOURCES | ||
|
||
- stage: test | ||
env: | ||
- PROJECT=Firestore PLATFORM=iOS METHOD=pod-lib-lint | ||
- ALT_SOURCES="--sources=https://github.com/paulb777/Specs.git,https://github.com/CocoaPods/Specs.git" | ||
before_install: | ||
- ./scripts/if_cron.sh ./scripts/install_prereqs.sh | ||
script: | ||
# TBD - non-portable path warnings | ||
# The travis_wait is necessary because the command takes more than 10 minutes. | ||
- travis_wait ./scripts/if_cron.sh bundle exec pod lib lint FirebaseFirestore.podspec --use-libraries --allow-warnings --no-subspecs | ||
- travis_wait ./scripts/if_cron.sh bundle exec pod lib lint FirebaseFirestore.podspec --use-libraries --allow-warnings --no-subspecs $ALT_SOURCES | ||
|
||
# Alternative platforms | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,17 +15,17 @@ | |
#import <Foundation/Foundation.h> | ||
#import <XCTest/XCTest.h> | ||
|
||
#import <FirebaseCore/FIRAppEnvironmentUtil.h> | ||
#import <GoogleUtilities/GULAppEnvironmentUtil.h> | ||
|
||
#import "FIRTestCase.h" | ||
|
||
@interface FIRAppEnvironmentUtilTest : FIRTestCase | ||
@interface GULAppEnvironmentUtilTest : FIRTestCase | ||
|
||
@property(nonatomic) id processInfoMock; | ||
|
||
@end | ||
|
||
@implementation FIRAppEnvironmentUtilTest | ||
@implementation GULAppEnvironmentUtilTest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this test move along with the sources? This comment applies both here and to the other tests in Core in this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep. The tests will be factored out in a subsequent PR. |
||
|
||
- (void)setUp { | ||
[super setUp]; | ||
|
@@ -43,21 +43,21 @@ - (void)testSystemVersionInfoMajorOnly { | |
NSOperatingSystemVersion osTen = {.majorVersion = 10, .minorVersion = 0, .patchVersion = 0}; | ||
OCMStub([self.processInfoMock operatingSystemVersion]).andReturn(osTen); | ||
|
||
XCTAssertTrue([[FIRAppEnvironmentUtil systemVersion] isEqualToString:@"10.0"]); | ||
XCTAssertTrue([[GULAppEnvironmentUtil systemVersion] isEqualToString:@"10.0"]); | ||
} | ||
|
||
- (void)testSystemVersionInfoMajorMinor { | ||
NSOperatingSystemVersion osTenTwo = {.majorVersion = 10, .minorVersion = 2, .patchVersion = 0}; | ||
OCMStub([self.processInfoMock operatingSystemVersion]).andReturn(osTenTwo); | ||
|
||
XCTAssertTrue([[FIRAppEnvironmentUtil systemVersion] isEqualToString:@"10.2"]); | ||
XCTAssertTrue([[GULAppEnvironmentUtil systemVersion] isEqualToString:@"10.2"]); | ||
} | ||
|
||
- (void)testSystemVersionInfoMajorMinorPatch { | ||
NSOperatingSystemVersion osTenTwoOne = {.majorVersion = 10, .minorVersion = 2, .patchVersion = 1}; | ||
OCMStub([self.processInfoMock operatingSystemVersion]).andReturn(osTenTwoOne); | ||
|
||
XCTAssertTrue([[FIRAppEnvironmentUtil systemVersion] isEqualToString:@"10.2.1"]); | ||
XCTAssertTrue([[GULAppEnvironmentUtil systemVersion] isEqualToString:@"10.2.1"]); | ||
} | ||
|
||
@end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,27 +17,30 @@ | |
|
||
#import "FIRTestCase.h" | ||
|
||
// TODO - FIRLoggerTest should be split into a separate FIRLoggerTest and GULLoggerTest. | ||
// No test should include both includes. | ||
#import <FirebaseCore/FIRLogger.h> | ||
#import <GoogleUtilities/GULLogger.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't seem like anything should import both FIRLogger and GULLogger. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. Adding a TODO comment to split FIRLoggerTest from GULLoggerTest. |
||
|
||
#import <asl.h> | ||
|
||
// The following constants are exposed from FIRLogger for unit tests. | ||
extern NSString *const kFIRDisableDebugModeApplicationArgument; | ||
extern NSString *const kFIREnableDebugModeApplicationArgument; | ||
|
||
extern NSString *const kFIRPersistedDebugModeKey; | ||
extern NSString *const kGULPersistedDebugModeKey; | ||
|
||
extern const char *kFIRLoggerASLClientFacilityName; | ||
extern const char *kGULLoggerASLClientFacilityName; | ||
|
||
extern void FIRResetLogger(void); | ||
|
||
extern void FIRSetLoggerUserDefaults(NSUserDefaults *defaults); | ||
|
||
extern aslclient getFIRLoggerClient(void); | ||
extern aslclient getGULLoggerClient(void); | ||
|
||
extern dispatch_queue_t getFIRClientQueue(void); | ||
extern dispatch_queue_t getGULClientQueue(void); | ||
|
||
extern BOOL getFIRLoggerDebugMode(void); | ||
extern BOOL getGULLoggerDebugMode(void); | ||
|
||
static NSString *const kMessageCode = @"I-COR000001"; | ||
|
||
|
@@ -95,9 +98,11 @@ - (void)testInitializeASLForNonDebugMode { | |
FIRLogError(kFIRLoggerCore, kMessageCode, @"Some error."); | ||
|
||
// Assert. | ||
NSNumber *debugMode = [self.defaults objectForKey:kFIRPersistedDebugModeKey]; | ||
#if MAKE_THREAD_SAFE | ||
NSNumber *debugMode = [self.defaults objectForKey:kGULPersistedDebugModeKey]; | ||
XCTAssertNil(debugMode); | ||
XCTAssertFalse(getFIRLoggerDebugMode()); | ||
XCTAssertFalse(getGULLoggerDebugMode()); | ||
#endif | ||
|
||
// Stop. | ||
[processInfoMock stopMocking]; | ||
|
@@ -112,10 +117,12 @@ - (void)testInitializeASLForDebugModeWithArgument { | |
// Test. | ||
FIRLogError(kFIRLoggerCore, kMessageCode, @"Some error."); | ||
|
||
#ifdef MAKE_THREAD_SAFE | ||
// Assert. | ||
NSNumber *debugMode = [self.defaults objectForKey:kFIRPersistedDebugModeKey]; | ||
NSNumber *debugMode = [self.defaults objectForKey:kGULPersistedDebugModeKey]; | ||
XCTAssertTrue(debugMode.boolValue); | ||
XCTAssertTrue(getFIRLoggerDebugMode()); | ||
XCTAssertTrue(getGULLoggerDebugMode()); | ||
#endif | ||
|
||
// Stop. | ||
[processInfoMock stopMocking]; | ||
|
@@ -124,15 +131,17 @@ - (void)testInitializeASLForDebugModeWithArgument { | |
- (void)testInitializeASLForDebugModeWithUserDefaults { | ||
// Stub. | ||
NSNumber *debugMode = @YES; | ||
[self.defaults setBool:debugMode.boolValue forKey:kFIRPersistedDebugModeKey]; | ||
[self.defaults setBool:debugMode.boolValue forKey:kGULPersistedDebugModeKey]; | ||
|
||
// Test. | ||
FIRLogError(kFIRLoggerCore, kMessageCode, @"Some error."); | ||
|
||
// Assert. | ||
debugMode = [self.defaults objectForKey:kFIRPersistedDebugModeKey]; | ||
debugMode = [self.defaults objectForKey:kGULPersistedDebugModeKey]; | ||
XCTAssertTrue(debugMode.boolValue); | ||
XCTAssertTrue(getFIRLoggerDebugMode()); | ||
#if MAKE_THREAD_SAFE | ||
XCTAssertTrue(getGULLoggerDebugMode()); | ||
#endif | ||
} | ||
|
||
- (void)testMessageCodeFormat { | ||
|
@@ -240,7 +249,7 @@ - (BOOL)logExists { | |
|
||
- (void)drainFIRClientQueue { | ||
dispatch_semaphore_t workerSemaphore = dispatch_semaphore_create(0); | ||
dispatch_async(getFIRClientQueue(), ^{ | ||
dispatch_async(getGULClientQueue(), ^{ | ||
dispatch_semaphore_signal(workerSemaphore); | ||
}); | ||
dispatch_semaphore_wait(workerSemaphore, DISPATCH_TIME_FOREVER); | ||
|
@@ -250,8 +259,8 @@ - (BOOL)messageWasLogged:(NSString *)message { | |
#pragma clang diagnostic push | ||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" | ||
aslmsg query = asl_new(ASL_TYPE_QUERY); | ||
asl_set_query(query, ASL_KEY_FACILITY, kFIRLoggerASLClientFacilityName, ASL_QUERY_OP_EQUAL); | ||
aslresponse r = asl_search(getFIRLoggerClient(), query); | ||
asl_set_query(query, ASL_KEY_FACILITY, kGULLoggerASLClientFacilityName, ASL_QUERY_OP_EQUAL); | ||
aslresponse r = asl_search(getGULLoggerClient(), query); | ||
asl_free(query); | ||
aslmsg m; | ||
const char *val; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this eventually just be moved to a GoogleUtilities test suite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The tests will be factored out in a subsequent PR.