aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Androbin <robin.richtsfeld@gmail.com>2017-11-08 21:31:52 +0100
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-11-16 01:27:34 +0100
commit85e4896db911f77f1223f080c540b8cbf133f873 (patch)
tree67afec5f686ac66ebddb4fbed3b7999ad6262795
parentdc7399af31d53d9b94b844baaee3e7c918cf10d4 (diff)
Improve shell scripts in third_party/ (#4052)
Closes #4052. Change-Id: I30c4dc047195404a6ff63338ac4a944bb2755a1f
-rwxr-xr-xthird_party/ijar/test/ijar_test.sh2
-rwxr-xr-xthird_party/nanopb/tools/make_windows_package.sh4
-rwxr-xr-xthird_party/protobuf/3.4.0/generate_descriptor_proto.sh4
-rwxr-xr-xthird_party/protobuf/3.4.0/objectivec/DevTools/full_mac_build.sh10
-rwxr-xr-xthird_party/protobuf/3.4.0/protoc-artifacts/build-protoc.sh2
-rwxr-xr-xthird_party/protobuf/3.4.0/protoc-artifacts/build-zip.sh2
-rwxr-xr-xthird_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_output_unittest.sh2
-rwxr-xr-xthird_party/protobuf/3.4.0/update_file_lists.sh2
8 files changed, 15 insertions, 13 deletions
diff --git a/third_party/ijar/test/ijar_test.sh b/third_party/ijar/test/ijar_test.sh
index 0b9a92fb2d..5279f15f84 100755
--- a/third_party/ijar/test/ijar_test.sh
+++ b/third_party/ijar/test/ijar_test.sh
@@ -41,7 +41,7 @@ shift
source ${DIR}/testenv.sh || { echo "testenv.sh not found!" >&2; exit 1; }
function cleanup() {
- rm -fr "$TEST_TMPDIR"/*
+ rm -fr "${TEST_TMPDIR:-sentinel}"/*
}
trap cleanup EXIT
diff --git a/third_party/nanopb/tools/make_windows_package.sh b/third_party/nanopb/tools/make_windows_package.sh
index 72de6f3394..4010a31616 100755
--- a/third_party/nanopb/tools/make_windows_package.sh
+++ b/third_party/nanopb/tools/make_windows_package.sh
@@ -47,8 +47,8 @@ cp `which MSVCR100.DLL` $DEST/generator-bin/
cp `which MSVCP100.DLL` $DEST/generator-bin/
# Convert line breaks for convenience
-find $DEST -name '*.c' -o -name '*.h' -o -name '*.txt' \
- -o -name '*.proto' -o -name '*.py' -o -name '*.options' \
+find $DEST \( -name '*.c' -o -name '*.h' -o -name '*.txt' \
+ -o -name '*.proto' -o -name '*.py' -o -name '*.options' \) \
-exec unix2dos '{}' \;
# Zip it all up
diff --git a/third_party/protobuf/3.4.0/generate_descriptor_proto.sh b/third_party/protobuf/3.4.0/generate_descriptor_proto.sh
index 8a5ed48a2b..e15276faad 100755
--- a/third_party/protobuf/3.4.0/generate_descriptor_proto.sh
+++ b/third_party/protobuf/3.4.0/generate_descriptor_proto.sh
@@ -81,7 +81,7 @@ do
$PROTOC --cpp_out=dllexport_decl=LIBPROTOBUF_EXPORT:$TMP ${RUNTIME_PROTO_FILES[@]} && \
$PROTOC --cpp_out=dllexport_decl=LIBPROTOC_EXPORT:$TMP ${COMPILER_PROTO_FILES[@]}
- for PROTO_FILE in ${RUNTIME_PROTO_FILES[@]} ${COMPILER_PROTO_FILES[@]}; do
+ for PROTO_FILE in "${RUNTIME_PROTO_FILES[@]}" "${COMPILER_PROTO_FILES[@]}"; do
BASE_NAME=${PROTO_FILE%.*}
diff ${BASE_NAME}.pb.h $TMP/${BASE_NAME}.pb.h > /dev/null
if test $? -ne 0; then
@@ -96,7 +96,7 @@ do
# Only override the output if the files are different to avoid re-compilation
# of the protoc.
if [ $CORE_PROTO_IS_CORRECT -ne 1 ]; then
- for PROTO_FILE in ${RUNTIME_PROTO_FILES[@]} ${COMPILER_PROTO_FILES[@]}; do
+ for PROTO_FILE in "${RUNTIME_PROTO_FILES[@]}" "${COMPILER_PROTO_FILES[@]}"; do
BASE_NAME=${PROTO_FILE%.*}
mv $TMP/${BASE_NAME}.pb.h ${BASE_NAME}.pb.h
mv $TMP/${BASE_NAME}.pb.cc ${BASE_NAME}.pb.cc
diff --git a/third_party/protobuf/3.4.0/objectivec/DevTools/full_mac_build.sh b/third_party/protobuf/3.4.0/objectivec/DevTools/full_mac_build.sh
index c3cc8e6826..159630e2c2 100755
--- a/third_party/protobuf/3.4.0/objectivec/DevTools/full_mac_build.sh
+++ b/third_party/protobuf/3.4.0/objectivec/DevTools/full_mac_build.sh
@@ -206,9 +206,10 @@ else
wrapped_make -j "${NUM_MAKE_JOBS}" all
wrapped_make -j "${NUM_MAKE_JOBS}" check
# Fire off the conformance tests also.
- cd conformance
+ (
+ cd conformance || exit
wrapped_make -j "${NUM_MAKE_JOBS}" test_cpp
- cd ..
+ )
fi
# Ensure the WKT sources checked in are current.
@@ -331,7 +332,8 @@ fi
if [[ "${DO_OBJC_CONFORMANCE_TESTS}" == "yes" ]] ; then
header "Running ObjC Conformance Tests"
- cd conformance
+ (
+ cd conformance || exit
wrapped_make -j "${NUM_MAKE_JOBS}" test_objc
- cd ..
+ )
fi
diff --git a/third_party/protobuf/3.4.0/protoc-artifacts/build-protoc.sh b/third_party/protobuf/3.4.0/protoc-artifacts/build-protoc.sh
index 57523a41bf..29acff9fb1 100755
--- a/third_party/protobuf/3.4.0/protoc-artifacts/build-protoc.sh
+++ b/third_party/protobuf/3.4.0/protoc-artifacts/build-protoc.sh
@@ -10,7 +10,7 @@ OS=$1
ARCH=$2
MAKE_TARGET=$3
-if [[ $# < 3 ]]; then
+if [[ $# -lt 3 ]]; then
echo "No arguments provided. This script is intended to be run from Maven."
exit 1
fi
diff --git a/third_party/protobuf/3.4.0/protoc-artifacts/build-zip.sh b/third_party/protobuf/3.4.0/protoc-artifacts/build-zip.sh
index a124ed7ccf..b46029eed7 100755
--- a/third_party/protobuf/3.4.0/protoc-artifacts/build-zip.sh
+++ b/third_party/protobuf/3.4.0/protoc-artifacts/build-zip.sh
@@ -58,7 +58,7 @@ DIR=$(mktemp -d)
# Copy over well-known types.
mkdir -p ${DIR}/include/google/protobuf/compiler
-for PROTO in ${WELL_KNOWN_TYPES[@]}; do
+for PROTO in "${WELL_KNOWN_TYPES[@]}"; do
cp -f ../src/${PROTO} ${DIR}/include/${PROTO}
done
diff --git a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_output_unittest.sh b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_output_unittest.sh
index f85979128b..abd2c374c3 100755
--- a/third_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_output_unittest.sh
+++ b/third_party/protobuf/3.4.0/src/google/protobuf/compiler/zip_output_unittest.sh
@@ -81,7 +81,7 @@ if $JAR c $TEST_TMPDIR/testzip.proto > /dev/null; then
|| fail 'jar failed.'
# Check that -interface.jar timestamps are normalized:
- if [[ "$(TZ=UTC $JAR tvf $TEST_TMPDIR/testzip.jar)" != *'Tue Jan 01 00:00:00 UTC 1980'* ]]; then
+ if [ "$(TZ=UTC $JAR tvf $TEST_TMPDIR/testzip.jar)" != *'Tue Jan 01 00:00:00 UTC 1980'* ]; then
fail 'Zip did not contain normalized timestamps'
fi
diff --git a/third_party/protobuf/3.4.0/update_file_lists.sh b/third_party/protobuf/3.4.0/update_file_lists.sh
index 9c0fbdc586..6d4b5735f1 100755
--- a/third_party/protobuf/3.4.0/update_file_lists.sh
+++ b/third_party/protobuf/3.4.0/update_file_lists.sh
@@ -36,7 +36,7 @@ get_proto_files() {
}
sort_files() {
- for FILE in $@; do
+ for FILE in "$@"; do
echo $FILE
done | LC_ALL=C sort | uniq
}