ref: 78d0968e0943f08093269506158dd118ba750aaa
parent: f5628853d7b832d9794f9ea92f2f8c59413c9dce
author: James Zern <jzern@google.com>
date: Tue Jun 3 12:22:43 EDT 2014
gen_msvs_*proj.sh: speed up file generation execute fix_path once on the source file list rather than once per entry Change-Id: Ibc8226e391b3028c1b0bcfeab83c790387c9fe23
--- a/build/make/gen_msvs_proj.sh
+++ b/build/make/gen_msvs_proj.sh
@@ -174,7 +174,8 @@
-*) die_unknown $opt
;;
*)
- file_list[${#file_list[@]}]="$(fix_path $opt)"
+ # The paths in file_list are fixed outside of the loop.
+ file_list[${#file_list[@]}]="$opt"
case "$opt" in
*.asm) uses_asm=true
;;
@@ -182,6 +183,10 @@
;;
esac
done
+
+# Make one call to fix_path for file_list to improve performance.
+fix_file_list
+
outfile=${outfile:-/dev/stdout}
guid=${guid:-`generate_uuid`}
asm_use_custom_step=false
--- a/build/make/gen_msvs_vcxproj.sh
+++ b/build/make/gen_msvs_vcxproj.sh
@@ -196,7 +196,8 @@
-*) die_unknown $opt
;;
*)
- file_list[${#file_list[@]}]="$(fix_path $opt)"
+ # The paths in file_list are fixed outside of the loop.
+ file_list[${#file_list[@]}]="$opt"
case "$opt" in
*.asm|*.s) uses_asm=true
;;
@@ -204,6 +205,10 @@
;;
esac
done
+
+# Make one call to fix_path for file_list to improve performance.
+fix_file_list
+
outfile=${outfile:-/dev/stdout}
guid=${guid:-`generate_uuid`}
asm_use_custom_step=false
--- a/build/make/msvs_common.sh
+++ b/build/make/msvs_common.sh
@@ -13,7 +13,7 @@
&& cygpath --help >/dev/null 2>&1; then
FIXPATH='cygpath -m'
else
- FIXPATH='echo'
+ FIXPATH='echo_path'
fi
die() {
@@ -27,8 +27,23 @@
exit 1
}
+echo_path() {
+ for path; do
+ echo "$path"
+ done
+}
+
+# Output one, possibly changed based on the system, path per line.
fix_path() {
- $FIXPATH "$1"
+ $FIXPATH "$@"
+}
+
+# Corrects the paths in file_list in one pass for efficiency.
+fix_file_list() {
+ # TODO(jzern): this could be more generic and take the array as a param.
+ files=$(fix_path "${file_list[@]}")
+ local IFS=$'\n'
+ file_list=($files)
}
generate_uuid() {