milvus/internal/core/build-support/add_license.sh
zhenshan.cao fda8d62b38 Fix make error
Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
2020-11-30 22:14:19 +08:00

31 lines
711 B
Bash
Executable File

LICENSE=$1
FOLDER=$2
if [ -z ${FOLDER} ] || [ -z ${LICENSE} ]; then
echo "usage $0 <path/to/license> <path/to/code_folder>"
exit
fi
cat ${LICENSE} > /dev/null || exit -1
FILES=`find ${FOLDER} \
| grep -E "(*\.cpp$|*\.h$|*\.cu$)" \
| grep -v thirdparty \
| grep -v cmake_build \
| grep -v cmake-build \
| grep -v output \
| grep -v "\.pb\."`
# echo formating ${FILES} ...
skip_count=0
for f in ${FILES}; do
if (grep "Apache License" $f > /dev/null);then
# echo "No need to copy the License Header to $f"
skip_count=$((skip_count+1))
else
cat ${LICENSE} $f > $f.new
mv $f.new $f
echo "License Header copied to $f"
fi
done
echo "license adder: $skip_count file(s) skiped"