From 3aa690701943de9b2a8834e2a6233097a29e1830 Mon Sep 17 00:00:00 2001 From: markoburcul Date: Thu, 2 Jan 2025 15:05:29 +0100 Subject: [PATCH 1/8] ci: enable sentry for releases referenced issue: https://github.com/status-im/status-mobile/issues/21706 Signed-off-by: markoburcul --- ci/Jenkinsfile.android | 3 ++- ci/Jenkinsfile.combined | 2 +- ci/Jenkinsfile.ios | 3 ++- nix/status-go/mobile/build.nix | 6 +++++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index 91bda9a36d1..97f2ec2978a 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.9.13' +library 'status-jenkins-lib@v1.9.15' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() @@ -41,6 +41,7 @@ pipeline { BUILD_ENV = 'prod' NIX_CONF_DIR = "${env.WORKSPACE}/nix" FASTLANE_DISABLE_COLORS = 1 + SENTRY_PRODUCTION = "${utils.isReleaseBuild() ? 'true' : 'false'}" } stages { diff --git a/ci/Jenkinsfile.combined b/ci/Jenkinsfile.combined index 640802fdffd..1adaf753c18 100644 --- a/ci/Jenkinsfile.combined +++ b/ci/Jenkinsfile.combined @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.9.13' +library 'status-jenkins-lib@v1.9.15' import groovy.json.JsonBuilder diff --git a/ci/Jenkinsfile.ios b/ci/Jenkinsfile.ios index 661701e4a43..fa160b49c42 100644 --- a/ci/Jenkinsfile.ios +++ b/ci/Jenkinsfile.ios @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.9.13' +library 'status-jenkins-lib@v1.9.15' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() @@ -41,6 +41,7 @@ pipeline { NIX_CONF_DIR = "${env.WORKSPACE}/nix" FASTLANE_DISABLE_COLORS = 1 BUNDLE_PATH = "${HOME}/.bundle" + SENTRY_PRODUCTION = "${utils.isReleaseBuild() ? 'true' : 'false'}" } stages { diff --git a/nix/status-go/mobile/build.nix b/nix/status-go/mobile/build.nix index 6f3872f73c6..663c9e4942d 100644 --- a/nix/status-go/mobile/build.nix +++ b/nix/status-go/mobile/build.nix @@ -11,7 +11,7 @@ , outputFileName ? "status-go-${source.shortRev}-${platform}.aar" }: let - inherit (lib) concatStringsSep optionalString optional splitString; + inherit (lib) concatStringsSep optionalString optional splitString fileContents; isIOS = platform == "ios"; isAndroid = platform == "android"; enforceXCodeAvailable = callPackage ./enforceXCodeAvailable.nix { }; @@ -46,6 +46,10 @@ in buildGoPackage rec { # TODO: try removing when go is upgraded to 1.22 GODEBUG = "netdns=cgo+2"; + # Sentry for status-go + SENTRY_CONTEXT_NAME = "status-mobile"; + SENTRY_CONTEXT_VERSION = version; + preBuild = '' echo 'Generate static files' pushd go/src/$goPackagePath From 68bb4e33891d9ccd91ec2d74bd2424599be2cc41 Mon Sep 17 00:00:00 2001 From: Icaro Motta Date: Fri, 22 Nov 2024 19:20:32 -0300 Subject: [PATCH 2/8] Configure Sentry --- .env | 1 + .env.e2e | 1 + .env.jenkins | 1 + .env.nightly | 1 + .env.release | 1 + .../im/status/ethereum/module/StatusModule.kt | 9 +++++++++ .../react-native-status/ios/RCTStatus/RCTStatus.m | 7 +++++++ shadow-cljs.edn | 1 + .../ui/screens/advanced_settings/views.cljs | 10 +++++++++- src/native_module/core.cljs | 4 ++++ src/status_im/common/app_monitoring/effects.cljs | 8 ++++++++ src/status_im/common/app_monitoring/events.cljs | 8 ++++++++ src/status_im/config.cljs | 5 +++++ src/status_im/contexts/profile/events.cljs | 1 + src/status_im/events.cljs | 1 + src/status_im/feature_flags.cljs | 1 + src/tests/test_utils.cljs | 15 ++++++--------- 17 files changed, 65 insertions(+), 10 deletions(-) create mode 100644 src/status_im/common/app_monitoring/effects.cljs create mode 100644 src/status_im/common/app_monitoring/events.cljs diff --git a/.env b/.env index d2afc6525f1..2bee64a57d4 100644 --- a/.env +++ b/.env @@ -36,3 +36,4 @@ SHOW_NOT_IMPLEMENTED_FEATURES=0 ENABLE_ALERT_BANNER=0 FLAG_WALLET_CONNECT_ENABLED=1 API_LOGGING_ENABLED=1 +SENTRY_ENVIRONMENT=ci-main diff --git a/.env.e2e b/.env.e2e index 54454a0a815..3a472512988 100644 --- a/.env.e2e +++ b/.env.e2e @@ -40,3 +40,4 @@ ENABLE_ALERT_BANNER=0 FLAG_WALLET_CONNECT_ENABLED=1 MOBILE_DATA_SYNCING_TOGGLE_ENABLE=0 API_LOGGING_ENABLED=1 +SENTRY_ENVIRONMENT=ci-main diff --git a/.env.jenkins b/.env.jenkins index 041440679d2..3376e24ffb9 100644 --- a/.env.jenkins +++ b/.env.jenkins @@ -37,3 +37,4 @@ TEST_NETWORKS_ENABLED=1 ENABLE_ALERT_BANNER=1 FLAG_WALLET_CONNECT_ENABLED=1 API_LOGGING_ENABLED=1 +SENTRY_ENVIRONMENT=ci-main diff --git a/.env.nightly b/.env.nightly index cf21f031e94..748692e487e 100644 --- a/.env.nightly +++ b/.env.nightly @@ -24,3 +24,4 @@ TEST_NETWORKS_ENABLED=0 ENABLE_ALERT_BANNER=1 FLAG_WALLET_CONNECT_ENABLED=1 API_LOGGING_ENABLED=1 +SENTRY_ENVIRONMENT=ci-nightly diff --git a/.env.release b/.env.release index c34df0d0eee..4edcc8be344 100644 --- a/.env.release +++ b/.env.release @@ -21,3 +21,4 @@ TEST_NETWORKS_ENABLED=0 STATUS_PROXY_STAGE_NAME=prod FLAG_WALLET_CONNECT_ENABLED=1 API_LOGGING_ENABLED=0 +SENTRY_ENVIRONMENT=production diff --git a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt index 720e89f9a80..c4312286764 100644 --- a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt +++ b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt @@ -108,6 +108,15 @@ class StatusModule(private val reactContext: ReactApplicationContext, private va ) } + @ReactMethod + fun intendedPanic(message: String) { + StatusBackendClient.executeStatusGoRequest( + endpoint = "IntendedPanic", + requestBody = "", + statusgoFunction = { Statusgo.intendedPanic(message) }, + ) + } + @ReactMethod fun addCentralizedMetric(request: String, callback: Callback) { StatusBackendClient.executeStatusGoRequestWithCallback( diff --git a/modules/react-native-status/ios/RCTStatus/RCTStatus.m b/modules/react-native-status/ios/RCTStatus/RCTStatus.m index 00842f9dea1..50af3fe5139 100644 --- a/modules/react-native-status/ios/RCTStatus/RCTStatus.m +++ b/modules/react-native-status/ios/RCTStatus/RCTStatus.m @@ -109,6 +109,13 @@ - (void)handleSignal:(NSString *)signal callback:callback]; } +RCT_EXPORT_METHOD(intendedPanic:(NSString *)message) { +#if DEBUG + NSLog(@"IntendedPanic() method called"); +#endif + StatusgoIntendedPanic(message); +} + RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(fleets) { return [StatusBackendClient executeStatusGoRequestWithResult:@"Fleets" body:@"" diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 0283dab6961..93dd303f96a 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -77,6 +77,7 @@ #shadow/env "STATUS_BACKEND_SERVER_IMAGE_SERVER_URI_PREFIX" status-im.config/STATUS_BACKEND_SERVER_ROOT_DATA_DIR #shadow/env "STATUS_BACKEND_SERVER_ROOT_DATA_DIR" + status-im.config/SENTRY_DSN_STATUS_GO #shadow/env "SENTRY_DSN_STATUS_GO" status-im.config/MIXPANEL_APP_ID #shadow/env "MIXPANEL_APP_ID" status-im.config/MIXPANEL_TOKEN #shadow/env "MIXPANEL_TOKEN" status-im.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY" diff --git a/src/legacy/status_im/ui/screens/advanced_settings/views.cljs b/src/legacy/status_im/ui/screens/advanced_settings/views.cljs index e6ae1b5e5f2..40fdf2eeb68 100644 --- a/src/legacy/status_im/ui/screens/advanced_settings/views.cljs +++ b/src/legacy/status_im/ui/screens/advanced_settings/views.cljs @@ -5,6 +5,7 @@ [legacy.status-im.ui.components.list.views :as list] [quo.core :as quo] [re-frame.core :as re-frame] + [status-im.feature-flags :as ff] [utils.i18n :as i18n] [utils.re-frame :as rf]) (:require-macros [legacy.status-im.utils.views :as views])) @@ -22,7 +23,14 @@ peer-syncing-enabled?]}] (keep identity - [{:size :small + [(when (ff/enabled? ::ff/app-monitoring.intentional-crash) + {:size :small + :title "Force crash immediately" + :accessibility-label :intended-panic + :on-press (fn [] + (re-frame/dispatch [:app-monitoring/intended-panic + "status-mobile intentional panic"]))}) + {:size :small :title (i18n/label :t/log-level) :accessibility-label :log-level-settings-button :on-press diff --git a/src/native_module/core.cljs b/src/native_module/core.cljs index fc1f3a4ee81..e399b9ac1e8 100644 --- a/src/native_module/core.cljs +++ b/src/native_module/core.cljs @@ -581,3 +581,7 @@ (.createAccountFromPrivateKey ^js (account-manager) (types/clj->json {:privateKey private-key}) callback))) + +(defn intended-panic + [message] + (.intendedPanic ^js (status) message)) diff --git a/src/status_im/common/app_monitoring/effects.cljs b/src/status_im/common/app_monitoring/effects.cljs new file mode 100644 index 00000000000..7939d6f942c --- /dev/null +++ b/src/status_im/common/app_monitoring/effects.cljs @@ -0,0 +1,8 @@ +(ns status-im.common.app-monitoring.effects + (:require + [native-module.core :as native-module] + [utils.re-frame :as rf])) + +(rf/reg-fx :effects.app-monitoring/intended-panic + (fn [message] + (native-module/intended-panic message))) diff --git a/src/status_im/common/app_monitoring/events.cljs b/src/status_im/common/app_monitoring/events.cljs new file mode 100644 index 00000000000..d66ab5c6ef8 --- /dev/null +++ b/src/status_im/common/app_monitoring/events.cljs @@ -0,0 +1,8 @@ +(ns status-im.common.app-monitoring.events + (:require + status-im.common.app-monitoring.effects + [utils.re-frame :as rf])) + +(rf/reg-event-fx :app-monitoring/intended-panic + (fn [_ [message]] + {:fx [[:effects.app-monitoring/intended-panic message]]})) diff --git a/src/status_im/config.cljs b/src/status_im/config.cljs index 86877c589ee..2f51e9bebfc 100644 --- a/src/status_im/config.cljs +++ b/src/status_im/config.cljs @@ -150,3 +150,8 @@ (goog-define STATUS_BACKEND_SERVER_ROOT_DATA_DIR "") ;; if you're using android simulator, I suggest set the env variable to "http://10.0.2.2:" (goog-define STATUS_BACKEND_SERVER_IMAGE_SERVER_URI_PREFIX "https://localhost:") + +;;;; Sentry +;; Documentation: status-go/internal/sentry/README.md +(goog-define SENTRY_DSN_STATUS_GO "") +(def sentry-dsn-status-go SENTRY_DSN_STATUS_GO) diff --git a/src/status_im/contexts/profile/events.cljs b/src/status_im/contexts/profile/events.cljs index 0b32c07fb3f..fa0f053341b 100644 --- a/src/status_im/contexts/profile/events.cljs +++ b/src/status_im/contexts/profile/events.cljs @@ -37,6 +37,7 @@ {:dataDir (native-module/backup-disabled-data-dir) :mixpanelAppId config/mixpanel-app-id :mixpanelToken config/mixpanel-token + :sentryDSN config/sentry-dsn-status-go :mediaServerEnableTLS (config/enabled? config/STATUS_BACKEND_SERVER_MEDIA_SERVER_ENABLE_TLS) :logEnabled (not (string/blank? config/log-level)) :logLevel config/log-level diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index 3b1f2ee3c44..8e3fe542907 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -2,6 +2,7 @@ (:require status-im.common.alert-banner.events status-im.common.alert.effects + status-im.common.app-monitoring.events status-im.common.async-storage.effects status-im.common.emoji-picker.events status-im.common.font.events diff --git a/src/status_im/feature_flags.cljs b/src/status_im/feature_flags.cljs index 23cde910f08..40d7916cbc6 100644 --- a/src/status_im/feature_flags.cljs +++ b/src/status_im/feature_flags.cljs @@ -12,6 +12,7 @@ (def ^:private initial-flags {::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED) ::community.view-token-requirements (enabled-in-env? :FLAG_VIEW_TOKEN_REQUIREMENTS) + ::app-monitoring.intentional-crash (enabled-in-env? :FLAG_INTENTIONAL_CRASH_ENABLED) ;; Feature toggled (off by default) because the desktop app disabled this ;; feature and we want both clients in sync. We keep the code because it diff --git a/src/tests/test_utils.cljs b/src/tests/test_utils.cljs index e1aa16c865d..e8332e1aa3f 100644 --- a/src/tests/test_utils.cljs +++ b/src/tests/test_utils.cljs @@ -126,12 +126,9 @@ (def status (clj->js - {:getNodeConfig - (fn [] (types/clj->json {:WakuV2Config ""})) - :addCentralizedMetric - (fn [_ callback] - (callback)) - :fleets - (fn [] (.fleets native-status)) - :startLocalNotifications - identity})) + {:intendedPanic identity + :getNodeConfig (fn [] (types/clj->json {:WakuV2Config ""})) + :addCentralizedMetric (fn [_ callback] + (callback)) + :fleets (fn [] (.fleets native-status)) + :startLocalNotifications identity})) From ac66c8b324690cab8f656ac77ccad98bc99aba21 Mon Sep 17 00:00:00 2001 From: Icaro Motta Date: Mon, 9 Dec 2024 08:09:22 -0300 Subject: [PATCH 3/8] Warn in UI if Sentry DSN isn't set --- .../status_im/ui/screens/advanced_settings/views.cljs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/legacy/status_im/ui/screens/advanced_settings/views.cljs b/src/legacy/status_im/ui/screens/advanced_settings/views.cljs index 40fdf2eeb68..33e9dfda633 100644 --- a/src/legacy/status_im/ui/screens/advanced_settings/views.cljs +++ b/src/legacy/status_im/ui/screens/advanced_settings/views.cljs @@ -1,10 +1,12 @@ (ns legacy.status-im.ui.screens.advanced-settings.views (:require + [clojure.string :as string] [legacy.status-im.ui.components.core :as components] [legacy.status-im.ui.components.list.item :as list.item] [legacy.status-im.ui.components.list.views :as list] [quo.core :as quo] [re-frame.core :as re-frame] + [status-im.config :as config] [status-im.feature-flags :as ff] [utils.i18n :as i18n] [utils.re-frame :as rf]) @@ -25,7 +27,9 @@ identity [(when (ff/enabled? ::ff/app-monitoring.intentional-crash) {:size :small - :title "Force crash immediately" + :title (str "Force crash immediately" + (when (string/blank? config/sentry-dsn-status-go) + " (Sentry DSN is not set)")) :accessibility-label :intended-panic :on-press (fn [] (re-frame/dispatch [:app-monitoring/intended-panic From b306d8b6c4fa141ed8bcd1d9b7942da3dc258359 Mon Sep 17 00:00:00 2001 From: Icaro Motta Date: Mon, 9 Dec 2024 08:25:55 -0300 Subject: [PATCH 4/8] Add SENTRY_DSN_STATUS_GO to SECRETS_ENV_VARS --- scripts/build-android.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build-android.sh b/scripts/build-android.sh index 7eefa9113aa..65eee9a840a 100755 --- a/scripts/build-android.sh +++ b/scripts/build-android.sh @@ -45,6 +45,7 @@ SECRETS_ENV_VARS=( 'MIXPANEL_APP_ID' 'MIXPANEL_TOKEN' 'POKT_TOKEN' + 'SENTRY_DSN_STATUS_GO' ) # Secrets like this can't be passed via args or they end up in derivation. From ba891c6c7a8591da86e91e55981a4f5a81a1a162 Mon Sep 17 00:00:00 2001 From: Siddarth Kumar Date: Tue, 10 Dec 2024 15:07:50 +0530 Subject: [PATCH 5/8] fix: update `SENTRY_DSN_STATUS_GO ` config --- shadow-cljs.edn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 93dd303f96a..1fa7dd7d347 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -77,7 +77,6 @@ #shadow/env "STATUS_BACKEND_SERVER_IMAGE_SERVER_URI_PREFIX" status-im.config/STATUS_BACKEND_SERVER_ROOT_DATA_DIR #shadow/env "STATUS_BACKEND_SERVER_ROOT_DATA_DIR" - status-im.config/SENTRY_DSN_STATUS_GO #shadow/env "SENTRY_DSN_STATUS_GO" status-im.config/MIXPANEL_APP_ID #shadow/env "MIXPANEL_APP_ID" status-im.config/MIXPANEL_TOKEN #shadow/env "MIXPANEL_TOKEN" status-im.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY" @@ -124,7 +123,8 @@ status-im.config/ALCHEMY_ARBITRUM_MAINNET_TOKEN #shadow/env "ALCHEMY_ARBITRUM_MAINNET_TOKEN" status-im.config/ALCHEMY_ARBITRUM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_ARBITRUM_SEPOLIA_TOKEN" status-im.config/ALCHEMY_OPTIMISM_MAINNET_TOKEN #shadow/env "ALCHEMY_OPTIMISM_MAINNET_TOKEN" - status-im.config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_OPTIMISM_SEPOLIA_TOKEN"} + status-im.config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_OPTIMISM_SEPOLIA_TOKEN" + status-im.config/SENTRY_DSN_STATUS_GO #shadow/env "SENTRY_DSN_STATUS_GO"} :compiler-options {:output-feature-set :es6 ;;disable for android build as there ;;is an intermittent warning with deftype From 108c0f6fcbb8287f61c67e33c19c52778817c329 Mon Sep 17 00:00:00 2001 From: Icaro Motta Date: Tue, 10 Dec 2024 17:57:04 -0300 Subject: [PATCH 6/8] Leave comment about SENTRY_DSN_STATUS_GO var in shadow-cljs for dev builds --- shadow-cljs.edn | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 1fa7dd7d347..30500204dc1 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -77,6 +77,11 @@ #shadow/env "STATUS_BACKEND_SERVER_IMAGE_SERVER_URI_PREFIX" status-im.config/STATUS_BACKEND_SERVER_ROOT_DATA_DIR #shadow/env "STATUS_BACKEND_SERVER_ROOT_DATA_DIR" + + ;; Uncomment this line during development if you want to test the integration with Sentry. + ;; + ;; status-im.config/SENTRY_DSN_STATUS_GO #shadow/env "SENTRY_DSN_STATUS_GO" + status-im.config/MIXPANEL_APP_ID #shadow/env "MIXPANEL_APP_ID" status-im.config/MIXPANEL_TOKEN #shadow/env "MIXPANEL_TOKEN" status-im.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY" From 706d9a8e30f2019fffcd04819051500bb41cb5b3 Mon Sep 17 00:00:00 2001 From: Icaro Motta Date: Thu, 12 Dec 2024 02:15:06 -0300 Subject: [PATCH 7/8] Use StatusBackendClient in native code and pass message argument --- .../src/main/java/im/status/ethereum/module/StatusModule.kt | 2 +- modules/react-native-status/ios/RCTStatus/RCTStatus.m | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt index c4312286764..df2f2206f23 100644 --- a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt +++ b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt @@ -112,7 +112,7 @@ class StatusModule(private val reactContext: ReactApplicationContext, private va fun intendedPanic(message: String) { StatusBackendClient.executeStatusGoRequest( endpoint = "IntendedPanic", - requestBody = "", + requestBody = message, statusgoFunction = { Statusgo.intendedPanic(message) }, ) } diff --git a/modules/react-native-status/ios/RCTStatus/RCTStatus.m b/modules/react-native-status/ios/RCTStatus/RCTStatus.m index 50af3fe5139..73b9902f171 100644 --- a/modules/react-native-status/ios/RCTStatus/RCTStatus.m +++ b/modules/react-native-status/ios/RCTStatus/RCTStatus.m @@ -113,7 +113,11 @@ - (void)handleSignal:(NSString *)signal #if DEBUG NSLog(@"IntendedPanic() method called"); #endif - StatusgoIntendedPanic(message); + [StatusBackendClient executeStatusGoRequest:@"IntendedPanic" + body:message + statusgoFunction:^NSString *{ + return StatusgoIntendedPanic(message); + }]; } RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(fleets) { From 9cff936c086b45a110ec3fd996a9c0d317da8789 Mon Sep 17 00:00:00 2001 From: Siddarth Kumar Date: Tue, 7 Jan 2025 13:27:28 +0530 Subject: [PATCH 8/8] nix: hack fix for missing git and version script --- nix/status-go/mobile/build.nix | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/nix/status-go/mobile/build.nix b/nix/status-go/mobile/build.nix index 663c9e4942d..693825002ad 100644 --- a/nix/status-go/mobile/build.nix +++ b/nix/status-go/mobile/build.nix @@ -1,6 +1,6 @@ { callPackage, lib, buildGoPackage , androidPkgs, openjdk, gomobile, xcodeWrapper, removeReferencesTo -, go-bindata, mockgen, protobuf3_20, protoc-gen-go +, go-bindata, mockgen, protobuf3_20, protoc-gen-go, git , meta , source , platform ? "android" @@ -29,7 +29,7 @@ in buildGoPackage rec { extraSrcPaths = [ gomobile ]; nativeBuildInputs = [ - gomobile removeReferencesTo go-bindata mockgen protoc-gen-go protobuf3_20 + gomobile removeReferencesTo go-bindata mockgen protoc-gen-go protobuf3_20 git ] ++ optional isAndroid openjdk ++ optional isIOS xcodeWrapper; @@ -50,12 +50,27 @@ in buildGoPackage rec { SENTRY_CONTEXT_NAME = "status-mobile"; SENTRY_CONTEXT_VERSION = version; - preBuild = '' - echo 'Generate static files' - pushd go/src/$goPackagePath - make generate SHELL=$SHELL GO111MODULE=on GO_GENERATE_CMD='go generate' - popd - ''; + preBuild = '' + # To fix fatal: not a git repository (or any of the parent directories): .git + git init --quiet --initial-branch=main . + git config user.email "nix@builder" + git config user.name "Nix Builder" + git commit --quiet --allow-empty -m "Initial commit" + git tag -a "v${source.cleanVersion}" -m "Version ${source.cleanVersion}" + + # To fix sh: line 1: ../../_assets/scripts/version.sh: cannot execute: required file not found + mkdir -p go/src/github.com/status-im/status-go/_assets/scripts + cat > go/src/github.com/status-im/status-go/_assets/scripts/version.sh <