nix: set ios status-go targets

This commit is contained in:
Anton Iakimov 2023-08-29 15:18:14 +02:00
parent 36c87d3857
commit b7a090716d
No known key found for this signature in database
GPG Key ID: DEA1FE58DD8BF7FA
15 changed files with 44 additions and 37 deletions

View File

@ -224,6 +224,7 @@ release-android: keystore build-android ##@build Build signed Android APK
@scripts/sign-android.sh result/app-release-unsigned.apk @scripts/sign-android.sh result/app-release-unsigned.apk
release-ios: export TARGET := ios release-ios: export TARGET := ios
release-ios: export IOS_STATUS_GO_TARGETS := ios/arm64
release-ios: export BUILD_ENV ?= prod release-ios: export BUILD_ENV ?= prod
release-ios: watchman-clean ios-clean jsbundle ##@build Build release for iOS release release-ios: watchman-clean ios-clean jsbundle ##@build Build release for iOS release
xcodebuild \ xcodebuild \
@ -279,6 +280,7 @@ run-android: ##@run Build Android APK and start it on the device
SIMULATOR=iPhone 11 Pro SIMULATOR=iPhone 11 Pro
run-ios: export TARGET := ios 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 run-ios: ##@run Build iOS app and start it in a simulator/device
ifneq ("$(SIMULATOR)", "") ifneq ("$(SIMULATOR)", "")
npx react-native run-ios --simulator="$(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 xcrun xctrace list devices
run-ios-device: export TARGET := ios 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 run-ios-device: ##@run iOS app and start it on a connected device by its name
ifndef DEVICE_NAME ifndef DEVICE_NAME
$(error Usage: make run-ios-device DEVICE_NAME=your-device-name) $(error Usage: make run-ios-device DEVICE_NAME=your-device-name)

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/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. */ /* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild() def isPRBuild = utils.isPRBuild()

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.7.12' library 'status-jenkins-lib@v1.7.14'
pipeline { pipeline {
agent { label 'linux' } agent { label 'linux' }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.7.12' library 'status-jenkins-lib@v1.7.14'
pipeline { pipeline {
agent { label 'linux' } agent { label 'linux' }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/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. */ /* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild() def isPRBuild = utils.isPRBuild()

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/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. */ /* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild() def isPRBuild = utils.isPRBuild()

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.7.12' library 'status-jenkins-lib@v1.7.14'
pipeline { pipeline {

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.7.12' library 'status-jenkins-lib@v1.7.14'
pipeline { pipeline {

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.7.12' library 'status-jenkins-lib@v1.7.14'
pipeline { pipeline {

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.7.12' library 'status-jenkins-lib@v1.7.14'
pipeline { pipeline {
agent { label 'macos' } agent { label 'macos' }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.7.12' library 'status-jenkins-lib@v1.7.14'
pipeline { pipeline {
agent { label params.AGENT_LABEL } agent { label params.AGENT_LABEL }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.7.12' library 'status-jenkins-lib@v1.7.14'
pipeline { pipeline {
agent { label 'linux' } agent { label 'linux' }

View File

@ -1,5 +1,5 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
library 'status-jenkins-lib@v1.7.12' library 'status-jenkins-lib@v1.7.14'
pipeline { pipeline {
agent { agent {

View File

@ -3,28 +3,33 @@
# It copies the status-go build result to 'modules/react-native-status/ios/RCTStatus'. # It copies the status-go build result to 'modules/react-native-status/ios/RCTStatus'.
# #
{ mkShell, status-go }: { lib, mkShell, status-go }:
mkShell { let
shellHook = '' targets = let
export STATUS_GO_IOS_LIBDIR=${status-go}/Statusgo.xcframework 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" RCTSTATUS_DIR="$STATUS_MOBILE_HOME/modules/react-native-status/ios/RCTStatus"
targetBasename='Statusgo.xcframework' targetBasename='Statusgo.xcframework'
# Compare target folder with source to see if copying is required # Compare target folder with source to see if copying is required
if [ -d "$RCTSTATUS_DIR/$targetBasename" ] && [ -d $STATUS_MOBILE_HOME/ios/Pods/ ] && \ 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 diff -qr --no-dereference $RCTSTATUS_DIR/$targetBasename/ $STATUS_GO_IOS_LIBDIR/ > /dev/null; then
echo "$RCTSTATUS_DIR/$targetBasename already in place" echo "$RCTSTATUS_DIR/$targetBasename already in place"
else else
sourceBasename="$(basename $STATUS_GO_IOS_LIBDIR)" sourceBasename="$(basename $STATUS_GO_IOS_LIBDIR)"
echo "Copying $sourceBasename from Nix store to $RCTSTATUS_DIR" echo "Copying $sourceBasename from Nix store to $RCTSTATUS_DIR"
rm -rf "$RCTSTATUS_DIR/$targetBasename/" rm -rf "$RCTSTATUS_DIR/$targetBasename/"
cp -a $STATUS_GO_IOS_LIBDIR $RCTSTATUS_DIR cp -a $STATUS_GO_IOS_LIBDIR $RCTSTATUS_DIR
chmod -R 755 "$RCTSTATUS_DIR/$targetBasename" chmod -R 755 "$RCTSTATUS_DIR/$targetBasename"
if [ "$sourceBasename" != "$targetBasename" ]; then if [ "$sourceBasename" != "$targetBasename" ]; then
mv "$RCTSTATUS_DIR/$sourceBasename" "$RCTSTATUS_DIR/$targetBasename" mv "$RCTSTATUS_DIR/$sourceBasename" "$RCTSTATUS_DIR/$targetBasename"
fi
fi fi
fi '';
'';
} }

View File

@ -17,11 +17,10 @@
inherit meta source goBuildLdFlags; inherit meta source goBuildLdFlags;
}; };
ios = callPackage ./build.nix { ios = {targets ? [ "ios/arm64" "iossimulator/amd64"]}: callPackage ./build.nix {
platform = "ios"; platform = "ios";
platformVersion = "8.0"; platformVersion = "8.0";
targets = [ "ios" "iossimulator" ];
outputFileName = "Statusgo.xcframework"; outputFileName = "Statusgo.xcframework";
inherit meta source goBuildLdFlags; inherit meta source goBuildLdFlags targets;
}; };
} }