diff --git a/.gitignore b/.gitignore index c10f3c2a20..9304b575b1 100644 --- a/.gitignore +++ b/.gitignore @@ -78,6 +78,7 @@ re-natal # Status Statusgo.framework +status-go-local.aar status-dev-cli #ios diff --git a/android/build.gradle b/android/build.gradle index 96ae5a1beb..01e8b8844e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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" } diff --git a/modules/react-native-status/android/build.gradle b/modules/react-native-status/android/build.gradle index 755f62c5bd..342536215d 100644 --- a/modules/react-native-status/android/build.gradle +++ b/modules/react-native-status/android/build.gradle @@ -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') } diff --git a/scripts/build-android.sh b/scripts/build-android.sh index d77e9a465a..48135c7c33 100755 --- a/scripts/build-android.sh +++ b/scripts/build-android.sh @@ -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 diff --git a/scripts/bundle-status-go.sh b/scripts/bundle-status-go.sh index bc6dc51abb..b37e192115 100755 --- a/scripts/bundle-status-go.sh +++ b/scripts/bundle-status-go.sh @@ -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 \ No newline at end of file