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

Side by Side Diff: third_party/protobuf/objectivec/DevTools/compile_testing_protos.sh

Issue 1842653006: Update //third_party/protobuf to version 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 8 months 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 # Invoked by the Xcode projects to build the protos needed for the unittests.
4
5 set -eu
6
7 readonly OUTPUT_DIR="${PROJECT_DERIVED_FILE_DIR}/protos"
8
9 # Helper for bailing.
10 die() {
11 echo "Error: $1"
12 exit 2
13 }
14
15 # What to do.
16 case "${ACTION}" in
17 "")
18 # Build, fall thru
19 ;;
20 "clean")
21 rm -rf "${OUTPUT_DIR}"
22 exit 0
23 ;;
24 *)
25 die "Unknown action requested: ${ACTION}"
26 ;;
27 esac
28
29 # Move to the top of the protobuf directories.
30 cd "${SRCROOT}/.."
31
32 [[ -x src/protoc ]] || \
33 die "Could not find the protoc binary; make sure you have built it (objectivec /DevTools/full_mac_build.sh -h)."
34
35 RUN_PROTOC=no
36 if [[ ! -d "${OUTPUT_DIR}" ]] ; then
37 RUN_PROTOC=yes
38 else
39 # Find the newest input file (protos, compiler, and this script).
40 # (these patterns catch some extra stuff, but better to over sample than
41 # under)
42 readonly NewestInput=$(find \
43 src/google/protobuf/*.proto \
44 objectivec/Tests/*.proto \
45 src/.libs src/*.la src/protoc \
46 objectivec/DevTools/compile_testing_protos.sh \
47 -type f -print0 \
48 | xargs -0 stat -f "%m %N" \
49 | sort -n | tail -n1 | cut -f2- -d" ")
50 # Find the oldest output file.
51 readonly OldestOutput=$(find \
52 "${OUTPUT_DIR}" \
53 -type f -print0 \
54 | xargs -0 stat -f "%m %N" \
55 | sort -n -r | tail -n1 | cut -f2- -d" ")
56 # If the newest input is newer than the oldest output, regenerate.
57 if [[ "${NewestInput}" -nt "${OldestOutput}" ]] ; then
58 RUN_PROTOC=yes
59 fi
60 fi
61
62 if [[ "${RUN_PROTOC}" != "yes" ]] ; then
63 # Up to date.
64 exit 0
65 fi
66
67 # Ensure the output dir exists
68 mkdir -p "${OUTPUT_DIR}/google/protobuf"
69
70 CORE_PROTO_FILES=( \
71 src/google/protobuf/unittest_arena.proto \
72 src/google/protobuf/unittest_custom_options.proto \
73 src/google/protobuf/unittest_enormous_descriptor.proto \
74 src/google/protobuf/unittest_embed_optimize_for.proto \
75 src/google/protobuf/unittest_empty.proto \
76 src/google/protobuf/unittest_import.proto \
77 src/google/protobuf/unittest_import_lite.proto \
78 src/google/protobuf/unittest_lite.proto \
79 src/google/protobuf/unittest_mset.proto \
80 src/google/protobuf/unittest_mset_wire_format.proto \
81 src/google/protobuf/unittest_no_arena.proto \
82 src/google/protobuf/unittest_no_arena_import.proto \
83 src/google/protobuf/unittest_no_generic_services.proto \
84 src/google/protobuf/unittest_optimize_for.proto \
85 src/google/protobuf/unittest.proto \
86 src/google/protobuf/unittest_import_public.proto \
87 src/google/protobuf/unittest_import_public_lite.proto \
88 src/google/protobuf/unittest_drop_unknown_fields.proto \
89 src/google/protobuf/unittest_preserve_unknown_enum.proto \
90 src/google/protobuf/map_lite_unittest.proto \
91 src/google/protobuf/map_proto2_unittest.proto \
92 src/google/protobuf/map_unittest.proto \
93 )
94
95 compile_proto() {
96 src/protoc \
97 --objc_out="${OUTPUT_DIR}/google/protobuf" \
98 --proto_path=src/google/protobuf/ \
99 --proto_path=src \
100 $*
101 }
102
103 for a_proto in "${CORE_PROTO_FILES[@]}" ; do
104 compile_proto "${a_proto}"
105 done
106
107 OBJC_PROTO_FILES=( \
108 objectivec/Tests/unittest_cycle.proto \
109 objectivec/Tests/unittest_runtime_proto2.proto \
110 objectivec/Tests/unittest_runtime_proto3.proto \
111 objectivec/Tests/unittest_objc.proto \
112 objectivec/Tests/unittest_objc_startup.proto \
113 )
114
115 for a_proto in "${OBJC_PROTO_FILES[@]}" ; do
116 compile_proto --proto_path="objectivec/Tests" "${a_proto}"
117 done
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698