From 070ccdb0234d4e31439cc1c503c6e2236fff387d Mon Sep 17 00:00:00 2001 From: Vitalii Koshura Date: Thu, 20 Sep 2018 04:41:22 +0300 Subject: [PATCH] [Android][CI] Android CI implementation Initial Android client CI is implemented. Some fixes in build scripts made to enable CI build cache for OpenSSL and CURL. Signed-off-by: Vitalii Koshura --- .travis.yml | 12 +++ android/buildAndroidBOINC-CI.sh | 145 ++++++++++++++++++++++++++++++++ android/build_boinc_all.sh | 2 - android/build_curl_arm.sh | 4 +- android/build_curl_arm64.sh | 4 +- android/build_curl_x86.sh | 4 +- android/build_curl_x86_64.sh | 4 +- android/build_openssl_arm.sh | 4 +- android/build_openssl_arm64.sh | 4 +- android/build_openssl_x86.sh | 4 +- android/build_openssl_x86_64.sh | 4 +- 11 files changed, 173 insertions(+), 18 deletions(-) create mode 100755 android/buildAndroidBOINC-CI.sh diff --git a/.travis.yml b/.travis.yml index 112dfcbb43..0dd568216e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,6 +50,14 @@ matrix: - language: cpp os: osx env: BOINC_TYPE=manager-osx + - language: android + env: BOINC_TYPE=client-android-arm + - language: android + env: BOINC_TYPE=client-android-arm64 + - language: android + env: BOINC_TYPE=client-android-x86 + - language: android + env: BOINC_TYPE=client-android-x86_64 - language: android env: BOINC_TYPE=manager-android @@ -72,6 +80,10 @@ script: - if [[ "${BOINC_TYPE}" == "libs-mingw" ]]; then ( cd lib && MINGW=x86_64-w64-mingw32 make -f Makefile.mingw ) fi - if [[ "${BOINC_TYPE}" == "apps-mingw" ]]; then ( cd lib && MINGW=x86_64-w64-mingw32 make -f Makefile.mingw wrapper ) fi - if [[ "${BOINC_TYPE}" == "manager-osx" ]]; then ( ./3rdParty/buildMacDependencies.sh -q && ./mac_build/buildMacBOINC-CI.sh --no_shared_headers ) fi +- if [[ "${BOINC_TYPE}" == "client-android-arm" ]]; then ( cd android && ./buildAndroidBOINC-CI.sh --arch arm ) fi +- if [[ "${BOINC_TYPE}" == "client-android-arm64" ]]; then ( cd android && ./buildAndroidBOINC-CI.sh --arch arm64 ) fi +- if [[ "${BOINC_TYPE}" == "client-android-x86" ]]; then ( cd android && ./buildAndroidBOINC-CI.sh --arch x86 ) fi +- if [[ "${BOINC_TYPE}" == "client-android-x86_64" ]]; then ( cd android && ./buildAndroidBOINC-CI.sh --arch x86_64 ) fi - if [[ "${BOINC_TYPE}" == "manager-android" ]]; then ( /bin/true ) fi - if [[ "${BOINC_TYPE}" == "unit-test" ]]; then ( /bin/true ) fi - if [[ "${BOINC_TYPE}" == "integration-test" ]]; then ( ./integration_test/executeTestSuite.sh ) fi diff --git a/android/buildAndroidBOINC-CI.sh b/android/buildAndroidBOINC-CI.sh new file mode 100755 index 0000000000..49620ff8ce --- /dev/null +++ b/android/buildAndroidBOINC-CI.sh @@ -0,0 +1,145 @@ +#!/bin/sh +set -e + +# This file is part of BOINC. +# http://boinc.berkeley.edu +# Copyright (C) 2018 University of California +# +# BOINC is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any later version. +# +# BOINC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with BOINC. If not, see . +# + +export ANDROID_HOME=$HOME/Android/Sdk +export NDK_ROOT=$HOME/Android/Ndk +export ANDROID_TC=$HOME/Android/Toolchains + +# checks if a given path is canonical (absolute and does not contain relative links) +# from http://unix.stackexchange.com/a/256437 +isPathCanonical() { + case "x$1" in + (x*/..|x*/../*|x../*|x*/.|x*/./*|x./*) + rc=1 + ;; + (x/*) + rc=0 + ;; + (*) + rc=1 + ;; + esac + return $rc +} + +doclean="" +cache_dir="" +arch="" +while [ $# -gt 0 ]; do + key="$1" + case $key in + --cache_dir) + cache_dir="$2" + shift + ;; + --clean) + doclean="yes" + ;; + --arch) + arch="$2" + shift + ;; + *) + echo "unrecognized option $key" + ;; + esac + shift # past argument or value +done + +if [ "x$cache_dir" != "x" ]; then + if isPathCanonical "$cache_dir" && [ "$cache_dir" != "/" ]; then + PREFIX="$cache_dir" + else + echo "cache_dir must be an absolute path without ./ or ../ in it" + exit 1 + fi +else + cd ../ + PREFIX="$(pwd)/3rdParty/buildCache/android" + cd android/ +fi + +mkdir -p "${PREFIX}" + +if [ "${doclean}" = "yes" ]; then + echo "cleaning cache" + rm -rf "${PREFIX}" + mkdir -p "${PREFIX}" +fi + +export COMPILEOPENSSL="no" +export OPENSSL_VERSION=1.0.2p +if [ ! -d "$PREFIX/openssl-${OPENSSL_VERSION}" ]; then + wget -O /tmp/openssl.tgz https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz + tar xzf /tmp/openssl.tgz --directory=$PREFIX4 + export COMPILEOPENSSL="yes" +fi +export OPENSSL_SRC=$PREFIX/openssl-${OPENSSL_VERSION} + +export COMPILECURL="no" +export CURL_VERSION=7.61.0 +if [ ! -d "$PREFIX/curl-${CURL_VERSION}" ]; then + wget -O /tmp/curl.tgz https://curl.haxx.se/download/curl-${CURL_VERSION}.tar.gz + tar xzf /tmp/curl.tgz --directory=$PREFIX + export COMPILECURL="yes" +fi +export CURL_SRC=$PREFIX/curl-${CURL_VERSION} + +export NDK_VERSION=17c +wget -O /tmp/ndk.zip https://dl.google.com/android/repository/android-ndk-r${NDK_VERSION}-linux-x86_64.zip +unzip -qq /tmp/ndk.zip -d $HOME +export NDK_ROOT=$HOME/android-ndk-r${NDK_VERSION} + +export ANDROID_TC=$PREFIX/android-tc + +case "$arch" in + "arm") + ./build_androidtc_arm.sh + ./build_openssl_arm.sh + ./build_curl_arm.sh + ./build_boinc_arm.sh + exit 0 + ;; + "arm64") + ./build_androidtc_arm64.sh + ./build_openssl_arm64.sh + ./build_curl_arm64.sh + ./build_boinc_arm64.sh + exit 0 + ;; + "x86") + ./build_androidtc_x86.sh + ./build_openssl_x86.sh + ./build_curl_x86.sh + ./build_boinc_x86.sh + exit 0 + ;; + "x86_64") + ./build_androidtc_x86_64.sh + ./build_openssl_x86_64.sh + ./build_curl_x86_64.sh + ./build_boinc_x86_64.sh + exit 0 + ;; +esac + +echo "unknown architecture: $arch" +exit 1 \ No newline at end of file diff --git a/android/build_boinc_all.sh b/android/build_boinc_all.sh index 67211abc7e..07e5b0914b 100755 --- a/android/build_boinc_all.sh +++ b/android/build_boinc_all.sh @@ -11,5 +11,3 @@ set -e ./build_boinc_arm64.sh ./build_boinc_x86.sh ./build_boinc_x86_64.sh -./build_boinc_mips.sh -./build_boinc_mips64.sh diff --git a/android/build_curl_arm.sh b/android/build_curl_arm.sh index bdaec2978d..fe7bb2daf2 100755 --- a/android/build_curl_arm.sh +++ b/android/build_curl_arm.sh @@ -7,7 +7,7 @@ set -e # Script to compile Libcurl for Android -COMPILECURL="yes" +COMPILECURL="${COMPILECURL:-yes}" CONFIGURE="yes" MAKECLEAN="yes" @@ -32,7 +32,7 @@ export GDB_CFLAGS="--sysroot=$TCSYSROOT -Wall -g -I$TCINCLUDES/include" # Prepare android toolchain and environment ./build_androidtc_arm.sh -if [ -n "$COMPILECURL" ]; then +if [ "$COMPILECURL" = "yes" ]; then echo "==================building curl from $CURL=================================" cd "$CURL" if [ -n "$MAKECLEAN" ] && $(grep -q "^distclean:" "${CURL}/Makefile"); then diff --git a/android/build_curl_arm64.sh b/android/build_curl_arm64.sh index 29abd2ed56..10e28603d8 100755 --- a/android/build_curl_arm64.sh +++ b/android/build_curl_arm64.sh @@ -7,7 +7,7 @@ set -e # Script to compile Libcurl for Android -COMPILECURL="yes" +COMPILECURL="${COMPILECURL:-yes}" CONFIGURE="yes" MAKECLEAN="yes" @@ -32,7 +32,7 @@ export GDB_CFLAGS="--sysroot=$TCSYSROOT -Wall -g -I$TCINCLUDES/include" # Prepare android toolchain and environment ./build_androidtc_arm64.sh -if [ -n "$COMPILECURL" ]; then +if [ "$COMPILECURL" = "yes" ]; then echo "==================building curl from $CURL=================================" cd "$CURL" if [ -n "$MAKECLEAN" ] && $(grep -q "^distclean:" "${CURL}/Makefile"); then diff --git a/android/build_curl_x86.sh b/android/build_curl_x86.sh index 05850b057a..ca922f1d27 100755 --- a/android/build_curl_x86.sh +++ b/android/build_curl_x86.sh @@ -7,7 +7,7 @@ set -e # Script to compile Libcurl for Android -COMPILECURL="yes" +COMPILECURL="${COMPILECURL:-yes}" CONFIGURE="yes" MAKECLEAN="yes" @@ -32,7 +32,7 @@ export GDB_CFLAGS="--sysroot=$TCSYSROOT -Wall -g -I$TCINCLUDES/include" # Prepare android toolchain and environment ./build_androidtc_x86.sh -if [ -n "$COMPILECURL" ]; then +if [ "$COMPILECURL" = "yes" ]; then echo "==================building curl from $CURL=================================" cd "$CURL" if [ -n "$MAKECLEAN" ] && $(grep -q "^distclean:" "${CURL}/Makefile"); then diff --git a/android/build_curl_x86_64.sh b/android/build_curl_x86_64.sh index db7dd1701f..a66a7b65e6 100755 --- a/android/build_curl_x86_64.sh +++ b/android/build_curl_x86_64.sh @@ -7,7 +7,7 @@ set -e # Script to compile Libcurl for Android -COMPILECURL="yes" +COMPILECURL="${COMPILECURL:-yes}" CONFIGURE="yes" MAKECLEAN="yes" @@ -32,7 +32,7 @@ export GDB_CFLAGS="--sysroot=$TCSYSROOT -Wall -g -I$TCINCLUDES/include" # Prepare android toolchain and environment ./build_androidtc_x86_64.sh -if [ -n "$COMPILECURL" ]; then +if [ "$COMPILECURL" = "yes" ]; then echo "==================building curl from $CURL=================================" cd "$CURL" if [ -n "$MAKECLEAN" ] && $(grep -q "^distclean:" "${CURL}/Makefile"); then diff --git a/android/build_openssl_arm.sh b/android/build_openssl_arm.sh index 7b0e922658..07dd90bbbc 100755 --- a/android/build_openssl_arm.sh +++ b/android/build_openssl_arm.sh @@ -7,7 +7,7 @@ set -e # Script to compile OpenSSL for Android -COMPILEOPENSSL="yes" +COMPILEOPENSSL="${COMPILEOPENSSL:-yes}" CONFIGURE="yes" MAKECLEAN="yes" @@ -32,7 +32,7 @@ export GDB_CFLAGS="--sysroot=$TCSYSROOT -Wall -g -I$TCINCLUDES/include" # Prepare android toolchain and environment ./build_androidtc_arm.sh -if [ -n "$COMPILEOPENSSL" ]; then +if [ "$COMPILEOPENSSL" = "yes" ]; then echo "================building openssl from $OPENSSL=============================" cd "$OPENSSL" if [ -n "$MAKECLEAN" ]; then diff --git a/android/build_openssl_arm64.sh b/android/build_openssl_arm64.sh index f3e2746897..3fb0fc1fe5 100755 --- a/android/build_openssl_arm64.sh +++ b/android/build_openssl_arm64.sh @@ -7,7 +7,7 @@ set -e # Script to compile OpenSSL for Android -COMPILEOPENSSL="yes" +COMPILEOPENSSL="${COMPILEOPENSSL:-yes}" CONFIGURE="yes" MAKECLEAN="yes" @@ -32,7 +32,7 @@ export GDB_CFLAGS="--sysroot=$TCSYSROOT -Wall -g -I$TCINCLUDES/include" # Prepare android toolchain and environment ./build_androidtc_arm64.sh -if [ -n "$COMPILEOPENSSL" ]; then +if [ "$COMPILEOPENSSL" = "yes" ]; then echo "================building openssl from $OPENSSL=============================" cd "$OPENSSL" if [ -n "$MAKECLEAN" ]; then diff --git a/android/build_openssl_x86.sh b/android/build_openssl_x86.sh index 88ad03fe06..fda9ed84d9 100755 --- a/android/build_openssl_x86.sh +++ b/android/build_openssl_x86.sh @@ -7,7 +7,7 @@ set -e # Script to compile OpenSSL for Android -COMPILEOPENSSL="yes" +COMPILEOPENSSL="${COMPILEOPENSSL:-yes}" CONFIGURE="yes" MAKECLEAN="yes" @@ -32,7 +32,7 @@ export GDB_CFLAGS="--sysroot=$TCSYSROOT -Wall -g -I$TCINCLUDES/include" # Prepare android toolchain and environment ./build_androidtc_x86.sh -if [ -n "$COMPILEOPENSSL" ]; then +if [ "$COMPILEOPENSSL" = "yes" ]; then echo "================building openssl from $OPENSSL=============================" cd "$OPENSSL" if [ -n "$MAKECLEAN" ]; then diff --git a/android/build_openssl_x86_64.sh b/android/build_openssl_x86_64.sh index d70a5307da..f94ef1ebed 100755 --- a/android/build_openssl_x86_64.sh +++ b/android/build_openssl_x86_64.sh @@ -7,7 +7,7 @@ set -e # Script to compile OpenSSL for Android -COMPILEOPENSSL="yes" +COMPILEOPENSSL="${COMPILEOPENSSL:-yes}" CONFIGURE="yes" MAKECLEAN="yes" @@ -32,7 +32,7 @@ export GDB_CFLAGS="--sysroot=$TCSYSROOT -Wall -g -I$TCINCLUDES/include" # Prepare android toolchain and environment ./build_androidtc_x86_64.sh -if [ -n "$COMPILEOPENSSL" ]; then +if [ "$COMPILEOPENSSL" = "yes" ]; then echo "================building openssl from $OPENSSL=============================" cd "$OPENSSL" if [ -n "$MAKECLEAN" ]; then