1#!/usr/bin/env bash 2# Copyright 2018 gRPC authors. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16set -ex 17 18# change to grpc repo root 19cd $(dirname $0)/../../.. 20 21REPO_ROOT="$(pwd)" 22 23git submodule update --init 24 25# Build protoc and grpc_cpp_plugin. Codegen is not cross-compiled to Android 26make HAS_SYSTEM_PROTOBUF=false 27 28# Build and run interop instrumentation tests on Firebase Test Lab 29 30cd "${REPO_ROOT}/src/android/test/interop/" 31./gradlew assembleDebug \ 32 "-Pprotoc=${REPO_ROOT}/third_party/protobuf/src/protoc" \ 33 "-Pgrpc_cpp_plugin=${REPO_ROOT}/bins/opt/grpc_cpp_plugin" 34./gradlew assembleDebugAndroidTest \ 35 "-Pprotoc=${REPO_ROOT}/third_party/protobuf/src/protoc" \ 36 "-Pgrpc_cpp_plugin=${REPO_ROOT}/bins/opt/grpc_cpp_plugin" 37gcloud firebase test android run \ 38 --type instrumentation \ 39 --app app/build/outputs/apk/debug/app-debug.apk \ 40 --test app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk \ 41 --device model=Nexus6P,version=27,locale=en,orientation=portrait \ 42 --device model=Nexus6P,version=26,locale=en,orientation=portrait \ 43 --device model=Nexus6P,version=25,locale=en,orientation=portrait \ 44 --device model=Nexus6P,version=24,locale=en,orientation=portrait \ 45 --device model=Nexus6P,version=23,locale=en,orientation=portrait \ 46 --device model=Nexus6,version=22,locale=en,orientation=portrait \ 47 --device model=Nexus6,version=21,locale=en,orientation=portrait 48 49 50# Build hello world example 51 52cd "${REPO_ROOT}/examples/android/helloworld" 53./gradlew build \ 54 "-Pprotoc=${REPO_ROOT}/third_party/protobuf/src/protoc" \ 55 "-Pgrpc_cpp_plugin=${REPO_ROOT}/bins/opt/grpc_cpp_plugin" 56