1*65c59e02SInna Palant#!/bin/bash 2*65c59e02SInna Palant# Copyright (c) Facebook, Inc. and its affiliates. 3*65c59e02SInna Palant# 4*65c59e02SInna Palant# Licensed under the Apache License, Version 2.0 (the "License"); 5*65c59e02SInna Palant# you may not use this file except in compliance with the License. 6*65c59e02SInna Palant# You may obtain a copy of the License at 7*65c59e02SInna Palant# 8*65c59e02SInna Palant# http://www.apache.org/licenses/LICENSE-2.0 9*65c59e02SInna Palant# 10*65c59e02SInna Palant# Unless required by applicable law or agreed to in writing, software 11*65c59e02SInna Palant# distributed under the License is distributed on an "AS IS" BASIS, 12*65c59e02SInna Palant# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*65c59e02SInna Palant# See the License for the specific language governing permissions and 14*65c59e02SInna Palant# limitations under the License. 15*65c59e02SInna Palant 16*65c59e02SInna Palantset -exo pipefail 17*65c59e02SInna Palant 18*65c59e02SInna PalantBASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/.." 19*65c59e02SInna PalantCMAKE=$ANDROID_HOME/cmake/3.18.1/bin/cmake 20*65c59e02SInna Palantexport CXX=clang++ 21*65c59e02SInna Palant 22*65c59e02SInna Palantmkdir -p "$BASE_DIR/host-build-cmake" 23*65c59e02SInna Palantcd "$BASE_DIR/host-build-cmake" 24*65c59e02SInna Palant 25*65c59e02SInna Palant# Configure CMake project 26*65c59e02SInna Palant$CMAKE -DJAVA_HOME="$JAVA_HOME" .. 27*65c59e02SInna Palant# Build binaries and libraries 28*65c59e02SInna Palantmake 29*65c59e02SInna Palant# Run C++ tests 30*65c59e02SInna Palantmake test 31*65c59e02SInna Palant# LD_LIBRARY_PATH is needed for native library dependencies to load cleanly 32*65c59e02SInna PalantTEST_LD_LIBRARY_PATH="$BASE_DIR/host-build-cmake:$BASE_DIR/host-build-cmake/test/jni" 33*65c59e02SInna Palant# Build and run JNI tests 34*65c59e02SInna Palantcd "$BASE_DIR" 35*65c59e02SInna Palantenv LD_LIBRARY_PATH="$TEST_LD_LIBRARY_PATH" ./gradlew -b host.gradle -PbuildDir=host-build-gradle test 36