From 2bd7f516e5f9b47abd9cd59d77bbb87ebe1f2bef Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Wed, 25 Apr 2018 08:21:17 +0200 Subject: [PATCH] fix duplicate mkdir in update_file_lists.sh - merge loop for .h and .proto includes - fix shellcheck errors --- cmake/extract_includes.bat.in | 3 --- update_file_lists.sh | 25 +++++++------------------ 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/cmake/extract_includes.bat.in b/cmake/extract_includes.bat.in index 2f71e26b6590d..9fd9de0dae13b 100644 --- a/cmake/extract_includes.bat.in +++ b/cmake/extract_includes.bat.in @@ -111,9 +111,6 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format.h" includ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite.h" include\google\protobuf\wire_format_lite.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite_inl.h" include\google\protobuf\wire_format_lite_inl.h copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.pb.h" include\google\protobuf\wrappers.pb.h -mkdir include\google -mkdir include\google\protobuf -mkdir include\google\protobuf\compiler copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.proto" include\google\protobuf\any.proto copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.proto" include\google\protobuf\api.proto copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.proto" include\google\protobuf\compiler\plugin.proto diff --git a/update_file_lists.sh b/update_file_lists.sh index 37aa996ba9c82..646c8ce344605 100755 --- a/update_file_lists.sh +++ b/update_file_lists.sh @@ -128,26 +128,15 @@ set_cmake_value $CMAKE_DIR/tests.cmake lite_arena_test_files $CMAKE_PREFIX $LITE # Generate extract_includes.bat echo "mkdir include" > $EXTRACT_INCLUDES_BAT -for HEADER in $PUBLIC_HEADERS; do - HEADER_DIR=$(dirname $HEADER) - while [ ! "$HEADER_DIR" = "." ]; do - echo $HEADER_DIR | sed "s/\\//\\\\/g" - HEADER_DIR=$(dirname $HEADER_DIR) - done -done | sort | uniq | sed "s/^/mkdir include\\\\/" >> $EXTRACT_INCLUDES_BAT -for HEADER in $PUBLIC_HEADERS; do - WINPATH=$(echo $HEADER | sed 's;/;\\;g') - echo "copy \"\${PROTOBUF_SOURCE_WIN32_PATH}\\..\\src\\$WINPATH\" include\\$WINPATH" >> $EXTRACT_INCLUDES_BAT -done -for PROTO in ${WKT_PROTOS}; do - PROTO_DIR=$(dirname "$PROTO") - while [ ! "$PROTO_DIR" = "." ]; do - echo "mkdir include\\${PROTO_DIR//\//\\}" - PROTO_DIR=$(dirname "$PROTO_DIR") +for INCLUDE in $PUBLIC_HEADERS $WKT_PROTOS; do + INCLUDE_DIR=$(dirname "$INCLUDE") + while [ ! "$INCLUDE_DIR" = "." ]; do + echo "mkdir include\\${INCLUDE_DIR//\//\\}" + INCLUDE_DIR=$(dirname "$INCLUDE_DIR") done done | sort | uniq >> $EXTRACT_INCLUDES_BAT -for PROTO in $WKT_PROTOS; do - WINPATH=${PROTO//\//\\} +for INCLUDE in $PUBLIC_HEADERS $WKT_PROTOS; do + WINPATH=${INCLUDE//\//\\} echo "copy \"\${PROTOBUF_SOURCE_WIN32_PATH}\\..\\src\\$WINPATH\" include\\$WINPATH" >> $EXTRACT_INCLUDES_BAT done