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