-
Notifications
You must be signed in to change notification settings - Fork 389
Expand file tree
/
Copy pathverify_compilation.sh
More file actions
52 lines (44 loc) · 1.44 KB
/
verify_compilation.sh
File metadata and controls
52 lines (44 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# This script loops over the generated clients and uses `mvn compile` to
# create a list of clients that cannot be compiled. The resulting list is
# printed to stdout
set -exo
repo_root=$(git rev-parse --show-toplevel)
export failed_libs="${repo_root}/failed_libs"
process_client() {
pom_dir=$1
pushd "${pom_dir}"
lib_name=$(pwd | sed 's/.*\(google-api-services-.*\)/\1/')
mvn compile || echo "${lib_name}" >> "${failed_libs}"
popd #pom_dir
}
print_failed_libraries() {
if [[ $(cat "${failed_libs}" | wc -l) -ne 0 ]]; then
echo "The following libraries had compilation errors:"
cat "${failed_libs}"
exit 1
else
echo "All libraries were compiled successfully!"
fi
}
# export process_client so it can be accessed by the inner shell launched by the
# find command
export -f process_client
# for convenience in local setups, we remove the failed libraries list
# beforehand
if [[ -f "${failed_libs}" ]];then
rm "${failed_libs}"
fi
pushd "${repo_root}"
# some distros rename parallel to parallel.moreutils
parallel_bin="parallel.moreutils"
which parallel.moreutils || parallel_bin="parallel"
# runs mvn compile in parallel (max 50 jobs)
targets=$(find "clients" -mindepth 3 -name '*2.0.0*' -printf '%p ')
echo "Attempting compilation on the following libraries:"
set +x
echo "${targets}" | sed 's/ /\n/g' | sort
set -x
${parallel_bin} -j50 -i bash -xe -c 'process_client "{}"' -- ${targets}
print_failed_libraries
popd #repo_root