blob: 2bd398ef6d655933db9dd3c4a7bb86b3f2548ca9 [file] [log] [blame]
Vitaly Bukadd3b58a2015-09-02 13:29:58 -07001#!/bin/bash
Vitaly Buka4615e0d2015-10-14 15:35:12 -07002# Copyright 2015 The Weave Authors. All rights reserved.
Vitaly Bukadd3b58a2015-09-02 13:29:58 -07003# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
Johan Euphrosine3523fdd2015-10-14 20:46:05 -07007ROOT_DIR=$(cd -P -- "$(dirname -- "$0")/.." && pwd -P)
Vitaly Bukadd3b58a2015-09-02 13:29:58 -07008
9cd $ROOT_DIR
10
Johan Euphrosine3523fdd2015-10-14 20:46:05 -070011gyp -Ilibweave_common.gypi --toplevel-dir=. --depth=. -f ninja $DIR/daemon/daemon.gyp
Vitaly Bukadd3b58a2015-09-02 13:29:58 -070012
13if [ -z "$BUILD_CONFIG" ]; then
14 export BUILD_CONFIG=Debug
15fi
16
17export BUILD_TARGET=$*
18if [ -z "$BUILD_TARGET" ]; then
Johan Euphrosine3523fdd2015-10-14 20:46:05 -070019 export BUILD_TARGET="weave_daemon libweave_testrunner libweave_exports_testrunner"
Vitaly Bukadd3b58a2015-09-02 13:29:58 -070020fi
21
22export CORES=`cat /proc/cpuinfo | grep processor | wc -l`
23ninja -j $CORES -C out/${BUILD_CONFIG} $BUILD_TARGET || exit 1
24
25if [[ $BUILD_TARGET == *"libweave_testrunner"* ]]; then
Vitaly Buka3110deb2015-10-06 19:54:09 -070026 out/${BUILD_CONFIG}/libweave_testrunner --gtest_break_on_failure || exit 1
27 out/${BUILD_CONFIG}/libweave_exports_testrunner --gtest_break_on_failure || exit 1
Vitaly Bukadd3b58a2015-09-02 13:29:58 -070028fi