| 1 |
#!/bin/bash |
| 2 |
# Copyright 2021 The 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 |
# Be default xcodebuild generates gigabytes of useless output. We |
| 17 |
# use this script to make the logs smaller, while still keeping them |
| 18 |
# useful (e.g. we need to be able to see the logs printed by a test |
| 19 |
# when it fails on the CI). |
| 20 |
# Alternatives considered: |
| 21 |
# * "xcodebuild -quiet" prints much less output, but doesn't display the test outputs. |
| 22 |
# * "xcpretty" prints a nice and readable log, but doesn't display logs printed |
| 23 |
# by the tests when they fail (and we need those) |
| 24 |
# |
| 25 |
# Usage: |
| 26 |
# set -o pipefail # preserve xcodebuild's exit code when piping the output |
| 27 |
# xcodebuild ... | xcodebuild_filter_output.sh |
| 28 |
|
| 29 |
# need to be careful not to exclude important logs, so the patterns here need to be very specific. |
| 30 |
XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )' |
| 31 |
|
| 32 |
# we expect xcodebuild output piped to the stdin |
| 33 |
# - also skip empty lines |
| 34 |
grep -E -v "$XCODEBUILD_FILTER" - | grep -E -v "^$" - |
| 35 |
|
| 36 |
# TODO: What is this for? |
| 37 |
#| grep -E -v "(GPBDictionary|GPBArray)" - |