| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #!/bin/bash
- set -e
- root=$(cd $(dirname ${0})/..; pwd)
- node_modules=${root}/node_modules
- src=${root}/src
- tools=${root}/tools
- third_party=${root}/third_party
- identifier=cntk
- bold() {
- echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"
- }
- git_sync() {
- mkdir -p "${third_party}"
- if [ -d "${third_party}/${1}" ]; then
- git -C "${third_party}/${1}" fetch -p --quiet
- git -C "${third_party}/${1}" reset --quiet --hard origin/master
- else
- echo "Clone ${2}..."
- git -C "${third_party}" clone --recursive ${2} ${1}
- fi
- git -C "${third_party}" submodule update --init
- }
- clean() {
- bold "cntk clean"
- rm -rf ${third_party}/cntk
- }
- sync() {
- bold "cntk sync"
- git_sync cntk https://github.com/Microsoft/CNTK.git
- }
- schema() {
- bold "cntk schema"
- ${node_modules}/protobufjs/bin/pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --keep-case -r cntk -o ${src}/cntk-proto.js ${third_party}/${identifier}/Source/CNTKv2LibraryDll/proto/CNTK.proto
- node ${tools}/update_pbjs.js array ${src}/cntk-proto.js value float 1
- }
- while [ "$#" != 0 ]; do
- command="$1" && shift
- case "${command}" in
- "clean") clean;;
- "sync") sync;;
- "schema") schema;;
- esac
- done
|