From 660ba3d722228f802471a8b4aaebb321187c441b Mon Sep 17 00:00:00 2001 From: Federico Maccaroni Date: Fri, 30 Dec 2022 14:51:35 -0300 Subject: [PATCH] [EC-628] Added Crashlytics to the watchOS project (#2267) * EC-628 Added Crashlytics to the watchOS project, missing GoogleService-Info.plist for now * addition of GoogleServices-info.plist.gpg * Re-add GoogleService-info.plist.gpg * EC-628 Updated build.yml to decrypt and copy the GoogleService-Info.plist for Crashlytics and also added step to upload Watch dSYMs to Crashlytics * EC-628 Fix run command upload watch dsym build.yml * EC-628 Updated Apple iOS macos version to 12 in order to resolve Watch XCode dependencies correctly with SPM * EC-628 Added some logs to see where I'm located cause it's issuing a wrong path. Also deactivated droid builds so that it's faster to test and doesn't consume resources on that till the build is OK * EC-628 fixed variable reference build.yml * EC-628 Removed ls of watch dsym export path before creating the folder that was causing the build to fail * EC-628 Removed XCode build phase step to auto-upload dsym to firebase and added some logs to find the upload-symbols tool from SPM. Also fix making the dir for the watchOS dSYMs export path * EC-628 Changed approach to upload watch dSYMs to Firebase by finding the upload-symbols script dynamically with find and then executing it * EC-628 Added missing ; to command to upload watch dSYMs * EC-628 Fix buld.yml Watch dSYMs copy to export path * EC-628 Cleaned build.yml for the watch dSYMs upload to Firebase and bring back droid builds Co-authored-by: sneakernuts <671942+sneakernuts@users.noreply.github.com> --- .github/secrets/GoogleService-Info.plist.gpg | Bin 0 -> 594 bytes .github/workflows/build.yml | 30 ++++- .../bitwarden/GoogleService-Info.plist | 34 ++++++ .../ExtensionDelegate.swift | 11 ++ .../bitwardenApp.swift | 4 +- .../bitwarden.xcodeproj/project.pbxproj | 40 +++++++ .../xcshareddata/swiftpm/Package.resolved | 113 ++++++++++++++++++ 7 files changed, 226 insertions(+), 6 deletions(-) create mode 100644 .github/secrets/GoogleService-Info.plist.gpg create mode 100644 src/watchOS/bitwarden/GoogleService-Info.plist create mode 100644 src/watchOS/bitwarden/bitwarden WatchKit Extension/ExtensionDelegate.swift create mode 100644 src/watchOS/bitwarden/bitwarden.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/.github/secrets/GoogleService-Info.plist.gpg b/.github/secrets/GoogleService-Info.plist.gpg new file mode 100644 index 0000000000000000000000000000000000000000..6f04d0929afb19f5c381a2b7da3f5ce378dc65dc GIT binary patch literal 594 zcmV-Y065Nvm$JL^u8uqFO2YwJq~$6c z|ML-Plm-{@JU#B|+4kYN$tlY^@`tF}ca^`QWjEI~n+BxMuU3TpcO5jF{T!WhR~Yd$7UD|CAN{!spg?o_zB==nZ;6v zS!t`8a$MSH*axD!su+8P%@T6yw=wPvi30eiLc#ia_i|OAo9xL_;dg#ic-Zf1?~94zdhOI-eLGFA@HL6fqg9jn`H0!4gt=N-caXzwMMeF)HVU><9>qS z!zk`&#g4yW)Y0%iVN5>%7x(jdK0n?={CKl##EKs~T0ge~3zo8f5lRXpzO`d{RLYcH*LqWj^WAH==Ic zfyydEu2j%xNLeo8Ay`OAK>0R-vlFfiM2Eqh*OHR_?8a=$WC0$m!kH6@P(`$rdiJN! gkFP(~P{qBC)v`*BeME?2M{8=MR=1J{bxA3!Pk|CK0{{R3 literal 0 HcmV?d00001 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1087f9404..1bc5fc615 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -440,7 +440,7 @@ jobs: ios: name: Apple iOS - runs-on: macos-11 + runs-on: macos-12 needs: setup steps: - name: Setup NuGet @@ -503,6 +503,8 @@ jobs: gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \ --output $HOME/secrets/dist_watch_app_extension.mobileprovision \ ./.github/secrets/dist_watch_app_extension.mobileprovision.gpg + gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \ + --output ./src/watchOS/bitwarden/GoogleService-Info.plist ./.github/secrets/GoogleService-Info.plist.gpg shell: bash - name: Increment version @@ -590,9 +592,6 @@ jobs: echo "########################################" echo "##### Done" echo "########################################" - cd src/watchOS - ls -R - cd ../.. shell: bash - name: Restore packages @@ -630,7 +629,12 @@ jobs: ARCHIVE_DSYMS_PATH="$HOME/Library/Developer/Xcode/Archives/*/*.xcarchive/dSYMs" EXPORT_PATH="./bitwarden-export" - cp -r $ARCHIVE_DSYMS_PATH $EXPORT_PATH + WATCH_ARCHIVE_DSYMS_PATH="./src/watchOS/bitwarden.xcarchive/dSYMs/" + WATCH_DSYMS_EXPORT_PATH="$EXPORT_PATH/Watch_dSYMs" + + cp -r -v $ARCHIVE_DSYMS_PATH $EXPORT_PATH + mkdir $WATCH_DSYMS_EXPORT_PATH + cp -r -v $WATCH_ARCHIVE_DSYMS_PATH $WATCH_DSYMS_EXPORT_PATH shell: bash - name: Upload App Store .ipa & dSYMs artifacts @@ -663,6 +667,22 @@ jobs: run: appcenter crashes upload-symbols -a bitwarden/bitwarden -s "./bitwarden-export/dSYMs" --token $APPCENTER_IOS_TOKEN shell: bash + - name: Upload Watch dSYMs to Firebase Crashlytics + if: | + (github.ref == 'refs/heads/master' + && needs.setup.outputs.rc_branch_exists == 0 + && needs.setup.outputs.hotfix_branch_exists == 0) + || (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0) + || github.ref == 'refs/heads/hotfix-rc' + run: | + + echo "########################################" + echo "##### Uploading Watch dSYMs to Firebase" + echo "########################################" + + find "$HOME/Library/Developer/XCode/DerivedData" -name "upload-symbols" -exec chmod +x {} \; -exec {} -gsp "./src/watchOS/bitwarden/GoogleService-Info.plist" -p ios "./bitwarden-export/Watch_dSYMs" \; + shell: bash + - name: Deploy to App Store if: | (github.ref == 'refs/heads/master' diff --git a/src/watchOS/bitwarden/GoogleService-Info.plist b/src/watchOS/bitwarden/GoogleService-Info.plist new file mode 100644 index 000000000..c7e2c61c1 --- /dev/null +++ b/src/watchOS/bitwarden/GoogleService-Info.plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + ___________ + REVERSED_CLIENT_ID + ___________ + API_KEY + ___________ + GCM_SENDER_ID + ___________ + PLIST_VERSION + 1 + BUNDLE_ID + com.8bit.bitwarden.watchkitapp.watchkitextension + PROJECT_ID + ___________ + STORAGE_BUCKET + ___________ + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + ___________ + + diff --git a/src/watchOS/bitwarden/bitwarden WatchKit Extension/ExtensionDelegate.swift b/src/watchOS/bitwarden/bitwarden WatchKit Extension/ExtensionDelegate.swift new file mode 100644 index 000000000..9233e9765 --- /dev/null +++ b/src/watchOS/bitwarden/bitwarden WatchKit Extension/ExtensionDelegate.swift @@ -0,0 +1,11 @@ +import WatchKit +import FirebaseCore + +class ExtensionDelegate: NSObject, WKExtensionDelegate { + + func applicationDidFinishLaunching() { +#if !DEBUG + FirebaseApp.configure() +#endif + } +} diff --git a/src/watchOS/bitwarden/bitwarden WatchKit Extension/bitwardenApp.swift b/src/watchOS/bitwarden/bitwarden WatchKit Extension/bitwardenApp.swift index a10645018..e3f499531 100644 --- a/src/watchOS/bitwarden/bitwarden WatchKit Extension/bitwardenApp.swift +++ b/src/watchOS/bitwarden/bitwarden WatchKit Extension/bitwardenApp.swift @@ -1,7 +1,9 @@ import SwiftUI @main -struct bitwardenApp: App { +struct bitwardenApp: App { + @WKExtensionDelegateAdaptor(ExtensionDelegate.self) var delegate + @SceneBuilder var body: some Scene { WindowGroup { NavigationView { diff --git a/src/watchOS/bitwarden/bitwarden.xcodeproj/project.pbxproj b/src/watchOS/bitwarden/bitwarden.xcodeproj/project.pbxproj index ca71d85dc..d3331ae6f 100644 --- a/src/watchOS/bitwarden/bitwarden.xcodeproj/project.pbxproj +++ b/src/watchOS/bitwarden/bitwarden.xcodeproj/project.pbxproj @@ -35,6 +35,11 @@ 1B59EC632901B1C100A8718D /* LoggerHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B59EC622901B1C100A8718D /* LoggerHelper.swift */; }; 1B5AFF0329196C81004478F9 /* ColorUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B5AFF0229196C81004478F9 /* ColorUtils.swift */; }; 1B5AFF0729197822004478F9 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1B5AFF0929197822004478F9 /* Localizable.strings */; }; + 1B5BE451295A08A900E0C323 /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 1B5BE450295A08A900E0C323 /* FirebaseCrashlytics */; }; + 1B5BE453295A08C600E0C323 /* ExtensionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B5BE452295A08C600E0C323 /* ExtensionDelegate.swift */; }; + 1B5BE45E295B472C00E0C323 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1B5BE45D295B472C00E0C323 /* GoogleService-Info.plist */; }; + 1B5BE45F295B472C00E0C323 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1B5BE45D295B472C00E0C323 /* GoogleService-Info.plist */; }; + 1B5BE460295B472C00E0C323 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1B5BE45D295B472C00E0C323 /* GoogleService-Info.plist */; }; 1B5F5E38293F9CF8009B5FCC /* TrackableWithHeaderListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B5F5E37293F9CF8009B5FCC /* TrackableWithHeaderListView.swift */; }; 1B5F5E3A293F9D6F009B5FCC /* ViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B5F5E39293F9D6F009B5FCC /* ViewExtensions.swift */; }; 1B5F5E3E293FBB17009B5FCC /* CipherItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B5F5E3D293FBB17009B5FCC /* CipherItemView.swift */; }; @@ -144,6 +149,8 @@ 1B59EC622901B1C100A8718D /* LoggerHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggerHelper.swift; sourceTree = ""; }; 1B5AFF0229196C81004478F9 /* ColorUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorUtils.swift; sourceTree = ""; }; 1B5AFF0829197822004478F9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; + 1B5BE452295A08C600E0C323 /* ExtensionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionDelegate.swift; sourceTree = ""; }; + 1B5BE45D295B472C00E0C323 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 1B5F5E37293F9CF8009B5FCC /* TrackableWithHeaderListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackableWithHeaderListView.swift; sourceTree = ""; }; 1B5F5E39293F9D6F009B5FCC /* ViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewExtensions.swift; sourceTree = ""; }; 1B5F5E3D293FBB17009B5FCC /* CipherItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CipherItemView.swift; sourceTree = ""; }; @@ -190,6 +197,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 1B5BE451295A08A900E0C323 /* FirebaseCrashlytics in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -230,6 +238,7 @@ 1B15612628B7F3D400610B9B = { isa = PBXGroup; children = ( + 1B5BE45D295B472C00E0C323 /* GoogleService-Info.plist */, 1B15613128B7F3D400610B9B /* bitwarden */, 1B15614128B7F3D700610B9B /* bitwarden WatchKit App */, 1B15614C28B7F3D800610B9B /* bitwarden WatchKit Extension */, @@ -298,6 +307,7 @@ 1B15615D28B7F3D900610B9B /* PushNotificationPayload.apns */, 1B15615928B7F3D900610B9B /* Preview Content */, 1B15616D28B81A4300610B9B /* WatchConnectivityManager.swift */, + 1B5BE452295A08C600E0C323 /* ExtensionDelegate.swift */, ); path = "bitwarden WatchKit Extension"; sourceTree = ""; @@ -470,6 +480,9 @@ dependencies = ( ); name = "bitwarden WatchKit Extension"; + packageProductDependencies = ( + 1B5BE450295A08A900E0C323 /* FirebaseCrashlytics */, + ); productName = "bitwarden WatchKit Extension"; productReference = 1B15614828B7F3D800610B9B /* bitwarden WatchKit Extension.appex */; productType = "com.apple.product-type.watchkit2-extension"; @@ -504,6 +517,9 @@ Base, ); mainGroup = 1B15612628B7F3D400610B9B; + packageReferences = ( + 1B5BE44F295A08A900E0C323 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, + ); productRefGroup = 1B15613028B7F3D400610B9B /* Products */; projectDirPath = ""; projectRoot = ""; @@ -522,6 +538,7 @@ files = ( 1B15613A28B7F3D700610B9B /* Preview Assets.xcassets in Resources */, 1B15613728B7F3D700610B9B /* Assets.xcassets in Resources */, + 1B5BE45E295B472C00E0C323 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -530,6 +547,7 @@ buildActionMask = 2147483647; files = ( 1B15614328B7F3D800610B9B /* Assets.xcassets in Resources */, + 1B5BE45F295B472C00E0C323 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -538,6 +556,7 @@ buildActionMask = 2147483647; files = ( 1B15615B28B7F3D900610B9B /* Preview Assets.xcassets in Resources */, + 1B5BE460295B472C00E0C323 /* GoogleService-Info.plist in Resources */, 1B5AFF0729197822004478F9 /* Localizable.strings in Resources */, 1B15615828B7F3D900610B9B /* Assets.xcassets in Resources */, ); @@ -600,6 +619,7 @@ 1B15616E28B81A4300610B9B /* WatchConnectivityManager.swift in Sources */, 1B5AFF0329196C81004478F9 /* ColorUtils.swift in Sources */, 1B59EC612900C48E00A8718D /* KeychainHelper.swift in Sources */, + 1B5BE453295A08C600E0C323 /* ExtensionDelegate.swift in Sources */, 1B59EC5729007DEE00A8718D /* BitwardenDB.xcdatamodeld in Sources */, 1B8BF90D2919BED9006F069E /* Base32.swift in Sources */, 1B8453EC290C672E00F921E1 /* CipherEntity+CoreDataClass.swift in Sources */, @@ -827,6 +847,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = LTZ2PFU5D6; GENERATE_INFOPLIST_FILE = YES; IBSC_MODULE = bitwarden_WatchKit_Extension; @@ -984,6 +1005,25 @@ }; /* End XCConfigurationList section */ +/* Begin XCRemoteSwiftPackageReference section */ + 1B5BE44F295A08A900E0C323 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/firebase/firebase-ios-sdk"; + requirement = { + kind = exactVersion; + version = 9.6.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 1B5BE450295A08A900E0C323 /* FirebaseCrashlytics */ = { + isa = XCSwiftPackageProductDependency; + package = 1B5BE44F295A08A900E0C323 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseCrashlytics; + }; +/* End XCSwiftPackageProductDependency section */ + /* Begin XCVersionGroup section */ 1B59EC5529007DEE00A8718D /* BitwardenDB.xcdatamodeld */ = { isa = XCVersionGroup; diff --git a/src/watchOS/bitwarden/bitwarden.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/src/watchOS/bitwarden/bitwarden.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 000000000..f7e707f4b --- /dev/null +++ b/src/watchOS/bitwarden/bitwarden.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,113 @@ +{ + "pins" : [ + { + "identity" : "abseil-cpp-swiftpm", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/abseil-cpp-SwiftPM.git", + "state" : { + "revision" : "583de9bd60f66b40e78d08599cc92036c2e7e4e1", + "version" : "0.20220203.2" + } + }, + { + "identity" : "boringssl-swiftpm", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/boringssl-SwiftPM.git", + "state" : { + "revision" : "dd3eda2b05a3f459fc3073695ad1b28659066eab", + "version" : "0.9.1" + } + }, + { + "identity" : "firebase-ios-sdk", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/firebase-ios-sdk", + "state" : { + "revision" : "7e80c25b51c2ffa238879b07fbfc5baa54bb3050", + "version" : "9.6.0" + } + }, + { + "identity" : "googleappmeasurement", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleAppMeasurement.git", + "state" : { + "revision" : "c1cfde8067668027b23a42c29d11c246152fe046", + "version" : "9.6.0" + } + }, + { + "identity" : "googledatatransport", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleDataTransport.git", + "state" : { + "revision" : "5056b15c5acbb90cd214fe4d6138bdf5a740e5a8", + "version" : "9.2.0" + } + }, + { + "identity" : "googleutilities", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleUtilities.git", + "state" : { + "revision" : "6db6edb48bdd9943426562c7f042a5492de5ba3d", + "version" : "7.10.0" + } + }, + { + "identity" : "grpc-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/grpc/grpc-ios.git", + "state" : { + "revision" : "8440b914756e0d26d4f4d054a1c1581daedfc5b6", + "version" : "1.44.3-grpc" + } + }, + { + "identity" : "gtm-session-fetcher", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/gtm-session-fetcher.git", + "state" : { + "revision" : "5ccda3981422a84186387dbb763ba739178b529c", + "version" : "2.3.0" + } + }, + { + "identity" : "leveldb", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/leveldb.git", + "state" : { + "revision" : "0706abcc6b0bd9cedfbb015ba840e4a780b5159b", + "version" : "1.22.2" + } + }, + { + "identity" : "nanopb", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/nanopb.git", + "state" : { + "revision" : "819d0a2173aff699fb8c364b6fb906f7cdb1a692", + "version" : "2.30909.0" + } + }, + { + "identity" : "promises", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/promises.git", + "state" : { + "revision" : "3e4e743631e86c8c70dbc6efdc7beaa6e90fd3bb", + "version" : "2.1.1" + } + }, + { + "identity" : "swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-protobuf.git", + "state" : { + "revision" : "ab3a58b7209a17d781c0d1dbb3e1ff3da306bae8", + "version" : "1.20.3" + } + } + ], + "version" : 2 +}