Files
wehub-resource-sync 7254f7b4d1
Build / Build (macos-latest) (push) Has been cancelled
Build / Build (ubuntu-latest) (push) Has been cancelled
Build / Build (windows-latest) (push) Has been cancelled
Build / Analyze (javascript) (push) Has been cancelled
Build / Analyze (python) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:37:45 +08:00

40 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
set -e
pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
src_dir=./third_party/source/catboost
clean() {
echo "catboost clean"
rm -rf "${src_dir}"
}
sync() {
echo "catboost sync"
mkdir -p "${src_dir}/catboost/libs/model/flatbuffers"
mkdir -p "${src_dir}/catboost/libs/helpers/flatbuffers"
curl --silent --show-error --location --output "${src_dir}/catboost/libs/helpers/flatbuffers/guid.fbs" "https://github.com/catboost/catboost/raw/master/catboost/libs/helpers/flatbuffers/guid.fbs"
curl --silent --show-error --location --output "${src_dir}/catboost/libs/model/flatbuffers/features.fbs" "https://github.com/catboost/catboost/raw/master/catboost/libs/model/flatbuffers/features.fbs"
curl --silent --show-error --location --output "${src_dir}/catboost/libs/model/flatbuffers/ctr_data.fbs" "https://github.com/catboost/catboost/raw/master/catboost/libs/model/flatbuffers/ctr_data.fbs"
curl --silent --show-error --location --output "${src_dir}/catboost/libs/model/flatbuffers/model.fbs" "https://github.com/catboost/catboost/raw/master/catboost/libs/model/flatbuffers/model.fbs"
}
schema() {
echo "catboost schema"
[[ $(grep -U $'\x0D' ./source/catboost-schema.js) ]] && crlf=1
node ./tools/flatc.js --root catboost --out ./source/catboost-schema.js --path "${src_dir}" ${src_dir}/catboost/libs/model/flatbuffers/model.fbs
if [[ -n ${crlf} ]]; then
unix2dos --quiet --newfile ./source/catboost-schema.js ./source/catboost-schema.js
fi
}
while [ "$#" != 0 ]; do
command="$1" && shift
case "${command}" in
"clean") clean;;
"sync") sync;;
"schema") schema;;
esac
done