From b7a090716d909a57e8ff8d8de624453832e4c4ec Mon Sep 17 00:00:00 2001 From: Anton Iakimov Date: Tue, 29 Aug 2023 15:18:14 +0200 Subject: [PATCH] nix: set ios status-go targets --- Makefile | 3 ++ ci/Jenkinsfile.android | 2 +- ci/Jenkinsfile.combined | 2 +- ci/Jenkinsfile.e2e-nightly | 2 +- ci/Jenkinsfile.ios | 2 +- ci/Jenkinsfile.tests | 2 +- ci/tests/Jenkinsfile.e2e-nightly | 2 +- ci/tests/Jenkinsfile.e2e-prs | 2 +- ci/tests/Jenkinsfile.e2e-upgrade | 2 +- ci/tools/Jenkinsfile.fastlane-clean | 2 +- ci/tools/Jenkinsfile.nix-cache | 2 +- ci/tools/Jenkinsfile.playstore-meta | 2 +- ci/tools/Jenkinsfile.xcode-clean | 2 +- nix/mobile/ios/shells/status-go.nix | 49 ++++++++++++++++------------- nix/status-go/mobile/default.nix | 5 ++- 15 files changed, 44 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index 6a9170d33b..aaf02a9cf2 100644 --- a/Makefile +++ b/Makefile @@ -224,6 +224,7 @@ release-android: keystore build-android ##@build Build signed Android APK @scripts/sign-android.sh result/app-release-unsigned.apk release-ios: export TARGET := ios +release-ios: export IOS_STATUS_GO_TARGETS := ios/arm64 release-ios: export BUILD_ENV ?= prod release-ios: watchman-clean ios-clean jsbundle ##@build Build release for iOS release xcodebuild \ @@ -279,6 +280,7 @@ run-android: ##@run Build Android APK and start it on the device SIMULATOR=iPhone 11 Pro run-ios: export TARGET := ios +run-ios: export IOS_STATUS_GO_TARGETS := iossimulator/amd64 run-ios: ##@run Build iOS app and start it in a simulator/device ifneq ("$(SIMULATOR)", "") npx react-native run-ios --simulator="$(SIMULATOR)" @@ -290,6 +292,7 @@ show-ios-devices: ##@other shows connected ios device and its name xcrun xctrace list devices run-ios-device: export TARGET := ios +run-ios-device: export IOS_STATUS_GO_TARGETS := ios/arm64 run-ios-device: ##@run iOS app and start it on a connected device by its name ifndef DEVICE_NAME $(error Usage: make run-ios-device DEVICE_NAME=your-device-name) diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index 7ce966f980..64d4655370 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.7.12' +library 'status-jenkins-lib@v1.7.14' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() diff --git a/ci/Jenkinsfile.combined b/ci/Jenkinsfile.combined index 76ec377399..ab9a261e7d 100644 --- a/ci/Jenkinsfile.combined +++ b/ci/Jenkinsfile.combined @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.7.12' +library 'status-jenkins-lib@v1.7.14' pipeline { agent { label 'linux' } diff --git a/ci/Jenkinsfile.e2e-nightly b/ci/Jenkinsfile.e2e-nightly index 904db59756..dfe22d11da 100644 --- a/ci/Jenkinsfile.e2e-nightly +++ b/ci/Jenkinsfile.e2e-nightly @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.7.12' +library 'status-jenkins-lib@v1.7.14' pipeline { agent { label 'linux' } diff --git a/ci/Jenkinsfile.ios b/ci/Jenkinsfile.ios index 4f3d91a408..47c09f174f 100644 --- a/ci/Jenkinsfile.ios +++ b/ci/Jenkinsfile.ios @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.7.12' +library 'status-jenkins-lib@set_ios_status_go_targets' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() diff --git a/ci/Jenkinsfile.tests b/ci/Jenkinsfile.tests index 7552320352..d0dd47f206 100644 --- a/ci/Jenkinsfile.tests +++ b/ci/Jenkinsfile.tests @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.7.12' +library 'status-jenkins-lib@v1.7.14' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() diff --git a/ci/tests/Jenkinsfile.e2e-nightly b/ci/tests/Jenkinsfile.e2e-nightly index 8a2ccc67e5..3fadc5f042 100644 --- a/ci/tests/Jenkinsfile.e2e-nightly +++ b/ci/tests/Jenkinsfile.e2e-nightly @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.7.12' +library 'status-jenkins-lib@v1.7.14' pipeline { diff --git a/ci/tests/Jenkinsfile.e2e-prs b/ci/tests/Jenkinsfile.e2e-prs index ad85c8e61e..64dfc43fe7 100644 --- a/ci/tests/Jenkinsfile.e2e-prs +++ b/ci/tests/Jenkinsfile.e2e-prs @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.7.12' +library 'status-jenkins-lib@v1.7.14' pipeline { diff --git a/ci/tests/Jenkinsfile.e2e-upgrade b/ci/tests/Jenkinsfile.e2e-upgrade index 90c69194a5..8d0f2b273c 100644 --- a/ci/tests/Jenkinsfile.e2e-upgrade +++ b/ci/tests/Jenkinsfile.e2e-upgrade @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.7.12' +library 'status-jenkins-lib@v1.7.14' pipeline { diff --git a/ci/tools/Jenkinsfile.fastlane-clean b/ci/tools/Jenkinsfile.fastlane-clean index 312e1d5078..8eb8ec6bf8 100644 --- a/ci/tools/Jenkinsfile.fastlane-clean +++ b/ci/tools/Jenkinsfile.fastlane-clean @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.7.12' +library 'status-jenkins-lib@v1.7.14' pipeline { agent { label 'macos' } diff --git a/ci/tools/Jenkinsfile.nix-cache b/ci/tools/Jenkinsfile.nix-cache index 25e6b515ff..70a19ef3f7 100644 --- a/ci/tools/Jenkinsfile.nix-cache +++ b/ci/tools/Jenkinsfile.nix-cache @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.7.12' +library 'status-jenkins-lib@v1.7.14' pipeline { agent { label params.AGENT_LABEL } diff --git a/ci/tools/Jenkinsfile.playstore-meta b/ci/tools/Jenkinsfile.playstore-meta index e35040b581..ece1f45bd9 100644 --- a/ci/tools/Jenkinsfile.playstore-meta +++ b/ci/tools/Jenkinsfile.playstore-meta @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.7.12' +library 'status-jenkins-lib@v1.7.14' pipeline { agent { label 'linux' } diff --git a/ci/tools/Jenkinsfile.xcode-clean b/ci/tools/Jenkinsfile.xcode-clean index d4b834c234..5582ece101 100644 --- a/ci/tools/Jenkinsfile.xcode-clean +++ b/ci/tools/Jenkinsfile.xcode-clean @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.7.12' +library 'status-jenkins-lib@v1.7.14' pipeline { agent { diff --git a/nix/mobile/ios/shells/status-go.nix b/nix/mobile/ios/shells/status-go.nix index 4b9ecd1b8b..1fd1257b32 100644 --- a/nix/mobile/ios/shells/status-go.nix +++ b/nix/mobile/ios/shells/status-go.nix @@ -3,28 +3,33 @@ # It copies the status-go build result to 'modules/react-native-status/ios/RCTStatus'. # -{ mkShell, status-go }: +{ lib, mkShell, status-go }: -mkShell { - shellHook = '' - export STATUS_GO_IOS_LIBDIR=${status-go}/Statusgo.xcframework - - RCTSTATUS_DIR="$STATUS_MOBILE_HOME/modules/react-native-status/ios/RCTStatus" - targetBasename='Statusgo.xcframework' - - # Compare target folder with source to see if copying is required - if [ -d "$RCTSTATUS_DIR/$targetBasename" ] && [ -d $STATUS_MOBILE_HOME/ios/Pods/ ] && \ - diff -qr --no-dereference $RCTSTATUS_DIR/$targetBasename/ $STATUS_GO_IOS_LIBDIR/ > /dev/null; then - echo "$RCTSTATUS_DIR/$targetBasename already in place" - else - sourceBasename="$(basename $STATUS_GO_IOS_LIBDIR)" - echo "Copying $sourceBasename from Nix store to $RCTSTATUS_DIR" - rm -rf "$RCTSTATUS_DIR/$targetBasename/" - cp -a $STATUS_GO_IOS_LIBDIR $RCTSTATUS_DIR - chmod -R 755 "$RCTSTATUS_DIR/$targetBasename" - if [ "$sourceBasename" != "$targetBasename" ]; then - mv "$RCTSTATUS_DIR/$sourceBasename" "$RCTSTATUS_DIR/$targetBasename" +let + targets = let + targetsString = lib.getEnvWithDefault "IOS_STATUS_GO_TARGETS" "ios/arm64;iossimulator/amd64"; + in lib.splitString ";" targetsString; +in + mkShell { + shellHook = '' + export STATUS_GO_IOS_LIBDIR=${status-go { inherit targets; } }/Statusgo.xcframework + + RCTSTATUS_DIR="$STATUS_MOBILE_HOME/modules/react-native-status/ios/RCTStatus" + targetBasename='Statusgo.xcframework' + + # Compare target folder with source to see if copying is required + if [ -d "$RCTSTATUS_DIR/$targetBasename" ] && [ -d $STATUS_MOBILE_HOME/ios/Pods/ ] && \ + diff -qr --no-dereference $RCTSTATUS_DIR/$targetBasename/ $STATUS_GO_IOS_LIBDIR/ > /dev/null; then + echo "$RCTSTATUS_DIR/$targetBasename already in place" + else + sourceBasename="$(basename $STATUS_GO_IOS_LIBDIR)" + echo "Copying $sourceBasename from Nix store to $RCTSTATUS_DIR" + rm -rf "$RCTSTATUS_DIR/$targetBasename/" + cp -a $STATUS_GO_IOS_LIBDIR $RCTSTATUS_DIR + chmod -R 755 "$RCTSTATUS_DIR/$targetBasename" + if [ "$sourceBasename" != "$targetBasename" ]; then + mv "$RCTSTATUS_DIR/$sourceBasename" "$RCTSTATUS_DIR/$targetBasename" + fi fi - fi - ''; + ''; } diff --git a/nix/status-go/mobile/default.nix b/nix/status-go/mobile/default.nix index 731a373cae..c18938d0b3 100644 --- a/nix/status-go/mobile/default.nix +++ b/nix/status-go/mobile/default.nix @@ -17,11 +17,10 @@ inherit meta source goBuildLdFlags; }; - ios = callPackage ./build.nix { + ios = {targets ? [ "ios/arm64" "iossimulator/amd64"]}: callPackage ./build.nix { platform = "ios"; platformVersion = "8.0"; - targets = [ "ios" "iossimulator" ]; outputFileName = "Statusgo.xcframework"; - inherit meta source goBuildLdFlags; + inherit meta source goBuildLdFlags targets; }; }