Avoid unnecessary downloads of Android NDK after running `make clean`

This commit is contained in:
Pedro Pombeiro 2018-11-21 13:14:43 +01:00
parent 8d2818017c
commit 57ef0b2ba3
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
4 changed files with 72 additions and 19 deletions

View File

@ -37,7 +37,7 @@ HELP_FUN = \
# Main targets
clean: ##@prepare Remove all output folders
git clean -qdxf -f android/ modules/react-native-status/ node_modules/ target/ desktop/ StatusImPackage/
git clean -dxf -f -e android/local.properties
setup: ##@prepare Install all the requirements for status-react
./scripts/setup
@ -46,10 +46,6 @@ prepare-desktop: ##@prepare Install desktop platform dependencies and prepare wo
scripts/prepare-for-platform.sh desktop
npm install
_prepare-mobile: ##@prepare Install mobile platform dependencies and prepare workspace
scripts/prepare-for-platform.sh mobile
npm install
$(STATUS_GO_IOS_ARCH):
curl -s -L \
"$(GITHUB_URL)/$(STATUS_GO_VER)/status-go-ios.zip" \
@ -61,13 +57,17 @@ $(STATUS_GO_DRO_ARCH):
"$(GITHUB_URL)/$(STATUS_GO_VER)/status-go-android.aar" \
-o "$(STATUS_GO_DRO_ARCH)"
prepare-ios: $(STATUS_GO_IOS_ARCH) _prepare-mobile ##@prepare Install and prepare iOS-specific dependencies
prepare-ios: $(STATUS_GO_IOS_ARCH) ##@prepare Install and prepare iOS-specific dependencies
scripts/prepare-for-platform.sh ios
npm install
unzip -q -o "$(STATUS_GO_IOS_ARCH)" -d "$(RCTSTATUS_DIR)"
ifeq ($(OS),Darwin)
cd ios && pod install
endif
prepare-android: $(STATUS_GO_DRO_ARCH) _prepare-mobile ##@prepare Install and prepare Android-specific dependencies
prepare-android: $(STATUS_GO_DRO_ARCH) ##@prepare Install and prepare Android-specific dependencies
scripts/prepare-for-platform.sh android
npm install
cd android && ./gradlew react-native-android:installArchives
prepare-mobile: prepare-android prepare-ios ##@prepare Install and prepare mobile platform specific dependencies
@ -90,14 +90,18 @@ release-windows-desktop: prod-build-desktop ##@build build release for desktop r
TARGET_SYSTEM_NAME=Windows scripts/build-desktop.sh
prod-build:
scripts/run-pre-build-check.sh android
scripts/run-pre-build-check.sh ios
lein prod-build
prod-build-android:
rm ./modules/react-native-status/android/libs/status-im/status-go/local/status-go-local.aar 2> /dev/null || true
scripts/run-pre-build-check.sh android
lein prod-build-android
prod-build-ios:
rm -r ./modules/react-native-status/ios/RCTStatus/Statusgo.framework/ 2> /dev/null || true
scripts/run-pre-build-check.sh ios
lein prod-build-ios
full-prod-build: ##@build build prod for both Android and iOS
@ -108,6 +112,7 @@ full-prod-build: ##@build build prod for both Android and iOS
prod-build-desktop:
git clean -qdxf -f ./index.desktop.js desktop/
scripts/run-pre-build-check.sh desktop
lein prod-build-desktop
#--------------
@ -115,34 +120,43 @@ prod-build-desktop:
# -------------
watch-ios-real: ##@watch Start development for iOS real device
scripts/run-pre-build-check.sh ios
clj -R:dev build.clj watch --platform ios --ios-device real
watch-ios-simulator: ##@watch Start development for iOS simulator
scripts/run-pre-build-check.sh ios
clj -R:dev build.clj watch --platform ios --ios-device simulator
watch-android-real: ##@watch Start development for Android real device
scripts/run-pre-build-check.sh android
clj -R:dev build.clj watch --platform android --android-device real
watch-android-avd: ##@watch Start development for Android AVD
scripts/run-pre-build-check.sh android
clj -R:dev build.clj watch --platform android --android-device avd
watch-android-genymotion: ##@watch Start development for Android Genymotion
scripts/run-pre-build-check.sh android
clj -R:dev build.clj watch --platform android --android-device genymotion
watch-desktop: ##@watch Start development for Desktop
scripts/run-pre-build-check.sh desktop
clj -R:dev build.clj watch --platform desktop
#--------------
# Run
# -------------
run-android: ##@run Run Android build
scripts/run-pre-build-check.sh android
react-native run-android --appIdSuffix debug
run-desktop: ##@run Run Desktop build
scripts/run-pre-build-check.sh desktop
react-native run-desktop
SIMULATOR=
run-ios: ##@run Run iOS build
scripts/run-pre-build-check.sh ios
ifneq ("$(SIMULATOR)", "")
react-native run-ios --simulator="$(SIMULATOR)"
else

View File

@ -354,7 +354,7 @@ function install_android_ndk() {
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)" && \
_ndkTargetDir="$_ndkParentDir/$(ls $_ndkParentDir | grep ndk)" && \
echo "ndk.dir=$_ndkTargetDir" | tee -a $_localPropertiesPath && \
cecho "@blue[[Android NDK installation completed in $_ndkTargetDir.]]"
fi

View File

@ -9,19 +9,25 @@ PLATFORM_FOLDER=""
#if no arguments passed, inform user about possible ones
if [ $# -eq 0 ]
then
echo -e "${GREEN}This script should be invoked with platform argument: 'mobile' or 'desktop'${NC}"
echo "When called it links"
# echo "If invoked with 'mobile' argument it will make a copying: "
# echo "package.json.mobile -> package.json"
# echo "etc.."
if [ $# -eq 0 ]; then
echo -e "${GREEN}This script should be invoked with platform argument: 'android', 'ios' or 'desktop'${NC}"
echo "If invoked with 'mobile' argument it will link: "
echo "package.json.mobile -> package.json"
echo "etc.."
exit 1
else
else
case $1 in
android | ios)
PLATFORM='mobile'
;;
*)
PLATFORM=$1
;;
esac
PLATFORM_FOLDER="${PLATFORM}_files"
fi
scripts/run-pre-build-check.sh $1
echo "Creating link: package.json -> ${PLATFORM_FOLDER}/package.json "
ln -sf ${PLATFORM_FOLDER}/package.json package.json

33
scripts/run-pre-build-check.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
PLATFORM=""
#if no arguments passed, inform user about possible ones
if [ $# -eq 0 ]; then
echo -e "${GREEN}This script should be invoked with platform argument: 'android', 'ios' or 'desktop'${NC}"
exit 1
else
PLATFORM=$1
fi
npm_version=$(npm -v)
if [[ $npm_version != "5.5.1" ]]; then
echo -e "${YELLOW}+ npm version $npm_version is installed. npm version 5.5.1 is recommended.${NC}"
fi
if [[ $PLATFORM == 'android' ]]; then
_localPropertiesPath=./android/local.properties
if ! grep -Fq "ndk.dir" $_localPropertiesPath; then
if [ -z $ANDROID_NDK_HOME ]; then
echo -e "${GREEN}NDK directory not configured, please run 'make setup' or add the line to ${_localPropertiesPath}!${NC}"
exit 1
fi
fi
fi
echo -e "${GREEN}Finished!${NC}"