File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,5 +5,4 @@ package foo;
55message Foo {
66 string name = 1 ;
77 string description = 2 ;
8- int32 age = 3 ;
98}
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ #
3+ # Shows an end-to-end workflow for accepting new patches without failing the build.
4+ set -o errexit -o pipefail -o nounset
5+
6+ if [ " $# " -eq 0 ]; then
7+ echo " usage: test.sh [target pattern...]"
8+ exit 1
9+ fi
10+
11+ fix=" "
12+ buildevents=$( mktemp)
13+ filter=' .namedSetOfFiles | values | .files[] | select(.name | endswith($ext)) | ((.pathPrefix | join("/")) + "/" + .name)'
14+
15+ args=(
16+ " --keep_going"
17+ " --output_groups=diff_bzl__patch"
18+ " --build_event_json_file=$buildevents "
19+ " --remote_download_regex='.*\.patch'"
20+ )
21+
22+ # Run build with validation disabled and output group for patches.
23+ # This will present us with patches to apply
24+ if ! bazel build ${args[@]} $@ ; then
25+ echo " Build failed, applying patches"
26+ to_apply_patches=$( jq --arg ext .patch --raw-output " $filter " " $buildevents " | tr -d ' \r' )
27+ wksp=$( bazel info workspace)
28+ for patch in $to_apply_patches ; do
29+ # continue if patch file content is empty
30+ if [[ ! -s " ${wksp} /${patch} " ]]; then
31+ continue
32+ fi
33+ echo " Applying patch ${patch} "
34+ patch -d ${wksp} -p0 < ${wksp} /${patch}
35+ done
36+ fi
37+
38+ exec bazel test $@
You can’t perform that action at this time.
0 commit comments