Skip to content

Commit 7c3235d

Browse files
authored
Crashlytics watchOS support (#6262)
1 parent ab6fc61 commit 7c3235d

File tree

5 files changed

+26
-4
lines changed

5 files changed

+26
-4
lines changed

.github/workflows/crashlytics.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
strategy:
2323
matrix:
24-
target: [ios, tvos, macos]
24+
target: [ios, tvos, macos, watchos --skip-tests]
2525
steps:
2626
- uses: actions/checkout@v2
2727
- name: Setup Bundler
@@ -77,7 +77,7 @@ jobs:
7777
runs-on: macos-latest
7878
strategy:
7979
matrix:
80-
target: [ios, tvos, macos] # The macos and tvos tests can hang
80+
target: [ios, tvos, macos, watchos --skip-tests] # The macos and tvos tests can hang
8181
flags: [
8282
'--use-modular-headers',
8383
'--use-libraries'

Crashlytics/Crashlytics/Components/FIRCLSApplication.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
return @"mac";
4545
#elif TARGET_OS_TV
4646
return @"tvos";
47+
#elif TARGET_OS_WATCH
48+
return @"ios"; // TODO: temporarily use iOS until Firebase can add watchos to the backend
4749
#endif
4850
}
4951

Crashlytics/Crashlytics/Components/FIRCLSProcess.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,11 @@ bool FIRCLSProcessRecordAllThreads(FIRCLSProcess *process, FIRCLSFile *file) {
485485

486486
FIRCLSSDKLogInfo("recording thread %d data\n", i);
487487
if (!FIRCLSProcessRecordThread(process, thread, file)) {
488+
FIRCLSSDKLogError("Failed to record thread state. Closing threads JSON to prevent malformed crash report.");
489+
490+
FIRCLSFileWriteArrayEnd(file);
491+
492+
FIRCLSFileWriteSectionEnd(file);
488493
return false;
489494
}
490495
}

Crashlytics/generate_project.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ readonly DIR="$( git rev-parse --show-toplevel )"
1919

2020
"$DIR/Crashlytics/ProtoSupport/generate_crashlytics_protos.sh" || echo "Something went wrong generating protos.";
2121

22-
pod gen "${DIR}/FirebaseCrashlytics.podspec" --auto-open --gen-directory="${DIR}/gen" --local-sources="${DIR}" --platforms=ios,macos,tvos --clean
22+
pod gen "${DIR}/FirebaseCrashlytics.podspec" --auto-open --gen-directory="${DIR}/gen" --local-sources="${DIR}" --platforms=ios,macos,tvos,watchos --clean

FirebaseCrashlytics.podspec

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Pod::Spec.new do |s|
1414
s.ios.deployment_target = '8.0'
1515
s.osx.deployment_target = '10.11'
1616
s.tvos.deployment_target = '10.0'
17+
s.watchos.deployment_target = '6.0'
1718

1819
s.cocoapods_version = '>= 1.4.0'
1920
s.static_framework = true
@@ -54,7 +55,10 @@ Pod::Spec.new do |s|
5455
s.dependency 'nanopb', '~> 1.30905.0'
5556

5657
s.libraries = 'c++', 'z'
57-
s.frameworks = 'Security', 'SystemConfiguration'
58+
s.ios.frameworks = 'Security', 'SystemConfiguration'
59+
s.macos.frameworks = 'Security', 'SystemConfiguration'
60+
s.osx.frameworks = 'Security', 'SystemConfiguration'
61+
s.watchos.frameworks = 'Security'
5862

5963
s.ios.pod_target_xcconfig = {
6064
'GCC_C_LANGUAGE_STANDARD' => 'c99',
@@ -86,6 +90,17 @@ Pod::Spec.new do |s|
8690
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"',
8791
}
8892

93+
s.watchos.pod_target_xcconfig = {
94+
'GCC_C_LANGUAGE_STANDARD' => 'c99',
95+
'GCC_PREPROCESSOR_DEFINITIONS' =>
96+
'DISPLAY_VERSION=' + s.version.to_s + ' ' +
97+
'CLS_SDK_NAME="Crashlytics watchOS SDK" ' +
98+
# For nanopb:
99+
'PB_FIELD_32BIT=1 PB_NO_PACKED_STRUCTS=1 PB_ENABLE_MALLOC=1',
100+
'OTHER_LD_FLAGS' => '$(inherited) -sectcreate __TEXT __info_plist',
101+
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"',
102+
}
103+
89104
s.test_spec 'unit' do |unit_tests|
90105
unit_tests.source_files = 'Crashlytics/UnitTests/*.[mh]',
91106
'Crashlytics/UnitTests/*/*.[mh]'

0 commit comments

Comments
 (0)