2017-11-28 23:39:01 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2017-12-26 09:56:15 +00:00
|
|
|
if [ -z $STATUS_GO_HOME ] ; then
|
|
|
|
echo "Please define STATUS_GO_HOME"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -z $STATUS_REACT_HOME ] ; then
|
|
|
|
echo "Please define STATUS_REACT_HOME"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
echo "Please specify platforms to bundle as discrete arguments (ios, android)"
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-11-28 23:39:01 +00:00
|
|
|
|
2017-12-26 09:56:15 +00:00
|
|
|
set -euf
|
2017-11-28 23:39:01 +00:00
|
|
|
|
2018-08-30 12:56:45 +00:00
|
|
|
# Ensure we start with a clean state, so as to e.g., not reuse old native status-go bindings
|
2019-02-19 07:28:49 +00:00
|
|
|
if [ -z $DONT_CLEAN ] ; then
|
|
|
|
make clean
|
|
|
|
fi
|
2018-08-30 12:56:45 +00:00
|
|
|
|
2017-12-26 09:56:15 +00:00
|
|
|
for platform in "$@"; do
|
|
|
|
case $platform in
|
|
|
|
ios | android)
|
|
|
|
echo "Bundling $platform platform"
|
2017-11-28 23:39:01 +00:00
|
|
|
|
2017-12-26 09:56:15 +00:00
|
|
|
cd $STATUS_GO_HOME
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Undefined platform $platform"
|
|
|
|
exit 1
|
|
|
|
esac
|
2017-11-28 23:39:01 +00:00
|
|
|
|
2017-12-26 09:56:15 +00:00
|
|
|
case $platform in
|
|
|
|
ios)
|
|
|
|
# Build status-go artifact for iOS:
|
|
|
|
make statusgo-ios-simulator
|
2017-11-28 23:39:01 +00:00
|
|
|
|
2017-12-26 09:56:15 +00:00
|
|
|
# You should see iOS framework cross compilation done. This builds the following artifact:
|
|
|
|
#
|
|
|
|
# > (cd status-go && find . -iname "Statusgo.framework")
|
|
|
|
# ./build/bin/statusgo-ios-9.3-framework/Statusgo.framework
|
|
|
|
#
|
2018-09-18 12:22:30 +00:00
|
|
|
# You can get this by running:
|
2019-03-22 11:00:32 +00:00
|
|
|
# scripts/prepare-for-platform.sh {ios|android}
|
2017-12-26 09:56:15 +00:00
|
|
|
#
|
|
|
|
# Locally you can see it here:
|
|
|
|
# > (cd status-react && find . -iname "Statusgo.framework")
|
|
|
|
# ./modules/react-native-status/ios/RCTStatus/Statusgo.framework
|
|
|
|
# ./modules/react-native-status/ios/RCTStatus/Statusgo.framework/Statusgo.framework
|
|
|
|
#
|
|
|
|
# Instead we are going to manually overwrite it.
|
2017-11-28 23:39:01 +00:00
|
|
|
|
2017-12-26 09:56:15 +00:00
|
|
|
# For Xcode to pick up the new version, remove the whole framework first:
|
|
|
|
rm -r $STATUS_REACT_HOME/modules/react-native-status/ios/RCTStatus/Statusgo.framework/ || true
|
2017-11-28 23:39:01 +00:00
|
|
|
|
2017-12-26 09:56:15 +00:00
|
|
|
# Then copy over framework:
|
|
|
|
cp -R $STATUS_GO_HOME/build/bin/statusgo-ios-9.3-framework/Statusgo.framework $STATUS_REACT_HOME/modules/react-native-status/ios/RCTStatus/Statusgo.framework
|
2017-11-28 23:39:01 +00:00
|
|
|
|
2017-12-26 09:56:15 +00:00
|
|
|
# In Xcode, clean and build. If you have any scripts to do this, make sure that
|
|
|
|
# you don't accidentally run the mvn step to undo your manual install.
|
|
|
|
#
|
2017-11-28 23:39:01 +00:00
|
|
|
|
2017-12-26 09:56:15 +00:00
|
|
|
# It might also be a good idea to print something custom so you can easily tell
|
|
|
|
# the difference between an old and new version of status-go.
|
2017-11-28 23:39:01 +00:00
|
|
|
|
2017-12-26 09:56:15 +00:00
|
|
|
cd -
|
2017-11-28 23:39:01 +00:00
|
|
|
|
2017-12-26 09:56:15 +00:00
|
|
|
echo "[Done]"
|
|
|
|
echo "[You can now build in Xcode]"
|
|
|
|
;;
|
|
|
|
android)
|
|
|
|
# Build status-go artifact for Android:
|
|
|
|
make statusgo-android
|
|
|
|
|
|
|
|
target=$STATUS_REACT_HOME/modules/react-native-status/android/libs/status-im/status-go/local
|
|
|
|
[ -d $target ] || mkdir -p $target
|
|
|
|
# Copy over framework:
|
2019-02-19 07:28:49 +00:00
|
|
|
cp -R $STATUS_GO_HOME/build/bin/statusgo.aar $target/status-go-local.aar
|
2017-12-26 09:56:15 +00:00
|
|
|
|
|
|
|
# It might also be a good idea to print something custom so you can easily tell
|
|
|
|
# the difference between an old and new version of status-go.
|
|
|
|
|
|
|
|
cd -
|
|
|
|
|
|
|
|
echo "[Done]"
|
|
|
|
;;
|
|
|
|
esac
|
2018-09-18 12:22:30 +00:00
|
|
|
done
|