OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 if [ $# -ne 1 ]; then |
| 4 cat <<EOF |
| 5 Usage: $0 <VERSION_NUMBER> |
| 6 |
| 7 Example: |
| 8 $ $0 3.0.0 |
| 9 |
| 10 This script will download pre-built protoc binaries from maven repository and |
| 11 create the Google.Protobuf.Tools package. Well-known type .proto files will also |
| 12 be included. |
| 13 EOF |
| 14 exit 1 |
| 15 fi |
| 16 |
| 17 VERSION_NUMBER=$1 |
| 18 # <directory name> <binary file name> pairs. |
| 19 declare -a FILE_NAMES=( \ |
| 20 windows_x86 windows-x86_32.exe \ |
| 21 windows_x64 windows-x86_64.exe \ |
| 22 macosx_x86 osx-x86_32.exe \ |
| 23 macosx_x64 osx-x86_64.exe \ |
| 24 linux_x86 linux-x86_32.exe \ |
| 25 linux_x64 linux-x86_64.exe \ |
| 26 ) |
| 27 |
| 28 set -e |
| 29 |
| 30 mkdir -p protoc |
| 31 # Create a zip file for each binary. |
| 32 for((i=0;i<${#FILE_NAMES[@]};i+=2));do |
| 33 DIR_NAME=${FILE_NAMES[$i]} |
| 34 mkdir -p protoc/$DIR_NAME |
| 35 |
| 36 if [ ${DIR_NAME:0:3} = "win" ]; then |
| 37 TARGET_BINARY="protoc.exe" |
| 38 else |
| 39 TARGET_BINARY="protoc" |
| 40 fi |
| 41 |
| 42 BINARY_NAME=${FILE_NAMES[$(($i+1))]} |
| 43 BINARY_URL=http://repo1.maven.org/maven2/com/google/protobuf/protoc/${VERSION_
NUMBER}/protoc-${VERSION_NUMBER}-${BINARY_NAME} |
| 44 |
| 45 if ! wget ${BINARY_URL} -O protoc/$DIR_NAME/$TARGET_BINARY &> /dev/null; then |
| 46 echo "[ERROR] Failed to download ${BINARY_URL}" >&2 |
| 47 echo "[ERROR] Skipped $protoc-${VERSION_NAME}-${DIR_NAME}" >&2 |
| 48 continue |
| 49 fi |
| 50 done |
| 51 |
| 52 nuget pack Google.Protobuf.Tools.nuspec |
OLD | NEW |