From 43526c55331940b4618b947b3ea7297c0d7f06de Mon Sep 17 00:00:00 2001 From: jhnstn Date: Thu, 29 Feb 2024 20:55:34 -0500 Subject: [PATCH 01/24] Add log exception handlers --- .../editor/gutenberg/GutenbergContainerFragment.java | 3 +++ .../editor/gutenberg/GutenbergEditorFragment.java | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java index ec062f54e37e..073595329e40 100644 --- a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java +++ b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java @@ -31,6 +31,7 @@ import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnEditorAutosaveListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnEditorMountListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGetContentInterrupted; +import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnDidLogExceptionListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGutenbergDidRequestEmbedFullscreenPreviewListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGutenbergDidRequestUnsupportedBlockFallbackListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGutenbergDidSendButtonPressedActionListener; @@ -100,6 +101,7 @@ public void attachToContainer(ViewGroup viewGroup, OnMediaLibraryButtonListener OnToggleRedoButtonListener onToggleRedoButtonListener, OnConnectionStatusEventListener onConnectionStatusEventListener, OnBackHandlerEventListener onBackHandlerEventListener, + OnDidLogExceptionListener onDidLogExceptionListener, boolean isDarkMode) { mWPAndroidGlueCode.attachToContainer( viewGroup, @@ -127,6 +129,7 @@ public void attachToContainer(ViewGroup viewGroup, OnMediaLibraryButtonListener onToggleRedoButtonListener, onConnectionStatusEventListener, onBackHandlerEventListener, + onDidLogExceptionListener, isDarkMode); } diff --git a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 3aedae6fd8cc..20ee5b06c928 100644 --- a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -62,7 +62,9 @@ import org.wordpress.android.util.helpers.MediaFile; import org.wordpress.android.util.helpers.MediaGallery; import org.wordpress.aztec.IHistoryListener; +import org.wordpress.mobile.ReactNativeGutenbergBridge.GutenbergBridgeJS2Parent.LogExceptionCallback; import org.wordpress.mobile.ReactNativeGutenbergBridge.GutenbergEmbedWebViewActivity; +import org.wordpress.mobile.ReactNativeGutenbergBridge.GutenbergJsException; import org.wordpress.mobile.WPAndroidGlue.Media; import org.wordpress.mobile.WPAndroidGlue.MediaOption; import org.wordpress.mobile.WPAndroidGlue.RequestExecutor; @@ -76,6 +78,7 @@ import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnEditorMountListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnFocalPointPickerTooltipShownEventListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGetContentInterrupted; +import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnDidLogExceptionListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGutenbergDidRequestEmbedFullscreenPreviewListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGutenbergDidRequestPreviewListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGutenbergDidRequestUnsupportedBlockFallbackListener; @@ -603,6 +606,13 @@ public void onGotoCustomerSupportOptions() { } }, + new OnDidLogExceptionListener() { + @Override public void didLogException(GutenbergJsException exception, + LogExceptionCallback onLogExceptionCallback) { + AppLog.d(T.EDITOR, "Gutenberg JS Exception in GB editor fragment"); + onLogExceptionCallback.onLogException(true); + } + }, GutenbergUtils.isDarkMode(getActivity())); // request dependency injection. Do this after setting min/max dimensions From 32db1754c193f9fb390ced5ffe01444c30b975c8 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 29 Feb 2024 18:22:42 +0100 Subject: [PATCH 02/24] Prevent including React Native source in build --- WordPress/build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/WordPress/build.gradle b/WordPress/build.gradle index 1a7c673ac696..e9f404a4542a 100644 --- a/WordPress/build.gradle +++ b/WordPress/build.gradle @@ -287,6 +287,9 @@ android { exclude '**/libjscexecutor.so' exclude '**/libfabricjni.so' + // Exclude React Native's JavaScript source map + exclude '**/*.bundle.map' + // Avoid React Native's JNI duplicated classes pickFirst '**/libc++_shared.so' pickFirst '**/libfbjni.so' From fdaa9826a2d664d86714f8cca2bacedba4042aeb Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 29 Feb 2024 18:23:07 +0100 Subject: [PATCH 03/24] Add gem `fastlane-plugin-sentry` --- Gemfile | 1 + Gemfile.lock | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index 995ee1e3ebbb..34af8140a9fd 100644 --- a/Gemfile +++ b/Gemfile @@ -9,6 +9,7 @@ gem 'nokogiri' ### Fastlane Plugins gem 'fastlane-plugin-wpmreleasetoolkit', '~> 9.2' +gem 'fastlane-plugin-sentry' # gem 'fastlane-plugin-wpmreleasetoolkit', path: '../../release-toolkit' # gem 'fastlane-plugin-wpmreleasetoolkit', git: 'https://github.com/wordpress-mobile/release-toolkit', branch: '' diff --git a/Gemfile.lock b/Gemfile.lock index 651960877cce..8d2a8b367b52 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -174,6 +174,8 @@ GEM xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) + fastlane-plugin-sentry (1.19.0) + os (~> 1.1, >= 1.1.4) fastlane-plugin-wpmreleasetoolkit (9.4.0) activesupport (>= 6.1.7.1) buildkit (~> 1.5) @@ -355,6 +357,7 @@ PLATFORMS DEPENDENCIES danger-dangermattic (~> 1.0) fastlane (~> 2) + fastlane-plugin-sentry fastlane-plugin-wpmreleasetoolkit (~> 9.2) nokogiri rmagick (~> 4.1) From 9c4f7888fbe0b1faa29f14fd0c3d5f7ccdc80b87 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 29 Feb 2024 18:24:03 +0100 Subject: [PATCH 04/24] Update build process to upload React Native source map to Sentry --- fastlane/lanes/build.rb | 55 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index 11fb9f4637b2..ab040f397a87 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -34,9 +34,12 @@ # Create the file names app = get_app_name_option!(options) version_name = current_version_name - build_bundle(app: app, version_name: version_name, build_code: current_build_code, flavor: 'Vanilla', buildType: 'Release') + flavor = 'Vanilla' + build_type = 'Release' + build_bundle(app: app, version_name: version_name, build_code: current_build_code, flavor: flavor, buildType: build_type) upload_build_to_play_store(app: app, version_name: version_name, track: 'production') + upload_gutenberg_sourcemaps(app: app, flavor: flavor, build_type: build_type, release_version: version_name) create_gh_release(app: app, version_name: version_name) if options[:create_release] end @@ -102,9 +105,12 @@ # Create the file names app = get_app_name_option!(options) version_name = current_version_name - build_bundle(app: app, version_name: version_name, build_code: current_build_code, flavor: 'Vanilla', buildType: 'Release') + flavor = 'Vanilla' + build_type = 'Release' + build_bundle(app: app, version_name: version_name, build_code: current_build_code, flavor: flavor, buildType: build_type) upload_build_to_play_store(app: app, version_name: version_name, track: 'beta') if options[:upload_to_play_store] + upload_gutenberg_sourcemaps(app: app, flavor: flavor, build_type: build_type, release_version: version_name) create_gh_release(app: app, version_name: version_name, prerelease: true) if options[:create_release] end @@ -217,6 +223,7 @@ ) upload_prototype_build(product: 'WordPress', version_name: version_name) + upload_gutenberg_sourcemaps(app: 'Wordpress', flavor: PROTOTYPE_BUILD_FLAVOR, build_type: PROTOTYPE_BUILD_TYPE, release_version: version_name) end ##################################################################################### @@ -240,6 +247,7 @@ ) upload_prototype_build(product: 'Jetpack', version_name: version_name) + upload_gutenberg_sourcemaps(app: 'Jetpack', flavor: PROTOTYPE_BUILD_FLAVOR, build_type: PROTOTYPE_BUILD_TYPE, release_version: version_name) end ##################################################################################### @@ -359,4 +367,47 @@ def generate_prototype_build_number "#{branch}-#{commit}" end end + + # Uploads the React Native JavaScript bundle and source map files. + # These files are provided by the Gutenberg Mobile library. + # + # @param [String] app App name, e.g. 'WordPress' or 'Jetpack'. + # @param [String] flavor Build flavor, e.g. 'Jalapeno' or 'Vanilla'. + # @param [String] build_type Build type, e.g. 'Debug' or 'Release'. + # @param [String] release_version Release version name to attach the files to in Sentry. + # + def upload_gutenberg_sourcemaps(app:, flavor:, build_type:, release_version:) + # Load Sentry properties + sentry_path = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'src', app, 'sentry.properties') + sentry_properties = JavaProperties.load(sentry_path) + sentry_token = sentry_properties[:"auth.token"] + project_slug = sentry_properties[:"defaults.project"] + org_slug = sentry_properties[:"defaults.org"] + + # The bundle and source map files are extracted from merged assets location created after building the app. + # The format is: + # E.g.: jetpackJalapenoDebug + assetPath = "#{app.downcase}#{flavor}#{build_type}" + bundle_source_map_path = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'build', 'intermediates','assets', assetPath) + + Dir.mktmpdir do |sourcemaps_folder| + # It's important that the bundle and source map files have specific names, otherwise, Sentry + # won't symbolicate the stack traces. + FileUtils.cp(File.join(bundle_source_map_path, 'index.android.bundle'), File.join(sourcemaps_folder, 'index.android.bundle')) + FileUtils.cp(File.join(bundle_source_map_path, 'index.android.bundle.map'), File.join(sourcemaps_folder, 'index.android.bundle.map')) + + sentry_upload_sourcemap( + auth_token: sentry_token, + org_slug: org_slug, + project_slug: project_slug, + version: release_version, + # When the React native bundle is generated, the source map file references + # include the local machine path, with the `rewrite` and `strip_common_prefix` + # options Sentry automatically strips this part. + rewrite: true, + strip_common_prefix: true, + sourcemap: sourcemaps_folder + ) + end + end end From f132e700785ba69cbb9320f8793e693509b3a5ba Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 29 Feb 2024 18:24:46 +0100 Subject: [PATCH 05/24] Update Gutenberg Mobile reference --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 74233b3d1819..28d16ced287c 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ ext { automatticRestVersion = '1.0.8' automatticStoriesVersion = '2.4.0' automatticTracksVersion = '3.4.0' - gutenbergMobileVersion = 'v1.114.0' + gutenbergMobileVersion = '6655-a88a07389f55bcf5a233a57ff01802dbe3968a04' wordPressAztecVersion = 'v2.0' wordPressFluxCVersion = 'trunk-8b930418a49b0d0846ed56ebf8fd8adad5011901' wordPressLoginVersion = '1.14.0' From 61dec5a139b2ca4bae605ad9bfbd6febdba96e34 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Fri, 1 Mar 2024 13:49:19 +0100 Subject: [PATCH 06/24] Address issues identified by Dangermattic --- Gemfile | 2 +- fastlane/lanes/build.rb | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 34af8140a9fd..e64e0667d18c 100644 --- a/Gemfile +++ b/Gemfile @@ -8,8 +8,8 @@ gem 'nokogiri' ### Fastlane Plugins -gem 'fastlane-plugin-wpmreleasetoolkit', '~> 9.2' gem 'fastlane-plugin-sentry' +gem 'fastlane-plugin-wpmreleasetoolkit', '~> 9.2' # gem 'fastlane-plugin-wpmreleasetoolkit', path: '../../release-toolkit' # gem 'fastlane-plugin-wpmreleasetoolkit', git: 'https://github.com/wordpress-mobile/release-toolkit', branch: '' diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index ab040f397a87..c56d9bccee36 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -377,22 +377,21 @@ def generate_prototype_build_number # @param [String] release_version Release version name to attach the files to in Sentry. # def upload_gutenberg_sourcemaps(app:, flavor:, build_type:, release_version:) - # Load Sentry properties + # Load Sentry properties sentry_path = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'src', app, 'sentry.properties') sentry_properties = JavaProperties.load(sentry_path) - sentry_token = sentry_properties[:"auth.token"] - project_slug = sentry_properties[:"defaults.project"] - org_slug = sentry_properties[:"defaults.org"] + sentry_token = sentry_properties[:'auth.token'] + project_slug = sentry_properties[:'defaults.project'] + org_slug = sentry_properties[:'defaults.org'] # The bundle and source map files are extracted from merged assets location created after building the app. # The format is: # E.g.: jetpackJalapenoDebug - assetPath = "#{app.downcase}#{flavor}#{build_type}" - bundle_source_map_path = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'build', 'intermediates','assets', assetPath) + build_asset_folder_name = "#{app.downcase}#{flavor}#{build_type}" + bundle_source_map_path = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'build', 'intermediates', 'assets', build_asset_folder_name) Dir.mktmpdir do |sourcemaps_folder| - # It's important that the bundle and source map files have specific names, otherwise, Sentry - # won't symbolicate the stack traces. + # It's important that the bundle and source map files have specific names, otherwise, Sentry won't symbolicate the stack traces. FileUtils.cp(File.join(bundle_source_map_path, 'index.android.bundle'), File.join(sourcemaps_folder, 'index.android.bundle')) FileUtils.cp(File.join(bundle_source_map_path, 'index.android.bundle.map'), File.join(sourcemaps_folder, 'index.android.bundle.map')) @@ -401,9 +400,9 @@ def upload_gutenberg_sourcemaps(app:, flavor:, build_type:, release_version:) org_slug: org_slug, project_slug: project_slug, version: release_version, - # When the React native bundle is generated, the source map file references - # include the local machine path, with the `rewrite` and `strip_common_prefix` - # options Sentry automatically strips this part. + # When the React native bundle is generated, the source map file references include the local machine path, with the `rewrite` and + # `strip_common_prefix` include the local machine path, with the `rewrite` and `strip_common_prefix` options Sentry automatically + # strips this part. rewrite: true, strip_common_prefix: true, sourcemap: sourcemaps_folder From 1a63c72351e6b368c9046a7b650e52019149e9da Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Mon, 4 Mar 2024 11:30:56 +0100 Subject: [PATCH 07/24] Update inline comment of `sentry_upload_sourcemap` invocation Co-authored-by: Olivier Halligon --- fastlane/lanes/build.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index c56d9bccee36..e2e2975c578f 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -400,9 +400,8 @@ def upload_gutenberg_sourcemaps(app:, flavor:, build_type:, release_version:) org_slug: org_slug, project_slug: project_slug, version: release_version, - # When the React native bundle is generated, the source map file references include the local machine path, with the `rewrite` and - # `strip_common_prefix` include the local machine path, with the `rewrite` and `strip_common_prefix` options Sentry automatically - # strips this part. + # When the React native bundle is generated, the source map file references include the local machine path; + # With the `rewrite` and `strip_common_prefix` options, Sentry automatically strips this part. rewrite: true, strip_common_prefix: true, sourcemap: sourcemaps_folder From e87d6d8481707cfb938788bdceda07a9f50f807f Mon Sep 17 00:00:00 2001 From: jhnstn Date: Mon, 4 Mar 2024 17:37:53 -0500 Subject: [PATCH 08/24] remove past tense 'did' --- .../gutenberg/GutenbergContainerFragment.java | 6 +++--- .../editor/gutenberg/GutenbergEditorFragment.java | 15 +++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java index 073595329e40..17116b8ec398 100644 --- a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java +++ b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergContainerFragment.java @@ -31,11 +31,11 @@ import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnEditorAutosaveListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnEditorMountListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGetContentInterrupted; -import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnDidLogExceptionListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGutenbergDidRequestEmbedFullscreenPreviewListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGutenbergDidRequestUnsupportedBlockFallbackListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGutenbergDidSendButtonPressedActionListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnImageFullscreenPreviewListener; +import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnLogExceptionListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnReattachMediaSavingQueryListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnReattachMediaUploadQueryListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnFocalPointPickerTooltipShownEventListener; @@ -101,7 +101,7 @@ public void attachToContainer(ViewGroup viewGroup, OnMediaLibraryButtonListener OnToggleRedoButtonListener onToggleRedoButtonListener, OnConnectionStatusEventListener onConnectionStatusEventListener, OnBackHandlerEventListener onBackHandlerEventListener, - OnDidLogExceptionListener onDidLogExceptionListener, + OnLogExceptionListener onLogExceptionListener, boolean isDarkMode) { mWPAndroidGlueCode.attachToContainer( viewGroup, @@ -129,7 +129,7 @@ public void attachToContainer(ViewGroup viewGroup, OnMediaLibraryButtonListener onToggleRedoButtonListener, onConnectionStatusEventListener, onBackHandlerEventListener, - onDidLogExceptionListener, + onLogExceptionListener, isDarkMode); } diff --git a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 20ee5b06c928..5a374f96a554 100644 --- a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -47,10 +47,10 @@ import org.wordpress.android.editor.EditorThemeUpdateListener; import org.wordpress.android.editor.LiveTextWatcher; import org.wordpress.android.editor.R; -import org.wordpress.android.editor.savedinstance.SavedInstanceDatabase; import org.wordpress.android.editor.WPGutenbergWebViewActivity; import org.wordpress.android.editor.gutenberg.GutenbergDialogFragment.GutenbergDialogNegativeClickInterface; import org.wordpress.android.editor.gutenberg.GutenbergDialogFragment.GutenbergDialogPositiveClickInterface; +import org.wordpress.android.editor.savedinstance.SavedInstanceDatabase; import org.wordpress.android.util.AppLog; import org.wordpress.android.util.AppLog.T; import org.wordpress.android.util.DateTimeUtils; @@ -70,19 +70,19 @@ import org.wordpress.mobile.WPAndroidGlue.RequestExecutor; import org.wordpress.mobile.WPAndroidGlue.ShowSuggestionsUtil; import org.wordpress.mobile.WPAndroidGlue.UnsupportedBlock; -import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnBlockTypeImpressionsEventListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnBackHandlerEventListener; +import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnBlockTypeImpressionsEventListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnConnectionStatusEventListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnContentInfoReceivedListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnCustomerSupportOptionsListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnEditorMountListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnFocalPointPickerTooltipShownEventListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGetContentInterrupted; -import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnDidLogExceptionListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGutenbergDidRequestEmbedFullscreenPreviewListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGutenbergDidRequestPreviewListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGutenbergDidRequestUnsupportedBlockFallbackListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnGutenbergDidSendButtonPressedActionListener; +import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnLogExceptionListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaFilesCollectionBasedBlockEditorListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnMediaLibraryButtonListener; import org.wordpress.mobile.WPAndroidGlue.WPAndroidGlueCode.OnReattachMediaSavingQueryListener; @@ -606,13 +606,12 @@ public void onGotoCustomerSupportOptions() { } }, - new OnDidLogExceptionListener() { - @Override public void didLogException(GutenbergJsException exception, - LogExceptionCallback onLogExceptionCallback) { - AppLog.d(T.EDITOR, "Gutenberg JS Exception in GB editor fragment"); - onLogExceptionCallback.onLogException(true); + new OnLogExceptionListener() { + @Override public void onLogException(GutenbergJsException exception, LogExceptionCallback onLogExceptionCallback) { + } }, + GutenbergUtils.isDarkMode(getActivity())); // request dependency injection. Do this after setting min/max dimensions From b31495c6e4eb71e3fe211a818215dadec1db068e Mon Sep 17 00:00:00 2001 From: jhnstn Date: Wed, 6 Mar 2024 10:40:16 -0500 Subject: [PATCH 09/24] Pass the exception event data through the editor lib --- libs/editor/build.gradle | 1 + .../editor/EditorFragmentAbstract.java | 4 ++ .../gutenberg/GutenbergEditorFragment.java | 37 ++++++++++++++++++- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/libs/editor/build.gradle b/libs/editor/build.gradle index 1c92342a989d..ef564639d83c 100644 --- a/libs/editor/build.gradle +++ b/libs/editor/build.gradle @@ -104,6 +104,7 @@ dependencies { implementation "com.google.android.material:material:$googleMaterialVersion" implementation "com.android.volley:volley:$androidVolleyVersion" implementation "com.google.code.gson:gson:$googleGsonVersion" + implementation "com.automattic:Automattic-Tracks-Android:$automatticTracksVersion" lintChecks "org.wordpress:lint:$wordPressLintVersion" } diff --git a/libs/editor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java b/libs/editor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java index 5b1bb2d64c17..efad891ad4a6 100644 --- a/libs/editor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java +++ b/libs/editor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java @@ -14,6 +14,8 @@ import androidx.lifecycle.LiveData; import com.android.volley.toolbox.ImageLoader; +import com.automattic.android.tracks.crashlogging.JsException; +import com.automattic.android.tracks.crashlogging.JsExceptionCallback; import org.wordpress.android.editor.gutenberg.DialogVisibilityProvider; import org.wordpress.android.util.helpers.MediaFile; @@ -238,6 +240,8 @@ public interface EditorFragmentListener extends DialogVisibilityProvider { void onToggleRedo(boolean isDisabled); void onBackHandlerButton(); + + void onLogJsException(JsException jsException, JsExceptionCallback onSendJsException); } /** diff --git a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index 5a374f96a554..f595de2a67d7 100644 --- a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -33,6 +33,9 @@ import androidx.lifecycle.LiveData; import com.android.volley.toolbox.ImageLoader; +import com.automattic.android.tracks.crashlogging.JsException; +import com.automattic.android.tracks.crashlogging.JsExceptionCallback; +import com.automattic.android.tracks.crashlogging.JsExceptionStackTraceElement; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.bridge.WritableNativeMap; import com.google.android.material.dialog.MaterialAlertDialogBuilder; @@ -64,7 +67,7 @@ import org.wordpress.aztec.IHistoryListener; import org.wordpress.mobile.ReactNativeGutenbergBridge.GutenbergBridgeJS2Parent.LogExceptionCallback; import org.wordpress.mobile.ReactNativeGutenbergBridge.GutenbergEmbedWebViewActivity; -import org.wordpress.mobile.ReactNativeGutenbergBridge.GutenbergJsException; +import org.wordpress.mobile.WPAndroidGlue.GutenbergJsException; import org.wordpress.mobile.WPAndroidGlue.Media; import org.wordpress.mobile.WPAndroidGlue.MediaOption; import org.wordpress.mobile.WPAndroidGlue.RequestExecutor; @@ -93,9 +96,11 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; import static org.wordpress.mobile.WPAndroidGlue.Media.createRNMediaUsingMimeType; @@ -607,8 +612,36 @@ public void onGotoCustomerSupportOptions() { }, new OnLogExceptionListener() { - @Override public void onLogException(GutenbergJsException exception, LogExceptionCallback onLogExceptionCallback) { + @Override public void onLogException(GutenbergJsException exception, + LogExceptionCallback logExceptionCallback) { + List stackTraceElements = exception.getStackTrace().stream().map( + stackTrace -> { + return new JsExceptionStackTraceElement( + stackTrace.getFileName(), + stackTrace.getLineNumber(), + stackTrace.getColNumber(), + stackTrace.getFunction() + ); + }).collect(Collectors.toList()); + + JsException jsException = new JsException( + exception.getType(), + exception.getMessage(), + stackTraceElements, + exception.getContext(), + exception.getTags(), + exception.isHandled(), + exception.getHandledBy() + ); + + JsExceptionCallback callback = new JsExceptionCallback() { + @Override + public void onReportSent(boolean success) { + logExceptionCallback.onLogException(success); + } + }; + mEditorFragmentListener.onLogJsException(jsException, callback); } }, From ce6908c335fdd831e577dc5fbc438c44cd14a2b7 Mon Sep 17 00:00:00 2001 From: jhnstn Date: Wed, 6 Mar 2024 10:40:50 -0500 Subject: [PATCH 10/24] Send the exception to the crash logger --- .../org/wordpress/android/ui/posts/EditPostActivity.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index 81623b8f49c6..97e52daaadc4 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -44,6 +44,8 @@ import androidx.viewpager.widget.ViewPager; import com.automattic.android.tracks.crashlogging.CrashLogging; +import com.automattic.android.tracks.crashlogging.JsException; +import com.automattic.android.tracks.crashlogging.JsExceptionCallback; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; @@ -3978,4 +3980,8 @@ public LiveData getSavingInProgressDialogVisibility() { @Nullable private SavedInstanceDatabase getDB() { return SavedInstanceDatabase.Companion.getDatabase(WordPress.getContext()); } + + @Override public void onLogJsException(JsException exception, JsExceptionCallback onExceptionSend) { + mCrashLogging.sendJavaScriptReport(exception, onExceptionSend); + } } From 732fe40a27017e946bbb63539f4a67f67cfcb9d9 Mon Sep 17 00:00:00 2001 From: jhnstn Date: Wed, 6 Mar 2024 12:39:06 -0500 Subject: [PATCH 11/24] Update GB and Tracks sources --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 28d16ced287c..730994e8751a 100644 --- a/build.gradle +++ b/build.gradle @@ -22,8 +22,8 @@ ext { automatticAboutVersion = '1.4.0' automatticRestVersion = '1.0.8' automatticStoriesVersion = '2.4.0' - automatticTracksVersion = '3.4.0' - gutenbergMobileVersion = '6655-a88a07389f55bcf5a233a57ff01802dbe3968a04' + automatticTracksVersion = '202-fe59b92981312d3e2aef96663fb68e278e1e5676' + gutenbergMobileVersion = '6690-fe13279a7f5b1ffeef51c48b8aebf0e8b239008d' wordPressAztecVersion = 'v2.0' wordPressFluxCVersion = 'trunk-8b930418a49b0d0846ed56ebf8fd8adad5011901' wordPressLoginVersion = '1.14.0' From 6291d17ceb8e6480f51c4adb7d11364ffb0f6aa2 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 7 Mar 2024 14:29:22 +0100 Subject: [PATCH 12/24] Add missing import in `GutenbergEditorFragment` --- .../android/editor/gutenberg/GutenbergEditorFragment.java | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java index edf690f91e16..4d2057d509a7 100644 --- a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java +++ b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergEditorFragment.java @@ -94,6 +94,7 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; From 278fc9af8f4fe95daab913479b2e6c892df3175e Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 7 Mar 2024 16:58:00 +0100 Subject: [PATCH 13/24] Update Gutenberg Mobile reference --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 60ebc64ce65a..e67b5ebcc839 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ ext { automatticAboutVersion = '1.4.0' automatticRestVersion = '1.0.8' automatticTracksVersion = '202-fe59b92981312d3e2aef96663fb68e278e1e5676' - gutenbergMobileVersion = '6690-fe13279a7f5b1ffeef51c48b8aebf0e8b239008d' + gutenbergMobileVersion = '6655-46d7600c3a310d0957002f81db5a54a1eb9306f9' wordPressAztecVersion = 'v2.0' wordPressFluxCVersion = '2.70.0' wordPressLoginVersion = '1.14.1' From e63da6352eee449a11e97bd1025d2568dd073ea8 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 7 Mar 2024 17:22:34 +0100 Subject: [PATCH 14/24] Update Tracks reference --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e67b5ebcc839..9b50143f0319 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ ext { // libs automatticAboutVersion = '1.4.0' automatticRestVersion = '1.0.8' - automatticTracksVersion = '202-fe59b92981312d3e2aef96663fb68e278e1e5676' + automatticTracksVersion = '202-7e1247ef05fd6f8afed3090d3d4f0cee66017355' gutenbergMobileVersion = '6655-46d7600c3a310d0957002f81db5a54a1eb9306f9' wordPressAztecVersion = 'v2.0' wordPressFluxCVersion = '2.70.0' From 6b0ad110eb9b99f343d537c76184c8b221a53971 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 7 Mar 2024 17:58:36 +0100 Subject: [PATCH 15/24] Update Tracks reference --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9b50143f0319..65dadeaa4318 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ ext { // libs automatticAboutVersion = '1.4.0' automatticRestVersion = '1.0.8' - automatticTracksVersion = '202-7e1247ef05fd6f8afed3090d3d4f0cee66017355' + automatticTracksVersion = '202-9313f55c7be90b4e4e229fde3cb8ee9b19b6ed3e' gutenbergMobileVersion = '6655-46d7600c3a310d0957002f81db5a54a1eb9306f9' wordPressAztecVersion = 'v2.0' wordPressFluxCVersion = '2.70.0' From 9408f2956299c590b8051ecb6538de56839eb6cc Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 7 Mar 2024 18:23:17 +0100 Subject: [PATCH 16/24] Include Tracks Maven group in editor library --- libs/editor/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/editor/build.gradle b/libs/editor/build.gradle index ef564639d83c..71cbcb4aaf6e 100644 --- a/libs/editor/build.gradle +++ b/libs/editor/build.gradle @@ -13,6 +13,8 @@ repositories { includeGroup "org.wordpress.aztec" includeGroup "org.wordpress.gutenberg-mobile" includeGroupByRegex "org.wordpress.react-native-libraries.*" + includeGroup "com.automattic" + includeGroup "com.automattic.tracks" } } maven { From b2ff729c50a89e41f7bffdcee1cd1ce7ff02b9ed Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 7 Mar 2024 18:59:24 +0100 Subject: [PATCH 17/24] Fix `sentry.properties` path in `upload_gutenberg_sourcemaps` --- fastlane/lanes/build.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index e2e2975c578f..6268c8853d43 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -378,7 +378,7 @@ def generate_prototype_build_number # def upload_gutenberg_sourcemaps(app:, flavor:, build_type:, release_version:) # Load Sentry properties - sentry_path = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'src', app, 'sentry.properties') + sentry_path = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'src', app.downcase, 'sentry.properties') sentry_properties = JavaProperties.load(sentry_path) sentry_token = sentry_properties[:'auth.token'] project_slug = sentry_properties[:'defaults.project'] From 08b53550f4a9659d9135ecf2be576a5eb1161da4 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 7 Mar 2024 19:53:54 +0100 Subject: [PATCH 18/24] Add `dist` parameter to `sentry_upload_sourcemap` --- fastlane/lanes/build.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index 6268c8853d43..9d04fb4a2b49 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -400,6 +400,7 @@ def upload_gutenberg_sourcemaps(app:, flavor:, build_type:, release_version:) org_slug: org_slug, project_slug: project_slug, version: release_version, + dist: current_build_code, # When the React native bundle is generated, the source map file references include the local machine path; # With the `rewrite` and `strip_common_prefix` options, Sentry automatically strips this part. rewrite: true, From 31beaac018bf55a3c65ee7e9b92215112d019ec7 Mon Sep 17 00:00:00 2001 From: jhnstn Date: Fri, 8 Mar 2024 10:03:05 -0500 Subject: [PATCH 19/24] Update tracks to latest version: 3.5.0 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 65dadeaa4318..755c322fb8ea 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ ext { // libs automatticAboutVersion = '1.4.0' automatticRestVersion = '1.0.8' - automatticTracksVersion = '202-9313f55c7be90b4e4e229fde3cb8ee9b19b6ed3e' + automatticTracksVersion = '3.5.0' gutenbergMobileVersion = '6655-46d7600c3a310d0957002f81db5a54a1eb9306f9' wordPressAztecVersion = 'v2.0' wordPressFluxCVersion = '2.70.0' From 82fe4b6981cd8352135877d7ab167b5b48e0f0fa Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Mon, 11 Mar 2024 18:49:09 +0100 Subject: [PATCH 20/24] Update Gutenberg Mobile reference --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 755c322fb8ea..a708719acf66 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ ext { automatticAboutVersion = '1.4.0' automatticRestVersion = '1.0.8' automatticTracksVersion = '3.5.0' - gutenbergMobileVersion = '6655-46d7600c3a310d0957002f81db5a54a1eb9306f9' + gutenbergMobileVersion = 'v1.115.0-alpha5' wordPressAztecVersion = 'v2.0' wordPressFluxCVersion = '2.70.0' wordPressLoginVersion = '1.14.1' From 57cc01c295b667ea8364348a8955f8ad2df5092c Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 12 Mar 2024 13:38:59 +0100 Subject: [PATCH 21/24] Copy bundle and source map files to a specific build folder --- WordPress/build.gradle | 17 +++++++++++++++++ fastlane/lanes/build.rb | 35 +++++++++++++++-------------------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/WordPress/build.gradle b/WordPress/build.gradle index 64f3a2d61c06..f7665e3365e6 100644 --- a/WordPress/build.gradle +++ b/WordPress/build.gradle @@ -719,3 +719,20 @@ if (project.hasProperty("debugStoreFile")) { } } } + +// Copy React Native JavaScript bundle and source map so they can be upload it to the Crash logging +// service during the build process. +android { + applicationVariants.all { variant -> + variant.mergeAssetsProvider.configure { + doLast { + // Copy bundle and source map files + copy { + from(outputDir) + into("${buildDir}/react-native-bundle-source-map") + include("*.bundle", "*.bundle.map") + } + } + } + } +} diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index 9d04fb4a2b49..cdd80a5db149 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -388,25 +388,20 @@ def upload_gutenberg_sourcemaps(app:, flavor:, build_type:, release_version:) # The format is: # E.g.: jetpackJalapenoDebug build_asset_folder_name = "#{app.downcase}#{flavor}#{build_type}" - bundle_source_map_path = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'build', 'intermediates', 'assets', build_asset_folder_name) - - Dir.mktmpdir do |sourcemaps_folder| - # It's important that the bundle and source map files have specific names, otherwise, Sentry won't symbolicate the stack traces. - FileUtils.cp(File.join(bundle_source_map_path, 'index.android.bundle'), File.join(sourcemaps_folder, 'index.android.bundle')) - FileUtils.cp(File.join(bundle_source_map_path, 'index.android.bundle.map'), File.join(sourcemaps_folder, 'index.android.bundle.map')) - - sentry_upload_sourcemap( - auth_token: sentry_token, - org_slug: org_slug, - project_slug: project_slug, - version: release_version, - dist: current_build_code, - # When the React native bundle is generated, the source map file references include the local machine path; - # With the `rewrite` and `strip_common_prefix` options, Sentry automatically strips this part. - rewrite: true, - strip_common_prefix: true, - sourcemap: sourcemaps_folder - ) - end + # Bundle and source map files are copied to a specific folder as part of the build process. + bundle_source_map_path = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'build', 'react-native-bundle-source-map') + + sentry_upload_sourcemap( + auth_token: sentry_token, + org_slug: org_slug, + project_slug: project_slug, + version: release_version, + dist: current_build_code, + # When the React native bundle is generated, the source map file references include the local machine path; + # With the `rewrite` and `strip_common_prefix` options, Sentry automatically strips this part. + rewrite: true, + strip_common_prefix: true, + sourcemap: bundle_source_map_path + ) end end From fe456792c3baac9e9d1e22bcc1f7c236ac54bd7e Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 12 Mar 2024 13:39:16 +0100 Subject: [PATCH 22/24] Exclude React Native source map when building the app --- WordPress/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WordPress/build.gradle b/WordPress/build.gradle index f7665e3365e6..22a8cfff484a 100644 --- a/WordPress/build.gradle +++ b/WordPress/build.gradle @@ -286,9 +286,6 @@ android { exclude '**/libjscexecutor.so' exclude '**/libfabricjni.so' - // Exclude React Native's JavaScript source map - exclude '**/*.bundle.map' - // Avoid React Native's JNI duplicated classes pickFirst '**/libc++_shared.so' pickFirst '**/libfbjni.so' @@ -732,6 +729,9 @@ android { into("${buildDir}/react-native-bundle-source-map") include("*.bundle", "*.bundle.map") } + + // Delete source maps + delete(fileTree(dir: outputDir, includes: ['**/*.bundle.map'])) } } } From 17ba9b95a67a3439ea8906005c572e13deb7dc64 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 12 Mar 2024 13:43:21 +0100 Subject: [PATCH 23/24] Remove unnecessary `build_asset_folder_name` variable in `upload_gutenberg_sourcemaps` --- fastlane/lanes/build.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index cdd80a5db149..8d27a671dcfc 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -384,11 +384,7 @@ def upload_gutenberg_sourcemaps(app:, flavor:, build_type:, release_version:) project_slug = sentry_properties[:'defaults.project'] org_slug = sentry_properties[:'defaults.org'] - # The bundle and source map files are extracted from merged assets location created after building the app. - # The format is: - # E.g.: jetpackJalapenoDebug - build_asset_folder_name = "#{app.downcase}#{flavor}#{build_type}" - # Bundle and source map files are copied to a specific folder as part of the build process. + # Bundle and source map files are copied to a specific folder as part of the build process. bundle_source_map_path = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'build', 'react-native-bundle-source-map') sentry_upload_sourcemap( From eadc0975b7f80cc9627f031868ff73d483944cec Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 12 Mar 2024 13:46:33 +0100 Subject: [PATCH 24/24] Remove unnecessary params from `upload_gutenberg_sourcemaps` --- fastlane/lanes/build.rb | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index 8d27a671dcfc..9cfa6db8f1b0 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -34,12 +34,10 @@ # Create the file names app = get_app_name_option!(options) version_name = current_version_name - flavor = 'Vanilla' - build_type = 'Release' - build_bundle(app: app, version_name: version_name, build_code: current_build_code, flavor: flavor, buildType: build_type) + build_bundle(app: app, version_name: version_name, build_code: current_build_code, flavor: 'Vanilla', buildType: 'Release') upload_build_to_play_store(app: app, version_name: version_name, track: 'production') - upload_gutenberg_sourcemaps(app: app, flavor: flavor, build_type: build_type, release_version: version_name) + upload_gutenberg_sourcemaps(app: app, release_version: version_name) create_gh_release(app: app, version_name: version_name) if options[:create_release] end @@ -105,12 +103,10 @@ # Create the file names app = get_app_name_option!(options) version_name = current_version_name - flavor = 'Vanilla' - build_type = 'Release' - build_bundle(app: app, version_name: version_name, build_code: current_build_code, flavor: flavor, buildType: build_type) + build_bundle(app: app, version_name: version_name, build_code: current_build_code, flavor: 'Vanilla', buildType: 'Release') upload_build_to_play_store(app: app, version_name: version_name, track: 'beta') if options[:upload_to_play_store] - upload_gutenberg_sourcemaps(app: app, flavor: flavor, build_type: build_type, release_version: version_name) + upload_gutenberg_sourcemaps(app: app, release_version: version_name) create_gh_release(app: app, version_name: version_name, prerelease: true) if options[:create_release] end @@ -223,7 +219,7 @@ ) upload_prototype_build(product: 'WordPress', version_name: version_name) - upload_gutenberg_sourcemaps(app: 'Wordpress', flavor: PROTOTYPE_BUILD_FLAVOR, build_type: PROTOTYPE_BUILD_TYPE, release_version: version_name) + upload_gutenberg_sourcemaps(app: 'Wordpress', release_version: version_name) end ##################################################################################### @@ -247,7 +243,7 @@ ) upload_prototype_build(product: 'Jetpack', version_name: version_name) - upload_gutenberg_sourcemaps(app: 'Jetpack', flavor: PROTOTYPE_BUILD_FLAVOR, build_type: PROTOTYPE_BUILD_TYPE, release_version: version_name) + upload_gutenberg_sourcemaps(app: 'Jetpack', release_version: version_name) end ##################################################################################### @@ -372,11 +368,9 @@ def generate_prototype_build_number # These files are provided by the Gutenberg Mobile library. # # @param [String] app App name, e.g. 'WordPress' or 'Jetpack'. - # @param [String] flavor Build flavor, e.g. 'Jalapeno' or 'Vanilla'. - # @param [String] build_type Build type, e.g. 'Debug' or 'Release'. # @param [String] release_version Release version name to attach the files to in Sentry. # - def upload_gutenberg_sourcemaps(app:, flavor:, build_type:, release_version:) + def upload_gutenberg_sourcemaps(app:, release_version:) # Load Sentry properties sentry_path = File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'src', app.downcase, 'sentry.properties') sentry_properties = JavaProperties.load(sentry_path)