瀏覽代碼

Update script CRLF checks

Lutz Roeder 6 年之前
父節點
當前提交
4555943a16
共有 12 個文件被更改,包括 19 次插入15 次删除
  1. 1 1
      tools/armnn
  2. 1 1
      tools/bigdl
  3. 1 1
      tools/caffe
  4. 1 1
      tools/cntk
  5. 1 1
      tools/coreml
  6. 1 1
      tools/mnn
  7. 5 1
      tools/onnx
  8. 1 1
      tools/paddle
  9. 2 2
      tools/pytorch
  10. 1 1
      tools/sklearn
  11. 3 3
      tools/tf
  12. 1 1
      tools/tflite

+ 1 - 1
tools/armnn

@@ -55,7 +55,7 @@ schema() {
             flatc=${flatc_dir}/flatc.exe
             ;;
     esac
-    [[ $(file ./src/armnn-schema.js) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/armnn-schema.js) ]] && crlf=1
     ${flatc} --no-js-exports -o ./tools/. --js ./third_party/armnn/src/armnnSerializer/ArmnnSchema.fbs
     mv ./tools/ArmnnSchema_generated.js ./src/armnn-schema.js
     cat <<EOT >> ./src/armnn-schema.js

+ 1 - 1
tools/bigdl

@@ -26,7 +26,7 @@ sync() {
 
 schema() {
     bold "bigdl schema"
-    [[ $(file ./src/bigdl-proto.js) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/bigdl-proto.js) ]] && crlf=1
     npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case -r bigdl -o ./src/bigdl-proto.js ./third_party/bigdl/spark/dl/src/main/resources/serialization/bigdl.proto
     if [[ -n ${crlf} ]]; then
         unix2dos --quiet --newfile ./src/bigdl-proto.js ./src/bigdl-proto.js

+ 1 - 1
tools/caffe

@@ -25,7 +25,7 @@ sync() {
 
 schema() {
     bold "caffe schema"
-    [[ $(file ./src/caffe-proto.js) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/caffe-proto.js) ]] && crlf=1
     sed 's/required float min = 1;/optional float min = 1;/g;s/required float max = 2;/optional float max = 2;/g' < ./third_party/caffe/src/caffe/proto/caffe.proto >./tools/caffe.proto
     npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case --decode-text -r caffe -o ./src/caffe-proto.js ./tools/caffe.proto
     rm ./tools/caffe.proto

+ 1 - 1
tools/cntk

@@ -26,7 +26,7 @@ sync() {
 
 schema() {
     bold "cntk schema"
-    [[ $(file ./src/cntk-proto.js) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/cntk-proto.js) ]] && crlf=1
     npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case -r cntk -o ./src/cntk-proto.js ./third_party/cntk/Source/CNTKv2LibraryDll/proto/CNTK.proto
     node ./tools/update_pbjs.js array ./src/cntk-proto.js value float 1
     if [[ -n ${crlf} ]]; then

+ 1 - 1
tools/coreml

@@ -38,7 +38,7 @@ sync() {
 
 schema() {
     bold "coreml schema"
-    [[ $(file ./src/coreml-proto.js) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/coreml-proto.js) ]] && crlf=1
     npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case -r coreml -o ./src/coreml-proto.js ./third_party/coremltools/mlmodel/format/Model.proto
     node ./tools/update_pbjs.js array ./src/coreml-proto.js floatValue float 2
     if [[ -n ${crlf} ]]; then

+ 1 - 1
tools/mnn

@@ -55,7 +55,7 @@ schema() {
             flatc=${flatc_dir}/flatc.exe
             ;;
     esac
-    [[ $(file ./src/mnn-schema.js) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/mnn-schema.js) ]] && crlf=1
     ${flatc} --no-js-exports --gen-all -o ./tools/. --js ./third_party/mnn/schema/default/MNN.fbs
     mv ./tools/MNN_generated.js ./src/mnn-schema.js
     cat <<EOT >> ./src/mnn-schema.js

+ 5 - 1
tools/onnx

@@ -67,7 +67,7 @@ install() {
 
 schema() {
     bold "onnx schema"
-    [[ $(file ./src/onnx-proto.js) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/onnx-proto.js) ]] && crlf=1
     npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case --decode-text -r onnx -o ./src/onnx-proto.js ./third_party/onnx/onnx/onnx-ml.proto ./third_party/onnx/onnx/onnx-operators-ml.proto
     node ./tools/update_pbjs.js array ./src/onnx-proto.js float_data float 1
     node ./tools/update_pbjs.js array ./src/onnx-proto.js double_data double 1
@@ -78,9 +78,13 @@ schema() {
 
 metadata() {
     bold "onnx metadata"
+    [[ $(grep -U $'\x0D' ./src/onnx-metadata.json) ]] && crlf=1
     venv
     ${python} ./tools/onnx-script.py metadata
     deactivate
+    if [[ -n ${crlf} ]]; then
+        unix2dos --quiet --newfile ./src/onnx-metadata.json ./src/onnx-metadata.json
+    fi
 }
 
 convert() {

+ 1 - 1
tools/paddle

@@ -24,7 +24,7 @@ sync() {
 
 schema() {
     bold "paddle schema"
-    [[ $(file ./src/paddle-proto.js) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/paddle-proto.js) ]] && crlf=1
     npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case -r paddle -o ./src/paddle-proto.js ./third_party/paddle/paddle/fluid/framework/framework.proto
     if [[ -n ${crlf} ]]; then
         unix2dos --quiet --newfile ./src/paddle-proto.js ./src/paddle-proto.js

+ 2 - 2
tools/pytorch

@@ -54,7 +54,7 @@ install() {
 
 schema() {
     bold "caffe2 schema"
-    [[ $(file ./src/caffe2-proto.js) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/caffe2-proto.js) ]] && crlf=1
     npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case --decode-text -r caffe2 -o ./src/caffe2-proto.js ./third_party/pytorch/caffe2/proto/caffe2.proto
     node ./tools/update_pbjs.js enumeration ./src/caffe2-proto.js floats float 1
     if [[ -n ${crlf} ]]; then
@@ -63,7 +63,7 @@ schema() {
 }
 
 metadata() {
-    [[ $(file ./src/pytorch-metadata.json) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/pytorch-metadata.json) ]] && crlf=1
     venv
     bold "pytorch metadata"
     ${python} ./tools/pytorch-script.py metadata

+ 1 - 1
tools/sklearn

@@ -58,7 +58,7 @@ install() {
 
 metadata() {
     bold "sklearn metadata"
-    [[ $(file ./src/sklearn-metadata.json) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/sklearn-metadata.json) ]] && crlf=1
     venv
     ${python} ./tools/sklearn-script.py
     deactivate

+ 3 - 3
tools/tf

@@ -46,7 +46,7 @@ install() {
 
 schema() {
     bold "tf schema"
-    [[ $(file ./src/tf-proto.js) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/tf-proto.js) ]] && crlf=1
     npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case --decode-text -r tf -o ./src/tf-proto.js \
         ./third_party/tensorflow/tensorflow/core/protobuf/saved_model.proto \
         ./third_party/tensorflow/tensorflow/core/protobuf/meta_graph.proto \
@@ -74,7 +74,7 @@ schema() {
 
 metadata() {
     bold "tf metadata"
-    [[ $(file ./src/tf-metadata.json) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/tf-metadata.json) ]] && crlf=1
     venv
     case "${OSTYPE}" in
         linux*)
@@ -88,7 +88,7 @@ metadata() {
         msys*)
             protoc_version=$(curl -s https://api.github.com/repos/protocolbuffers/protobuf/releases/latest | grep tag_name | cut -f 2 -d : | cut -f 2 -d '"' | cut -f 2 -d v)
             protoc_dir=$(dirname $(mktemp -u))/protobuf/v${protoc_version}
-            if [ ! -f "${protoc_dir}/bin/flatc" ]; then
+            if [ ! -f "${protoc_dir}/bin/protoc.exe" ]; then
                 mkdir -p "${protoc_dir}"
                 pushd "${protoc_dir}" > /dev/null
                 curl -sL -O https://github.com/protocolbuffers/protobuf/releases/download/v${protoc_version}/protoc-${protoc_version}-win32.zip

+ 1 - 1
tools/tflite

@@ -70,7 +70,7 @@ schema() {
             flatc=${flatc_dir}/flatc.exe
             ;;
     esac
-    [[ $(file ./src/tflite-schema.js) =~ CRLF ]] && crlf=1
+    [[ $(grep -U $'\x0D' ./src/tflite-schema.js) ]] && crlf=1
     sed 's/namespace tflite;/namespace TFLITE;/g' < ./third_party/tensorflow/tensorflow/lite/schema/schema.fbs > ./tools/tflite.schema.fbs
     ${flatc} --no-js-exports --js ./tools/tflite.schema.fbs
     rm ./tools/tflite.schema.fbs