Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: third_party/protobuf/protoc-artifacts/build-zip.sh

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/bin/bash
2
3 if [ $# -ne 2 ]; then
4 cat <<EOF
5 Usage: $0 <TARGET> <VERSION_NUMBER>
6
7 TARGET: protoc | protoc-gen-javalite
8
9 Example:
10 $ $0 protoc 3.0.0
11 $ $0 protoc-gen-javalite 3.0.0
12
13 This script will download pre-built protoc or protoc plugin binaries from maven
14 repository and create .zip packages suitable to be included in the github
15 release page. If the target is protoc, well-known type .proto files will also be
16 included. Each invocation will create 5 zip packages:
17 dist/<TARGET>-<VERSION_NUMBER>-win32.zip
18 dist/<TARGET>-<VERSION_NUMBER>-osx-x86_32.zip
19 dist/<TARGET>-<VERSION_NUMBER>-osx-x86_64.zip
20 dist/<TARGET>-<VERSION_NUMBER>-linux-x86_32.zip
21 dist/<TARGET>-<VERSION_NUMBER>-linux-x86_64.zip
22 EOF
23 exit 1
24 fi
25
26 TARGET=$1
27 VERSION_NUMBER=$2
28
29 # <zip file name> <binary file name> pairs.
30 declare -a FILE_NAMES=( \
31 win32.zip windows-x86_32.exe \
32 osx-x86_32.zip osx-x86_32.exe \
33 osx-x86_64.zip osx-x86_64.exe \
34 linux-x86_32.zip linux-x86_32.exe \
35 linux-x86_64.zip linux-x86_64.exe \
36 )
37
38 # List of all well-known types to be included.
39 declare -a WELL_KNOWN_TYPES=( \
40 google/protobuf/descriptor.proto \
41 google/protobuf/any.proto \
42 google/protobuf/api.proto \
43 google/protobuf/duration.proto \
44 google/protobuf/empty.proto \
45 google/protobuf/field_mask.proto \
46 google/protobuf/source_context.proto \
47 google/protobuf/struct.proto \
48 google/protobuf/timestamp.proto \
49 google/protobuf/type.proto \
50 google/protobuf/wrappers.proto \
51 google/protobuf/compiler/plugin.proto \
52 )
53
54 set -e
55
56 # A temporary working directory to put all files.
57 DIR=$(mktemp -d)
58
59 # Copy over well-known types.
60 mkdir -p ${DIR}/include/google/protobuf/compiler
61 for PROTO in ${WELL_KNOWN_TYPES[@]}; do
62 cp -f ../src/${PROTO} ${DIR}/include/${PROTO}
63 done
64
65 # Create a readme file.
66 cat <<EOF > ${DIR}/readme.txt
67 Protocol Buffers - Google's data interchange format
68 Copyright 2008 Google Inc.
69 https://developers.google.com/protocol-buffers/
70
71 This package contains a precompiled binary version of the protocol buffer
72 compiler (protoc). This binary is intended for users who want to use Protocol
73 Buffers in languages other than C++ but do not want to compile protoc
74 themselves. To install, simply place this binary somewhere in your PATH.
75
76 Please refer to our official github site for more installation instructions:
77 https://github.com/google/protobuf
78 EOF
79
80 mkdir -p dist
81 mkdir -p ${DIR}/bin
82 # Create a zip file for each binary.
83 for((i=0;i<${#FILE_NAMES[@]};i+=2));do
84 ZIP_NAME=${FILE_NAMES[$i]}
85 if [ ${ZIP_NAME:0:3} = "win" ]; then
86 BINARY="$TARGET.exe"
87 else
88 BINARY="$TARGET"
89 fi
90 BINARY_NAME=${FILE_NAMES[$(($i+1))]}
91 BINARY_URL=http://repo1.maven.org/maven2/com/google/protobuf/$TARGET/${VERSION _NUMBER}/$TARGET-${VERSION_NUMBER}-${BINARY_NAME}
92 if ! wget ${BINARY_URL} -O ${DIR}/bin/$BINARY &> /dev/null; then
93 echo "[ERROR] Failed to download ${BINARY_URL}" >&2
94 echo "[ERROR] Skipped $TARGET-${VERSION_NAME}-${ZIP_NAME}" >&2
95 continue
96 fi
97 TARGET_ZIP_FILE=`pwd`/dist/$TARGET-${VERSION_NUMBER}-${ZIP_NAME}
98 pushd $DIR &> /dev/null
99 chmod +x bin/$BINARY
100 if [ "$TARGET" = "protoc" ]; then
101 zip -r ${TARGET_ZIP_FILE} include bin readme.txt &> /dev/null
102 else
103 zip -r ${TARGET_ZIP_FILE} bin &> /dev/null
104 fi
105 rm bin/$BINARY
106 popd &> /dev/null
107 echo "[INFO] Successfully created ${TARGET_ZIP_FILE}"
108 done
OLDNEW
« no previous file with comments | « third_party/protobuf/protoc-artifacts/build-protoc.sh ('k') | third_party/protobuf/protoc-artifacts/pom.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698