1#!/usr/bin/env bash
2# Copyright 2017 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
16# Build all basic targets using the strict warning option which leverages the
17# clang compiler to check if sources can pass a set of warning options.
18# For now //examples/android/binder/ are excluded because it needs Android
19# SDK/NDK to be installed to build
20
21set -ex
22
23python3 tools/run_tests/python_utils/bazel_report_helper.py --report_path bazel_build_with_strict_warnings
24bazel_build_with_strict_warnings/bazel_wrapper \
25  --bazelrc=tools/remote_build/include/test_locally_with_resultstore_results.bazelrc \
26  build \
27  --define=use_strict_warning=true \
28  -- \
29  :all \
30  //src/core/... \
31  //src/compiler/... \
32  //test/... \
33  //examples/... \
34  -//examples/android/binder/...
35
36# TODO(jtattersmusch): Adding a build here for --define=grpc_no_xds is not ideal
37# and we should find a better place for this. Refer
38# https://github.com/grpc/grpc/pull/24536#pullrequestreview-517466531 for more
39# details.
40# Test that builds with --define=grpc_no_xds=true work.
41bazel build //test/cpp/end2end:end2end_test --define=grpc_no_xds=true
42
43# Test that builds that need xDS do not build with --define=grpc_no_xds=true
44EXIT_CODE=0
45bazel build //test/cpp/end2end/xds:xds_end2end_test --define=grpc_no_xds=true || EXIT_CODE=$?
46if [ $EXIT_CODE -eq 0 ]; then
47  echo "Building xds_end2end_test succeeded even with --define=grpc_no_xds=true"
48  exit 1
49fi
50