Install Android NDK and gradle archives during setup.

Fixes broken `make release-android` step on new machines.

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
Pedro Pombeiro 2018-07-10 17:56:26 +02:00
parent e564de6bd0
commit 0051b7cb9a
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
2 changed files with 43 additions and 1 deletions

View File

@ -156,6 +156,8 @@ function install_android_sdk() {
elif is_linux; then
install_android_sdk_linux
fi
use_android_sdk
}
function install_android_sdk_linux() {
@ -290,3 +292,42 @@ function dependency_setup() {
echo " + done"
echo
}
function use_android_sdk() {
_localPropertiesPath=./android/local.properties
if [ -n "$ANDROID_SDK" ]; then
if ! grep -Fq "sdk.dir" $_localPropertiesPath; then
echo "sdk.dir=$ANDROID_SDK" | tee -a $_localPropertiesPath
fi
else
_docURL="https://docs.status.im/docs/build_status_linux.html"
if is_macos; then
_docURL="https://docs.status.im/docs/build_status_osx.html"
fi
cecho "@yellow[[ANDROID_SDK environment variable not defined, please install the Android SDK.]]"
cecho "@yellow[[(see $_docUrl).]]"
echo
exit 1
fi
}
function install_android_ndk() {
_localPropertiesPath=./android/local.properties
if grep -Fq "ndk.dir" $_localPropertiesPath; then
dependency_setup \
"pushd android && ./gradlew react-native-android:installArchives && popd"
else
_ndkParentDir=~/Android/Sdk
mkdir -p $_ndkParentDir
cecho "@cyan[[Downloading Android NDK.]]"
wget --output-document=android-ndk.zip https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip && \
cecho "@cyan[[Extracting Android NDK to $_ndkParentDir.]]" && \
unzip -q -o android-ndk.zip -d "$_ndkParentDir" && \
rm -f android-ndk.zip && \
_ndkTargetDir="$_ndkParentDir/$(ls $_ndkParentDir | head -n 1)" && \
echo "ndk.dir=$_ndkTargetDir" | tee -a $_localPropertiesPath && \
cecho "@blue[[Android NDK installation completed in $_ndkTargetDir.]]"
fi
}

View File

@ -31,6 +31,7 @@ install_node
install_watchman
install_react_native_cli
install_android_sdk
install_android_ndk
install_maven
install_cocoapods
@ -49,6 +50,6 @@ dependency_setup ./re-natal enable-source-maps
dependency_setup \
"mvn -f modules/react-native-status/ios/RCTStatus/pom.xml dependency:unpack"
using_cocoapods && dependency_setup "cd ios && pod install && cd .."
using_cocoapods && dependency_setup "pushd ios && pod install && popd"
setup_complete