Skip to content

Commit

Permalink
move logic
Browse files Browse the repository at this point in the history
  • Loading branch information
yakimant committed Aug 30, 2023
1 parent 184d130 commit 71acd85
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
49 changes: 27 additions & 22 deletions nix/mobile/ios/shells/status-go.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;iossimulator";
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
'';
'';
}
7 changes: 2 additions & 5 deletions nix/status-go/mobile/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@
inherit meta source goBuildLdFlags;
};

ios = callPackage ./build.nix {
ios = {targets ? [ "ios" "iossimulator"]}: callPackage ./build.nix {
platform = "ios";
platformVersion = "8.0";
targets = let
targetsString = lib.getEnvWithDefault "IOS_STATUS_GO_TARGETS" "ios;iossimulator";
in lib.splitString ";" targetsString;
outputFileName = "Statusgo.xcframework";
inherit meta source goBuildLdFlags;
inherit meta source goBuildLdFlags targets;
};
}

0 comments on commit 71acd85

Please sign in to comment.