diff --git a/.gitignore b/.gitignore index 0278e08aed..651d0140bb 100644 --- a/.gitignore +++ b/.gitignore @@ -92,6 +92,7 @@ android/.classpath android/.cproject android/.project android/assets +android/local.properties # local android scripts, such as debugger helper scrips android/local diff --git a/android/build.xml b/android/build.xml new file mode 100644 index 0000000000..8115fbe50f --- /dev/null +++ b/android/build.xml @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ************************************************* + **** Android Manifest has debuggable=true **** + ** Doing DEBUG packaging with PRODUCTION keys *** + ************************************************* + + + + + + + + + + + + + + + + Signing final apk... + + + + + Release Package: ${out.final.file} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/autobuild/android.sh b/tools/autobuild/android.sh new file mode 100644 index 0000000000..938dbf3a58 --- /dev/null +++ b/tools/autobuild/android.sh @@ -0,0 +1,34 @@ +# Script takes configuration as a parameter and optional clean keyword. +# Possible configurations: debug release production + +set -e -u -x + +LOCAL_DIRNAME="${PWD}/$(dirname "$0")" + +if [[ $# < 1 ]]; then + echo "Usage: $0 [clean]" + exit 1 +fi +CONFIGURATION="$1" + + +source "$LOCAL_DIRNAME/build.sh" + +MKSPEC="$LOCAL_DIRNAME/../mkspecs/android-g++" +QMAKE_PARAMS="CONFIG+=${CONFIGURATION}" +SHADOW_DIR_BASE="$LOCAL_DIRNAME/../../../omim-android" + +export NDK_HOST=darwin-x86 +export NDK_ROOT=/Developer/android-ndk-r7 +NDK_ABI_TO_BUILD=(armeabi armeabi-v7a) + +for abi in "${NDK_ABI_TO_BUILD[@]}"; do + SHADOW_DIR="${SHADOW_DIR_BASE}-${CONFIGURATION}-${abi}" + if [[ $# > 1 && "$2" == "clean" ]] ; then + echo "Cleaning $CONFIGURATION-$abi configuration..." + rm -rf "$SHADOW_DIR" + else + export NDK_ABI="$abi" + BuildQt "$SHADOW_DIR" "$MKSPEC" "$QMAKE_PARAMS" || ( echo "ERROR while building $abi config"; exit 1 ) + fi +done diff --git a/tools/autobuild/build.sh b/tools/autobuild/build.sh new file mode 100644 index 0000000000..c9872befff --- /dev/null +++ b/tools/autobuild/build.sh @@ -0,0 +1,24 @@ +set -e -x + +LOCAL_DIRNAME="${PWD}/$(dirname "$0")" + +source "$LOCAL_DIRNAME/detect_qmake.sh" + +# 1st param: shadow directory path +# 2nd param: mkspec +# 3rd param: additional qmake parameters +BuildQt() { + ( + # set qmake path + PATH="$(PrintQmakePath):$PATH" || ( echo "ERROR: qmake was not found, please add it to your PATH or into the tools/autobuild/detect_qmake.sh"; exit 1 ) + SHADOW_DIR="$1" + MKSPEC="$2" + QMAKE_PARAMS="$3" + + mkdir -p "$SHADOW_DIR" + cd "$SHADOW_DIR" + qmake -r "$QMAKE_PARAMS" -spec "$MKSPEC" "../omim/omim.pro" +# make clean > /dev/null || true + make + ) +} diff --git a/tools/autobuild/detect_qmake.sh b/tools/autobuild/detect_qmake.sh new file mode 100644 index 0000000000..0466f52cbe --- /dev/null +++ b/tools/autobuild/detect_qmake.sh @@ -0,0 +1,25 @@ +# Add your path into this array +KNOWN_QMAKE_PATHS=( \ + /Users/Alex/QtSDK/Desktop/Qt/474/gcc/bin \ +) + +# Prints path to directory with found qmake binary or prints nothing if not found +# Returns 1 in case of not found and 0 in case of success +PrintQmakePath() { + local QMAKE_PATH + QMAKE_PATH=$(which qmake) + if [ $? -ne 0 ]; then + # qmake binary is not in the path, look for it in the given array + for path in "${KNOWN_QMAKE_PATHS[@]}"; do + if [ -f "${path}/qmake" ]; then + echo "${path}" + return 0 + fi + done + else + echo "${QMAKE_PATH}" + return 0 + fi + # Not found + return 1 +} diff --git a/tools/autobuild/function.sh b/tools/autobuild/function.sh new file mode 100644 index 0000000000..2ed3a88e14 --- /dev/null +++ b/tools/autobuild/function.sh @@ -0,0 +1,36 @@ +# to threat ! as a char +set +H + +# this array will hold all executed commands logs +declare -a FUNCTION_CHECKED_CALL_LOGS +FUNCTION_CHECKED_LOG_INDEX=0 + +FUNCTION_START_DATE=$(date -u) + +LoggedCall() { + echo "\$ $*" + local RESULT + RESULT=$($* 2>&1) + if [ $? != 0 ]; then + echo "ERROR: Command failed with code $?" + fi + echo "$RESULT" +} + +Call() { + FUNCTION_CHECKED_CALL_LOGS[FUNCTION_CHECKED_LOG_INDEX]=$(LoggedCall $*) + let FUNCTION_CHECKED_LOG_INDEX++ +} + +PrintLogs() { + echo "****** Started on $FUNCTION_START_DATE ******" + for logLine in "${FUNCTION_CHECKED_CALL_LOGS[@]}"; do + echo "$logLine" + done +} + +CD() +{ + echo "\$ cd $1" + cd $1 || return +} diff --git a/tools/autobuild/mac.sh b/tools/autobuild/mac.sh new file mode 100644 index 0000000000..10772e15ac --- /dev/null +++ b/tools/autobuild/mac.sh @@ -0,0 +1,8 @@ +source build.sh + +QMAKE_PATH="/Users/Alex/QtSDK/Desktop/Qt/474/gcc/bin" +SHADOW_DIR="/Developer/omim/omim-mac-release" +MKSPEC="macx-llvm" +QMAKE_PARAMS="CONFIG+=release" + +BuildQt "$QMAKE_PATH" "$SHADOW_DIR" "$MKSPEC" "$QMAKE_PARAMS" || echo "ERROR BUILDING PROJECT"