• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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# Accept the Android SDK licences.
19yes | /opt/android-sdk/current/tools/bin/sdkmanager --licenses
20
21# change to grpc repo root
22cd $(dirname $0)/../../..
23
24REPO_ROOT="$(pwd)"
25
26git submodule update --init
27
28# Build protoc and grpc_cpp_plugin. Codegen is not cross-compiled to Android
29mkdir -p cmake/build
30pushd cmake/build
31cmake -DgRPC_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ../..
32make protoc grpc_cpp_plugin -j2
33popd
34
35PROTOC=${REPO_ROOT}/cmake/build/third_party/protobuf/protoc
36PLUGIN=${REPO_ROOT}/cmake/build/grpc_cpp_plugin
37
38# Build and run interop instrumentation tests on Firebase Test Lab
39
40cd "${REPO_ROOT}/src/android/test/interop/"
41./gradlew assembleDebug \
42    "-Pprotoc=${PROTOC}" \
43    "-Pgrpc_cpp_plugin=${PLUGIN}"
44./gradlew assembleDebugAndroidTest \
45    "-Pprotoc=${PROTOC}" \
46    "-Pgrpc_cpp_plugin=${PLUGIN}"
47gcloud firebase test android run \
48    --type instrumentation \
49    --app app/build/outputs/apk/debug/app-debug.apk \
50    --test app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk \
51    --device model=Nexus6P,version=27,locale=en,orientation=portrait \
52    --device model=Nexus6P,version=26,locale=en,orientation=portrait \
53    --device model=Nexus6P,version=25,locale=en,orientation=portrait \
54    --device model=Nexus6P,version=24,locale=en,orientation=portrait \
55    --device model=Nexus6P,version=23,locale=en,orientation=portrait \
56    --device model=Nexus6,version=22,locale=en,orientation=portrait \
57    --device model=Nexus6,version=21,locale=en,orientation=portrait \
58    --device model=walleye,version=28,locale=en,orientation=portrait
59
60
61# Build hello world example
62
63cd "${REPO_ROOT}/examples/android/helloworld"
64./gradlew build \
65    "-Pprotoc=${PROTOC}" \
66    "-Pgrpc_cpp_plugin=${PLUGIN}"
67