Skip to content

Commit 18e2721

Browse files
authored
Rename GDT core libraries to GDTCOR (#3808)
1 parent 623e821 commit 18e2721

File tree

119 files changed

+2100
-2065
lines changed

Some content is hidden

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

119 files changed

+2100
-2065
lines changed

Example/CoreDiagnostics/Tests/FIRCoreDiagnosticsTest.m

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
#import <FirebaseCoreDiagnosticsInterop/FIRCoreDiagnosticsData.h>
2323
#import <FirebaseCoreDiagnosticsInterop/FIRCoreDiagnosticsInterop.h>
24-
#import <GoogleDataTransport/GDTEvent.h>
25-
#import <GoogleDataTransport/GDTEventDataObject.h>
26-
#import <GoogleDataTransport/GDTTransport.h>
24+
#import <GoogleDataTransport/GDTCOREvent.h>
25+
#import <GoogleDataTransport/GDTCOREventDataObject.h>
26+
#import <GoogleDataTransport/GDTCORTransport.h>
2727
#import <GoogleDataTransportCCTSupport/GDTCCTPrioritizer.h>
2828
#import <GoogleUtilities/GULAppEnvironmentUtil.h>
2929
#import <GoogleUtilities/GULUserDefaults.h>
@@ -47,12 +47,12 @@
4747
@interface FIRCoreDiagnostics : NSObject
4848
// Initialization.
4949
+ (instancetype)sharedInstance;
50-
- (instancetype)initWithTransport:(GDTTransport *)transport
50+
- (instancetype)initWithTransport:(GDTCORTransport *)transport
5151
heartbeatDateStorage:(FIRCoreDiagnosticsDateFileStorage *)heartbeatDateStorage;
5252

5353
// Properties.
5454
@property(nonatomic, readonly) dispatch_queue_t diagnosticsQueue;
55-
@property(nonatomic, readonly) GDTTransport *transport;
55+
@property(nonatomic, readonly) GDTCORTransport *transport;
5656
@property(nonatomic, readonly) FIRCoreDiagnosticsDateFileStorage *heartbeatDateStorage;
5757

5858
// Install string helpers.
@@ -111,7 +111,7 @@ - (instancetype)init {
111111

112112
@end
113113

114-
@interface FIRCoreDiagnosticsLog : NSObject <GDTEventDataObject>
114+
@interface FIRCoreDiagnosticsLog : NSObject <GDTCOREventDataObject>
115115

116116
@property(nonatomic) logs_proto_mobilesdk_ios_ICoreConfiguration config;
117117

@@ -136,9 +136,9 @@ @implementation FIRCoreDiagnosticsTest
136136
- (void)setUp {
137137
[super setUp];
138138

139-
self.mockTransport = OCMClassMock([GDTTransport class]);
139+
self.mockTransport = OCMClassMock([GDTCORTransport class]);
140140
OCMStub([self.mockTransport eventForTransport])
141-
.andReturn([[GDTEvent alloc] initWithMappingID:@"111" target:2]);
141+
.andReturn([[GDTCOREvent alloc] initWithMappingID:@"111" target:2]);
142142

143143
self.mockDateStorage = OCMClassMock([FIRCoreDiagnosticsDateFileStorage class]);
144144
self.diagnostics = [[FIRCoreDiagnostics alloc] initWithTransport:self.mockTransport
@@ -322,8 +322,8 @@ - (void)assertEventSentWithHeartbeat:(BOOL)isHeartbeat {
322322
}
323323

324324
- (void)expectEventToBeSentToTransportWithHeartbeat:(BOOL)isHeartbeat {
325-
id eventValidation = [OCMArg checkWithBlock:^BOOL(GDTEvent *obj) {
326-
XCTAssert([obj isKindOfClass:[GDTEvent class]]);
325+
id eventValidation = [OCMArg checkWithBlock:^BOOL(GDTCOREvent *obj) {
326+
XCTAssert([obj isKindOfClass:[GDTCOREvent class]]);
327327
FIRCoreDiagnosticsLog *dataObject = obj.dataObject;
328328
XCTAssert([dataObject isKindOfClass:[FIRCoreDiagnosticsLog class]]);
329329

Firebase/CoreDiagnostics/FIRCDLibrary/FIRCoreDiagnostics.m

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
#import <objc/runtime.h>
1818
#include <sys/utsname.h>
1919

20-
#import <GoogleDataTransport/GDTConsoleLogger.h>
21-
#import <GoogleDataTransport/GDTEvent.h>
22-
#import <GoogleDataTransport/GDTTargets.h>
23-
#import <GoogleDataTransport/GDTTransport.h>
20+
#import <GoogleDataTransport/GDTCORConsoleLogger.h>
21+
#import <GoogleDataTransport/GDTCOREvent.h>
22+
#import <GoogleDataTransport/GDTCORTargets.h>
23+
#import <GoogleDataTransport/GDTCORTransport.h>
2424

2525
#import <GoogleUtilities/GULAppEnvironmentUtil.h>
2626
#import <GoogleUtilities/GULLogger.h>
@@ -92,7 +92,8 @@
9292
NSString *const kFIRCoreDiagnosticsHeartbeatDateFileName = @"FIREBASE_DIAGNOSTICS_HEARTBEAT_DATE";
9393

9494
/**
95-
* @note This should implement the GDTEventDataObject protocol, but can't because of weak-linking.
95+
* @note This should implement the GDTCOREventDataObject protocol, but can't because of
96+
* weak-linking.
9697
*/
9798
@interface FIRCoreDiagnosticsLog : NSObject
9899

@@ -111,23 +112,23 @@ - (instancetype)initWithConfig:(logs_proto_mobilesdk_ios_ICoreConfiguration)conf
111112
return self;
112113
}
113114

114-
// Provided and required by the GDTEventDataObject protocol.
115+
// Provided and required by the GDTCOREventDataObject protocol.
115116
- (NSData *)transportBytes {
116117
pb_ostream_t sizestream = PB_OSTREAM_SIZING;
117118

118119
// Encode 1 time to determine the size.
119120
if (!pb_encode(&sizestream, logs_proto_mobilesdk_ios_ICoreConfiguration_fields, &_config)) {
120-
GDTLogError(GDTMCETransportBytesError, @"Error in nanopb encoding for size: %s",
121-
PB_GET_ERROR(&sizestream));
121+
GDTCORLogError(GDTCORMCETransportBytesError, @"Error in nanopb encoding for size: %s",
122+
PB_GET_ERROR(&sizestream));
122123
}
123124

124125
// Encode a 2nd time to actually get the bytes from it.
125126
size_t bufferSize = sizestream.bytes_written;
126127
CFMutableDataRef dataRef = CFDataCreateMutable(CFAllocatorGetDefault(), bufferSize);
127128
pb_ostream_t ostream = pb_ostream_from_buffer((void *)CFDataGetBytePtr(dataRef), bufferSize);
128129
if (!pb_encode(&ostream, logs_proto_mobilesdk_ios_ICoreConfiguration_fields, &_config)) {
129-
GDTLogError(GDTMCETransportBytesError, @"Error in nanopb encoding for bytes: %s",
130-
PB_GET_ERROR(&ostream));
130+
GDTCORLogError(GDTCORMCETransportBytesError, @"Error in nanopb encoding for bytes: %s",
131+
PB_GET_ERROR(&ostream));
131132
}
132133
CFDataSetLength(dataRef, ostream.bytes_written);
133134

@@ -149,7 +150,7 @@ @interface FIRCoreDiagnostics : NSObject <FIRCoreDiagnosticsInterop>
149150
@property(nonatomic, readonly) dispatch_queue_t diagnosticsQueue;
150151

151152
/** The transport object used to send data. */
152-
@property(nonatomic, readonly) GDTTransport *transport;
153+
@property(nonatomic, readonly) GDTCORTransport *transport;
153154

154155
/** The storage to store the date of the last sent heartbeat. */
155156
@property(nonatomic, readonly) FIRCoreDiagnosticsDateFileStorage *heartbeatDateStorage;
@@ -170,9 +171,9 @@ + (instancetype)sharedInstance {
170171
}
171172

172173
- (instancetype)init {
173-
GDTTransport *transport = [[GDTTransport alloc] initWithMappingID:@"137"
174-
transformers:nil
175-
target:kGDTTargetCCT];
174+
GDTCORTransport *transport = [[GDTCORTransport alloc] initWithMappingID:@"137"
175+
transformers:nil
176+
target:kGDTCORTargetCCT];
176177

177178
FIRCoreDiagnosticsDateFileStorage *dateStorage = [[FIRCoreDiagnosticsDateFileStorage alloc]
178179
initWithFileURL:[[self class] filePathURLWithName:kFIRCoreDiagnosticsHeartbeatDateFileName]];
@@ -182,11 +183,11 @@ - (instancetype)init {
182183

183184
/** Initializer for unit tests.
184185
*
185-
* @param transport A `GDTTransport` instance which that be used to send event.
186+
* @param transport A `GDTCORTransport` instance which that be used to send event.
186187
* @param heartbeatDateStorage An instanse of date storage to track heartbeat sending.
187188
* @return Returns the initialized `FIRCoreDiagnostics` instance.
188189
*/
189-
- (instancetype)initWithTransport:(GDTTransport *)transport
190+
- (instancetype)initWithTransport:(GDTCORTransport *)transport
190191
heartbeatDateStorage:(FIRCoreDiagnosticsDateFileStorage *)heartbeatDateStorage {
191192
self = [super init];
192193
if (self) {
@@ -374,7 +375,8 @@ void FIRPopulateProtoWithCommonInfoFromApp(logs_proto_mobilesdk_ios_ICoreConfigu
374375
config->has_pod_name = 1;
375376

376377
if (!diagnosticObjects[kFIRCDllAppsCountKey]) {
377-
GDTLogError(GDTMCEGeneralError, @"%@", @"App count is a required value in the data dict.");
378+
GDTCORLogError(GDTCORMCEGeneralError, @"%@",
379+
@"App count is a required value in the data dict.");
378380
}
379381
config->app_count = (int32_t)[diagnosticObjects[kFIRCDllAppsCountKey] integerValue];
380382
config->has_app_count = 1;
@@ -635,8 +637,8 @@ - (void)sendDiagnosticsData:(nonnull id<FIRCoreDiagnosticsData>)diagnosticsData
635637
FIRCoreDiagnosticsLog *log = [[FIRCoreDiagnosticsLog alloc] initWithConfig:icore_config];
636638

637639
// Send the log as a telemetry event.
638-
GDTEvent *event = [self.transport eventForTransport];
639-
event.dataObject = (id<GDTEventDataObject>)log;
640+
GDTCOREvent *event = [self.transport eventForTransport];
641+
event.dataObject = (id<GDTCOREventDataObject>)log;
640642
[self.transport sendTelemetryEvent:event];
641643
});
642644
}

GoogleDataTransport.podspec

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ Shared library for iOS SDK data transport needs.
2525
s.static_framework = true
2626
s.prefix_header_file = false
2727

28-
s.source_files = 'GoogleDataTransport/GDTLibrary/**/*'
29-
s.public_header_files = 'GoogleDataTransport/GDTLibrary/Public/*.h'
30-
s.private_header_files = 'GoogleDataTransport/GDTLibrary/Private/*.h'
28+
s.source_files = 'GoogleDataTransport/GDTCORLibrary/**/*'
29+
s.public_header_files = 'GoogleDataTransport/GDTCORLibrary/Public/*.h'
30+
s.private_header_files = 'GoogleDataTransport/GDTCORLibrary/Private/*.h'
3131

3232
header_search_paths = {
3333
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}/GoogleDataTransport/"'
@@ -39,25 +39,25 @@ Shared library for iOS SDK data transport needs.
3939
'CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY' => 'YES'
4040
}.merge(header_search_paths)
4141

42-
common_test_sources = ['GoogleDataTransport/GDTTests/Common/**/*.{h,m}']
42+
common_test_sources = ['GoogleDataTransport/GDTCORTests/Common/**/*.{h,m}']
4343

4444
# Unit test specs
4545
s.test_spec 'Tests-Unit' do |test_spec|
4646
test_spec.requires_app_host = false
47-
test_spec.source_files = ['GoogleDataTransport/GDTTests/Unit/**/*.{h,m}'] + common_test_sources
47+
test_spec.source_files = ['GoogleDataTransport/GDTCORTests/Unit/**/*.{h,m}'] + common_test_sources
4848
test_spec.pod_target_xcconfig = header_search_paths
4949
end
5050

5151
s.test_spec 'Tests-Lifecycle' do |test_spec|
5252
test_spec.requires_app_host = false
53-
test_spec.source_files = ['GoogleDataTransport/GDTTests/Lifecycle/**/*.{h,m}'] + common_test_sources
53+
test_spec.source_files = ['GoogleDataTransport/GDTCORTests/Lifecycle/**/*.{h,m}'] + common_test_sources
5454
test_spec.pod_target_xcconfig = header_search_paths
5555
end
5656

5757
# Integration test specs
5858
s.test_spec 'Tests-Integration' do |test_spec|
5959
test_spec.requires_app_host = false
60-
test_spec.source_files = ['GoogleDataTransport/GDTTests/Integration/**/*.{h,m}'] + common_test_sources
60+
test_spec.source_files = ['GoogleDataTransport/GDTCORTests/Integration/**/*.{h,m}'] + common_test_sources
6161
test_spec.pod_target_xcconfig = header_search_paths
6262
test_spec.dependency 'GCDWebServer'
6363
end

GoogleDataTransport/CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
- Removes all NSAsserts in favor of custom asserts. (#3747)
33

44
# v1.1.3
5-
- Wrap decoding in GDTUploadCoordinator in a try catch. (#3676)
5+
- Wrap decoding in GDTCORUploadCoordinator in a try catch. (#3676)
66

77
# v1.1.2
88
- Add initial support for iOS 13.
99
- Add initial support for Catalyst.
10-
- Backgrounding in GDTStorage is fixed. (#3623 and #3625)
10+
- Backgrounding in GDTCORStorage is fixed. (#3623 and #3625)
1111

1212
# v1.1.1
13-
- Fixes a crash in GDTUploadPackage and GDTStorage. (#3547)
13+
- Fixes a crash in GDTCORUploadPackage and GDTCORStorage. (#3547)
1414

1515
# v1.1.0
1616
- Remove almost all NSAsserts and NSCAsserts for a better development

GoogleDataTransport/GDTLibrary/GDTAssert.m renamed to GoogleDataTransport/GDTCORLibrary/GDTCORAssert.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
* limitations under the License.
1515
*/
1616

17-
#import "GDTLibrary/Public/GDTAssert.h"
17+
#import "GDTCORLibrary/Public/GDTCORAssert.h"
1818

19-
GDTAssertionBlock GDTAssertionBlockToRunInstead(void) {
19+
GDTCORAssertionBlock GDTCORAssertionBlockToRunInstead(void) {
2020
// This class is only compiled in by unit tests, and this should fail quickly in optimized builds.
21-
Class GDTAssertClass = NSClassFromString(@"GDTAssertHelper");
22-
if (__builtin_expect(!!GDTAssertClass, 0)) {
21+
Class GDTCORAssertClass = NSClassFromString(@"GDTCORAssertHelper");
22+
if (__builtin_expect(!!GDTCORAssertClass, 0)) {
2323
SEL assertionBlockSEL = NSSelectorFromString(@"assertionBlock");
2424
if (assertionBlockSEL) {
25-
IMP assertionBlockIMP = [GDTAssertClass methodForSelector:assertionBlockSEL];
25+
IMP assertionBlockIMP = [GDTCORAssertClass methodForSelector:assertionBlockSEL];
2626
if (assertionBlockIMP) {
27-
GDTAssertionBlock assertionBlock =
28-
((GDTAssertionBlock(*)(id, SEL))assertionBlockIMP)(GDTAssertClass, assertionBlockSEL);
27+
GDTCORAssertionBlock assertionBlock = ((GDTCORAssertionBlock(*)(id, SEL))assertionBlockIMP)(
28+
GDTCORAssertClass, assertionBlockSEL);
2929
if (assertionBlock) {
3030
return assertionBlock;
3131
}

GoogleDataTransport/GDTLibrary/GDTClock.m renamed to GoogleDataTransport/GDTCORLibrary/GDTCORClock.m

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#import "GDTLibrary/Public/GDTClock.h"
17+
#import "GDTCORLibrary/Public/GDTCORClock.h"
1818

1919
#import <sys/sysctl.h>
2020

@@ -74,7 +74,7 @@ static int64_t UptimeInNanoseconds() {
7474
}
7575

7676
// TODO: Consider adding a 'trustedTime' property that can be populated by the response from a BE.
77-
@implementation GDTClock
77+
@implementation GDTCORClock
7878

7979
- (instancetype)init {
8080
self = [super init];
@@ -90,17 +90,17 @@ - (instancetype)init {
9090
return self;
9191
}
9292

93-
+ (GDTClock *)snapshot {
94-
return [[GDTClock alloc] init];
93+
+ (GDTCORClock *)snapshot {
94+
return [[GDTCORClock alloc] init];
9595
}
9696

9797
+ (instancetype)clockSnapshotInTheFuture:(uint64_t)millisInTheFuture {
98-
GDTClock *snapshot = [self snapshot];
98+
GDTCORClock *snapshot = [self snapshot];
9999
snapshot->_timeMillis += millisInTheFuture;
100100
return snapshot;
101101
}
102102

103-
- (BOOL)isAfter:(GDTClock *)otherClock {
103+
- (BOOL)isAfter:(GDTCORClock *)otherClock {
104104
// These clocks are trivially comparable when they share a kernel boot time.
105105
if (_kernelBootTime == otherClock->_kernelBootTime) {
106106
int64_t timeDiff = (_timeMillis + _timezoneOffsetSeconds) -
@@ -126,16 +126,16 @@ - (BOOL)isEqual:(id)object {
126126
#pragma mark - NSSecureCoding
127127

128128
/** NSKeyedCoder key for timeMillis property. */
129-
static NSString *const kGDTClockTimeMillisKey = @"GDTClockTimeMillis";
129+
static NSString *const kGDTCORClockTimeMillisKey = @"GDTCORClockTimeMillis";
130130

131131
/** NSKeyedCoder key for timezoneOffsetMillis property. */
132-
static NSString *const kGDTClockTimezoneOffsetSeconds = @"GDTClockTimezoneOffsetSeconds";
132+
static NSString *const kGDTCORClockTimezoneOffsetSeconds = @"GDTCORClockTimezoneOffsetSeconds";
133133

134134
/** NSKeyedCoder key for _kernelBootTime ivar. */
135-
static NSString *const kGDTClockKernelBootTime = @"GDTClockKernelBootTime";
135+
static NSString *const kGDTCORClockKernelBootTime = @"GDTCORClockKernelBootTime";
136136

137137
/** NSKeyedCoder key for _uptime ivar. */
138-
static NSString *const kGDTClockUptime = @"GDTClockUptime";
138+
static NSString *const kGDTCORClockUptime = @"GDTCORClockUptime";
139139

140140
+ (BOOL)supportsSecureCoding {
141141
return YES;
@@ -146,19 +146,19 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder {
146146
if (self) {
147147
// TODO: If the kernelBootTime is more recent, we need to change the kernel boot time and
148148
// uptimeMillis ivars
149-
_timeMillis = [aDecoder decodeInt64ForKey:kGDTClockTimeMillisKey];
150-
_timezoneOffsetSeconds = [aDecoder decodeInt64ForKey:kGDTClockTimezoneOffsetSeconds];
151-
_kernelBootTime = [aDecoder decodeInt64ForKey:kGDTClockKernelBootTime];
152-
_uptime = [aDecoder decodeInt64ForKey:kGDTClockUptime];
149+
_timeMillis = [aDecoder decodeInt64ForKey:kGDTCORClockTimeMillisKey];
150+
_timezoneOffsetSeconds = [aDecoder decodeInt64ForKey:kGDTCORClockTimezoneOffsetSeconds];
151+
_kernelBootTime = [aDecoder decodeInt64ForKey:kGDTCORClockKernelBootTime];
152+
_uptime = [aDecoder decodeInt64ForKey:kGDTCORClockUptime];
153153
}
154154
return self;
155155
}
156156

157157
- (void)encodeWithCoder:(NSCoder *)aCoder {
158-
[aCoder encodeInt64:_timeMillis forKey:kGDTClockTimeMillisKey];
159-
[aCoder encodeInt64:_timezoneOffsetSeconds forKey:kGDTClockTimezoneOffsetSeconds];
160-
[aCoder encodeInt64:_kernelBootTime forKey:kGDTClockKernelBootTime];
161-
[aCoder encodeInt64:_uptime forKey:kGDTClockUptime];
158+
[aCoder encodeInt64:_timeMillis forKey:kGDTCORClockTimeMillisKey];
159+
[aCoder encodeInt64:_timezoneOffsetSeconds forKey:kGDTCORClockTimezoneOffsetSeconds];
160+
[aCoder encodeInt64:_kernelBootTime forKey:kGDTCORClockKernelBootTime];
161+
[aCoder encodeInt64:_uptime forKey:kGDTCORClockUptime];
162162
}
163163

164164
@end

GoogleDataTransport/GDTLibrary/GDTConsoleLogger.m renamed to GoogleDataTransport/GDTCORLibrary/GDTCORConsoleLogger.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@
1414
* limitations under the License.
1515
*/
1616

17-
#import "GDTLibrary/Public/GDTConsoleLogger.h"
17+
#import "GDTCORLibrary/Public/GDTCORConsoleLogger.h"
1818

1919
/** The console logger prefix. */
20-
static NSString *kGDTConsoleLogger = @"[GoogleDataTransport]";
20+
static NSString *kGDTCORConsoleLogger = @"[GoogleDataTransport]";
2121

22-
NSString *GDTMessageCodeEnumToString(GDTMessageCode code) {
23-
return [[NSString alloc] initWithFormat:@"I-GDT%06ld", (long)code];
22+
NSString *GDTCORMessageCodeEnumToString(GDTCORMessageCode code) {
23+
return [[NSString alloc] initWithFormat:@"I-GDTCOR%06ld", (long)code];
2424
}
2525

26-
void GDTLog(GDTMessageCode code, NSString *format, ...) {
26+
void GDTCORLog(GDTCORMessageCode code, NSString *format, ...) {
2727
// Don't log anything in not debug builds.
2828
#ifndef NDEBUG
29-
NSString *logFormat = [NSString
30-
stringWithFormat:@"%@[%@] %@", kGDTConsoleLogger, GDTMessageCodeEnumToString(code), format];
29+
NSString *logFormat = [NSString stringWithFormat:@"%@[%@] %@", kGDTCORConsoleLogger,
30+
GDTCORMessageCodeEnumToString(code), format];
3131
va_list args;
3232
va_start(args, format);
3333
NSLogv(logFormat, args);

0 commit comments

Comments
 (0)