scripts: Improve `bundle-status-go.sh` so that it can bundle Android package as well (#2539)

Signed-off-by: Oskar Thoren <ot@oskarthoren.com>
This commit is contained in:
Pedro Pombeiro 2017-12-26 10:56:15 +01:00 committed by Oskar Thoren
parent 87dc4ead85
commit 0d83aeda8d
No known key found for this signature in database
GPG Key ID: 5128AB0637CD85AF
5 changed files with 87 additions and 35 deletions

1
.gitignore vendored
View File

@ -78,6 +78,7 @@ re-natal
# Status
Statusgo.framework
status-go-local.aar
status-dev-cli
#ios

View File

@ -18,6 +18,7 @@ allprojects {
mavenLocal()
jcenter()
maven { url "$rootDir/../node_modules/react-native/android" }
maven { url "$rootDir/../modules/react-native-status/android/libs" }
// for geth
flatDir { dirs 'libs' }
maven { url "http://139.162.11.12:8081/artifactory/libs-release-local" }

View File

@ -17,5 +17,16 @@ dependencies {
compile 'com.instabug.library:instabug:3+'
compile 'com.github.ericwlange:AndroidJSCore:3.0.1'
compile 'status-im:function:0.0.1'
compile(group: 'status-im', name: 'status-go', version: 'develop-gb7fb51d9', ext: 'aar')
String statusGoVersion = 'develop-gb7fb51d9'
final String statusGoGroup = 'status-im', statusGoName = 'status-go'
// Check if the local status-go jar exists, and compile against that if it does
final String localStatusLibOutputDir = "${rootDir}/../modules/react-native-status/android/libs", localVersion = 'local'
if ( new File("${localStatusLibOutputDir}/${statusGoGroup}/${statusGoName}/${localVersion}/${statusGoName}-${localVersion}.aar").exists() ) {
// Use the local version
statusGoVersion = localVersion
}
compile(group: statusGoGroup, name: statusGoName, version: statusGoVersion, ext: 'aar')
}

View File

@ -24,7 +24,7 @@ case $TARGET in
;;
prod)
STORE_FILE=$(property_gradle 'STATUS_RELEASE_STORE_FILE')
[[ ! -e "${STORE_FILE/#\~/$HOME}" ]] && echo "Please generate keystore first using ./generate-kesytore.sh" && exit 0
[[ ! -e "${STORE_FILE/#\~/$HOME}" ]] && echo "Please generate keystore first using ./generate-keystore.sh" && exit 0
lein do clean, with-profile prod cljsbuild once android && ./android/gradlew ${GRADLE_PROPERTIES} assembleRelease
cecho "Generated @b@blueandroid/app/build/outputs/apk/app-release.apk"
echo

View File

@ -1,46 +1,85 @@
#!/usr/bin/env sh
set -euf pipefail
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
# TODO Clean up with require STATUS_GO_HOME and STATUS_REACT_HOME
set -euf
echo "[Assumes status-go is in sibling directory]"
echo "[Warning: iOS only for now]"
for platform in "$@"; do
case $platform in
ios | android)
echo "Bundling $platform platform"
cd ..
cd $STATUS_GO_HOME
;;
*)
echo "Undefined platform $platform"
exit 1
esac
# Build status-go artifact for iOS:
(cd status-go && make statusgo-ios-simulator)
case $platform in
ios)
# Build status-go artifact for iOS:
make statusgo-ios-simulator
# 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
#
# Normally this is installed by Maven via Artifactory in this step
# mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack
#
# 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.
# 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
#
# Normally this is installed by Maven via Artifactory in this step
# mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack
#
# 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.
# For Xcode to pick up the new version, remove the whole framework first:
rm -r status-react/modules/react-native-status/ios/RCTStatus/Statusgo.framework/ || true
# 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
# Then copy over framework:
cp -R status-go/build/bin/statusgo-ios-9.3-framework/Statusgo.framework status-react/modules/react-native-status/ios/RCTStatus/Statusgo.framework
# 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
# 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.
#
# 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.
#
# 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.
# 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 -
cd -
echo "[Done]"
echo "[You can now build in Xcode]"
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:
cp -R $STATUS_GO_HOME/build/bin/statusgo-android-16.aar $target/status-go-local.aar
# 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
done