fix automatized android artifact build

pull/15969/head
Jan Tattermusch 6 years ago
parent 7a7e09cf8a
commit c6970ad79d
  1. 19
      src/csharp/experimental/build_native_ext_for_android.sh
  2. 31
      tools/dockerfile/grpc_artifact_android_ndk/Dockerfile
  3. 1
      tools/run_tests/artifacts/build_artifact_csharp_android.sh

@ -23,18 +23,20 @@ mkdir -p build
cd build
# set to the location where Android SDK is installed
ANDROID_SDK_PATH="$HOME/Android/Sdk"
# e.g. ANDROID_SDK_PATH="$HOME/Android/Sdk"
# set to location where Android NDK is installed, usually a subfolder of Android SDK
# install the Android NDK through the Android SDK Manager
ANDROID_NDK_PATH=${ANDROID_SDK_PATH}/ndk-bundle
# to install the Android NKD, use the "sdkmanager" tool
# e.g. ANDROID_NDK_PATH=${ANDROID_SDK_PATH}/ndk-bundle
# set to location of the cmake executable
# by default, use cmake binary from the Android SDK
CMAKE_PATH="${ANDROID_SDK_PATH}/cmake/3.6.4111459/bin/cmake"
# set to location of the cmake executable from the Android SDK
# to install cmake, use the "sdkmanager" tool
# e.g. ANDROID_SDK_CMAKE=${ANDROID_SDK_PATH}/cmake/3.6.4111459/bin/cmake
# ANDROID_ABI in ('arm64-v8a', 'armeabi-v7a')
${CMAKE_PATH} ../.. \
# e.g. ANDROID_ABI=armeabi-v7a
${ANDROID_SDK_CMAKE} ../.. \
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_PATH}/build/cmake/android.toolchain.cmake" \
-DCMAKE_ANDROID_NDK="${ANDROID_NDK_PATH}" \
-DCMAKE_ANDROID_STL_TYPE=c++_static \
@ -43,8 +45,7 @@ ${CMAKE_PATH} ../.. \
-DRUN_HAVE_STEADY_CLOCK=0 \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_PLATFORM=android-28 \
-DANDROID_ABI=arm64-v8a \
-DANDROID_ABI="${ANDROID_ABI}" \
-DANDROID_NDK="${ANDROID_NDK_PATH}"
make -j4 grpc_csharp_ext

@ -12,9 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Docker file for building gRPC artifacts.
# Docker file for building gRPC artifacts for Android.
# Recent enough cmake (>=3.9) needed by Android SDK
FROM debian:sid
RUN apt-get update && apt-get install -y debian-keyring && apt-key update
@ -47,20 +46,26 @@ RUN apt-get update && apt-key update && apt-get install -y \
wget \
zip && apt-get clean
# Cmake for cross-compilation
RUN apt-get update && apt-get install -y cmake golang && apt-get clean
# golang needed to build BoringSSL with cmake
RUN apt-get update && apt-get install -y golang && apt-get clean
##################
# Android NDK
# Java required by Android SDK
RUN apt-get update && apt-get -y install openjdk-8-jdk && apt-get clean
# Download and install Android NDK
RUN wget -q https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip -O android_ndk.zip \
&& unzip -q android_ndk.zip \
&& rm android_ndk.zip \
&& mv ./android-ndk-r16b /opt
ENV ANDROID_NDK_PATH /opt/android-ndk-r16b
# Install Android SDK
ENV ANDROID_SDK_VERSION 4333796
RUN mkdir -p /opt/android-sdk && cd /opt/android-sdk && \
wget -q https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip && \
unzip -q sdk-tools-linux-${ANDROID_SDK_VERSION}.zip && \
rm sdk-tools-linux-${ANDROID_SDK_VERSION}.zip
ENV ANDROID_SDK_PATH /opt/android-sdk
RUN apt-get update && apt-get install -y libpthread-stubs0-dev && apt-get clean
# Install Android NDK and cmake using sdkmanager
RUN mkdir -p ~/.android && touch ~/.android/repositories.cfg
RUN yes | ${ANDROID_SDK_PATH}/tools/bin/sdkmanager --licenses # accept all licenses
RUN ${ANDROID_SDK_PATH}/tools/bin/sdkmanager ndk-bundle 'cmake;3.6.4111459'
ENV ANDROID_NDK_PATH ${ANDROID_SDK_PATH}/ndk-bundle
ENV ANDROID_SDK_CMAKE ${ANDROID_SDK_PATH}/cmake/3.6.4111459/bin/cmake
RUN mkdir /var/local/jenkins

@ -17,6 +17,7 @@ set -ex
cd "$(dirname "$0")/../../.."
export ANDROID_ABI=armeabi-v7a
src/csharp/experimental/build_native_ext_for_android.sh
mkdir -p "${ARTIFACTS_OUT}"

Loading…
Cancel
Save