diff --git a/.github/workflows/ios_prod_release.yml b/.github/workflows/ios_prod_release.yml index 679746aed..81e878b03 100644 --- a/.github/workflows/ios_prod_release.yml +++ b/.github/workflows/ios_prod_release.yml @@ -66,6 +66,7 @@ jobs: - name: Pod Install run: | + gem install cocoapods-bugsnag; ./gradlew --no-daemon podInstall; - name: Build Archive @@ -90,13 +91,6 @@ jobs: echo -n "$EXPORT_OPTIONS_PLIST" | base64 --decode -o $EXPORT_OPTS_PATH xcodebuild -exportArchive -archivePath $RUNNER_TEMP/twine.xcarchive -exportOptionsPlist $EXPORT_OPTS_PATH -exportPath $RUNNER_TEMP/build - - name: Upload debug symbols to Bugsnag - run: | - cd $RUNNER_TEMP/twine.xcarchive/dSYMs/; - curl --http1.1 https://upload.bugsnag.com/ \ - -F apiKey=${BUGSNAG_API_KEY} \ - -F dsym=@Twine.app.dSYM/Contents/Resources/DWARF/Twine \ - - name: Clean up keychain and provisioning profile if: ${{ always() }} run: | diff --git a/iosApp/Podfile b/iosApp/Podfile index 9b21db28f..7af3aaa9a 100644 --- a/iosApp/Podfile +++ b/iosApp/Podfile @@ -1,5 +1,10 @@ target 'iosApp' do use_frameworks! platform :ios, '15.0' + + pod 'Bugsnag' + plugin 'cocoapods-bugsnag' + pod 'shared', :path => '../shared' + end diff --git a/iosApp/iosApp.xcodeproj/project.pbxproj b/iosApp/iosApp.xcodeproj/project.pbxproj index 9feca9554..c4fa90886 100644 --- a/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/iosApp/iosApp.xcodeproj/project.pbxproj @@ -124,6 +124,7 @@ F85CB1118929364A9C6EFABC /* Frameworks */, 2134C13603D0B299603D9F49 /* [CP] Copy Pods Resources */, 599E3F199C42E8E830BDD65E /* [CP] Embed Pods Frameworks */, + E8479EF0239AA3C1B90F902B /* Upload Bugsnag dSYM */, ); buildRules = ( ); @@ -236,6 +237,28 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + E8479EF0239AA3C1B90F902B /* Upload Bugsnag dSYM */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}", + "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}", + "${BUILT_PRODUCTS_DIR}/Bugsnag/Bugsnag.framework.dSYM/Contents/Resources/DWARF/Bugsnag", + ); + name = "Upload Bugsnag dSYM"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = "/usr/bin/env ruby"; + shellScript = "# Set DISABLE_COCOAPODS_BUGSNAG=YES via Xcode's Build Settings, xcconfig or xcodebuild to skip upload\nif ENV['DISABLE_COCOAPODS_BUGSNAG'] == 'YES'\n puts 'Skipping dSYM upload'\n return\nend\n\n# Attempt to get the API key from an environment variable (or Xcode build setting)\napi_key = ENV[\"BUGSNAG_API_KEY\"]\n\n# If not present, attempt to lookup the value from the Info.plist\nunless api_key\n info_plist_path = \"#{ENV[\"BUILT_PRODUCTS_DIR\"]}/#{ENV[\"INFOPLIST_PATH\"]}\"\n plist_buddy_response = `/usr/libexec/PlistBuddy -c \"print :bugsnag:apiKey\" \"#{info_plist_path}\"`\n plist_buddy_response = `/usr/libexec/PlistBuddy -c \"print :BugsnagAPIKey\" \"#{info_plist_path}\"` if !$?.success?\n api_key = plist_buddy_response if $?.success?\nend\n\nfail(\"No Bugsnag API key detected - add your key to your Info.plist or BUGSNAG_API_KEY environment variable\") unless api_key\n\nif ENV['ENABLE_USER_SCRIPT_SANDBOXING'] == 'YES'\n count = ENV['SCRIPT_INPUT_FILE_COUNT'].to_i\n abort 'error: dSYMs must be specified as build phase \"Input Files\" because ENABLE_USER_SCRIPT_SANDBOXING is enabled' unless count > 0\n dsyms = []\n for i in 0 .. count - 1\n file = ENV[\"SCRIPT_INPUT_FILE_#{i}\"]\n next if file.end_with? '.plist'\n if File.exist? file\n dsyms.append file\n else\n abort \"error: cannot read #{file}\" unless ENV['DEBUG_INFORMATION_FORMAT'] != 'dwarf-with-dsym'\n end\n end\nelse\n dsyms = Dir[\"#{ENV['DWARF_DSYM_FOLDER_PATH']}/*/Contents/Resources/DWARF/*\"]\nend\n\ndsyms.each do |dsym|\n Process.detach Process.spawn('/usr/bin/curl', '--http1.1',\n '-F', \"apiKey=#{api_key}\",\n '-F', \"dsym=@#{dsym}\",\n '-F', \"projectRoot=#{ENV['PROJECT_DIR']}\",\n 'https://upload.bugsnag.com/',\n %i[err out] => :close\n )\nend\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index 87bee26c8..7530657c2 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -55,7 +55,6 @@ kotlin { homepage = "https://github.com/msasikanth/rss_reader" ios.deploymentTarget = "15.0" podfile = project.file("../iosApp/Podfile") - pod("Bugsnag") framework { baseName = "shared" diff --git a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/ui/HomeTopAppBar.kt b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/ui/HomeTopAppBar.kt index 4d3790055..109867f8a 100644 --- a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/ui/HomeTopAppBar.kt +++ b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/ui/HomeTopAppBar.kt @@ -250,7 +250,7 @@ private fun OverflowMenu(onSettingsClicked: () -> Unit) { onClick = { dropdownExpanded = false onSettingsClicked() - BugsnagKotlin.sendFatalException(Exception("Fatal exception from common code")) + throw Exception("Fatal exception from the common code") } ) }