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

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

Issue 2590803003: Revert "third_party/protobuf: Update to HEAD (83d681ee2c)" (Closed)
Patch Set: Created 3 years, 12 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
1 #!/bin/bash -eu 1 #!/bin/bash
2
2 # Invoked by the Xcode projects to build the protos needed for the unittests. 3 # Invoked by the Xcode projects to build the protos needed for the unittests.
3 4
5 set -eu
6
4 readonly OUTPUT_DIR="${PROJECT_DERIVED_FILE_DIR}/protos" 7 readonly OUTPUT_DIR="${PROJECT_DERIVED_FILE_DIR}/protos"
5 8
6 # -----------------------------------------------------------------------------
7 # Helper for bailing. 9 # Helper for bailing.
8 die() { 10 die() {
9 echo "Error: $1" 11 echo "Error: $1"
10 exit 2 12 exit 2
11 } 13 }
12 14
13 # -----------------------------------------------------------------------------
14 # What to do. 15 # What to do.
15 case "${ACTION}" in 16 case "${ACTION}" in
16 "") 17 "")
17 # Build, fall thru 18 # Build, fall thru
18 ;; 19 ;;
19 "clean") 20 "clean")
20 rm -rf "${OUTPUT_DIR}" 21 rm -rf "${OUTPUT_DIR}"
21 exit 0 22 exit 0
22 ;; 23 ;;
23 *) 24 *)
24 die "Unknown action requested: ${ACTION}" 25 die "Unknown action requested: ${ACTION}"
25 ;; 26 ;;
26 esac 27 esac
27 28
28 # ----------------------------------------------------------------------------- 29 # Move to the top of the protobuf directories.
29 # Ensure the output dir exists 30 cd "${SRCROOT}/.."
30 mkdir -p "${OUTPUT_DIR}/google/protobuf"
31 31
32 # -----------------------------------------------------------------------------
33 # Move to the top of the protobuf directories and ensure there is a protoc
34 # binary to use.
35 cd "${SRCROOT}/.."
36 [[ -x src/protoc ]] || \ 32 [[ -x src/protoc ]] || \
37 die "Could not find the protoc binary; make sure you have built it (objectivec /DevTools/full_mac_build.sh -h)." 33 die "Could not find the protoc binary; make sure you have built it (objectivec /DevTools/full_mac_build.sh -h)."
38 34
39 # -----------------------------------------------------------------------------
40 # See the compiler or proto files have changed.
41 RUN_PROTOC=no 35 RUN_PROTOC=no
42 if [[ ! -d "${OUTPUT_DIR}" ]] ; then 36 if [[ ! -d "${OUTPUT_DIR}" ]] ; then
43 RUN_PROTOC=yes 37 RUN_PROTOC=yes
44 else 38 else
45 # Find the newest input file (protos, compiler, and this script). 39 # Find the newest input file (protos, compiler, and this script).
46 # (these patterns catch some extra stuff, but better to over sample than 40 # (these patterns catch some extra stuff, but better to over sample than
47 # under) 41 # under)
48 readonly NewestInput=$(find \ 42 readonly NewestInput=$(find \
49 src/google/protobuf/*.proto \ 43 src/google/protobuf/*.proto \
50 objectivec/Tests/*.proto \ 44 objectivec/Tests/*.proto \
51 src/.libs src/*.la src/protoc \ 45 src/.libs src/*.la src/protoc \
52 objectivec/DevTools/compile_testing_protos.sh \ 46 objectivec/DevTools/compile_testing_protos.sh \
53 -type f -print0 \ 47 -type f -print0 \
54 | xargs -0 stat -f "%m %N" \ 48 | xargs -0 stat -f "%m %N" \
55 | sort -n | tail -n1 | cut -f2- -d" ") 49 | sort -n | tail -n1 | cut -f2- -d" ")
56 # Find the oldest output file. 50 # Find the oldest output file.
57 readonly OldestOutput=$(find \ 51 readonly OldestOutput=$(find \
58 "${OUTPUT_DIR}" \ 52 "${OUTPUT_DIR}" \
59 -type f -name "*pbobjc.[hm]" -print0 \ 53 -type f -print0 \
60 | xargs -0 stat -f "%m %N" \ 54 | xargs -0 stat -f "%m %N" \
61 | sort -n -r | tail -n1 | cut -f2- -d" ") 55 | sort -n -r | tail -n1 | cut -f2- -d" ")
62 # If the newest input is newer than the oldest output, regenerate. 56 # If the newest input is newer than the oldest output, regenerate.
63 if [[ "${NewestInput}" -nt "${OldestOutput}" ]] ; then 57 if [[ "${NewestInput}" -nt "${OldestOutput}" ]] ; then
64 RUN_PROTOC=yes 58 RUN_PROTOC=yes
65 fi 59 fi
66 fi 60 fi
67 61
68 if [[ "${RUN_PROTOC}" != "yes" ]] ; then 62 if [[ "${RUN_PROTOC}" != "yes" ]] ; then
69 # Up to date. 63 # Up to date.
70 exit 0 64 exit 0
71 fi 65 fi
72 66
73 # ----------------------------------------------------------------------------- 67 # Ensure the output dir exists
74 # Prune out all the files from previous generations to ensure we only have 68 mkdir -p "${OUTPUT_DIR}/google/protobuf"
75 # current ones.
76 find "${OUTPUT_DIR}" \
77 -type f -name "*pbobjc.[hm]" -print0 \
78 | xargs -0 rm -rf
79
80 # -----------------------------------------------------------------------------
81 # Helper to invoke protoc
82 compile_protos() {
83 src/protoc \
84 --objc_out="${OUTPUT_DIR}/google/protobuf" \
85 --proto_path=src/google/protobuf/ \
86 --proto_path=src \
87 "$@"
88 }
89
90 # -----------------------------------------------------------------------------
91 # Generate most of the proto files that exist in the C++ src tree. Several
92 # are used in the tests, but the extra don't hurt in that they ensure ObjC
93 # sources can be generated from them.
94 69
95 CORE_PROTO_FILES=( 70 CORE_PROTO_FILES=(
96 src/google/protobuf/any_test.proto
97 src/google/protobuf/unittest_arena.proto 71 src/google/protobuf/unittest_arena.proto
98 src/google/protobuf/unittest_custom_options.proto 72 src/google/protobuf/unittest_custom_options.proto
99 src/google/protobuf/unittest_enormous_descriptor.proto 73 src/google/protobuf/unittest_enormous_descriptor.proto
100 src/google/protobuf/unittest_embed_optimize_for.proto 74 src/google/protobuf/unittest_embed_optimize_for.proto
101 src/google/protobuf/unittest_empty.proto 75 src/google/protobuf/unittest_empty.proto
102 src/google/protobuf/unittest_import.proto 76 src/google/protobuf/unittest_import.proto
103 src/google/protobuf/unittest_import_lite.proto 77 src/google/protobuf/unittest_import_lite.proto
104 src/google/protobuf/unittest_lite.proto 78 src/google/protobuf/unittest_lite.proto
105 src/google/protobuf/unittest_mset.proto 79 src/google/protobuf/unittest_mset.proto
106 src/google/protobuf/unittest_mset_wire_format.proto 80 src/google/protobuf/unittest_mset_wire_format.proto
107 src/google/protobuf/unittest_no_arena.proto 81 src/google/protobuf/unittest_no_arena.proto
108 src/google/protobuf/unittest_no_arena_import.proto 82 src/google/protobuf/unittest_no_arena_import.proto
109 src/google/protobuf/unittest_no_generic_services.proto 83 src/google/protobuf/unittest_no_generic_services.proto
110 src/google/protobuf/unittest_optimize_for.proto 84 src/google/protobuf/unittest_optimize_for.proto
111 src/google/protobuf/unittest.proto 85 src/google/protobuf/unittest.proto
112 src/google/protobuf/unittest_import_public.proto 86 src/google/protobuf/unittest_import_public.proto
113 src/google/protobuf/unittest_import_public_lite.proto 87 src/google/protobuf/unittest_import_public_lite.proto
114 src/google/protobuf/unittest_drop_unknown_fields.proto 88 src/google/protobuf/unittest_drop_unknown_fields.proto
115 src/google/protobuf/unittest_preserve_unknown_enum.proto 89 src/google/protobuf/unittest_preserve_unknown_enum.proto
116 src/google/protobuf/map_lite_unittest.proto 90 src/google/protobuf/map_lite_unittest.proto
117 src/google/protobuf/map_proto2_unittest.proto 91 src/google/protobuf/map_proto2_unittest.proto
118 src/google/protobuf/map_unittest.proto 92 src/google/protobuf/map_unittest.proto
119 # The unittest_custom_options.proto extends the messages in descriptor.proto 93 )
120 # so we build it in to test extending in general. The library doesn't provide 94
121 # a descriptor as it doesn't use the classes/enums. 95 # The unittest_custom_options.proto extends the messages in descriptor.proto
96 # so we build it in to test extending in general. The library doesn't provide
97 # a descriptor as it doesn't use the classes/enums.
98 CORE_PROTO_FILES+=(
122 src/google/protobuf/descriptor.proto 99 src/google/protobuf/descriptor.proto
123 ) 100 )
124 101
125 # Note: there is overlap in package.Message names between some of the test 102 compile_proto() {
126 # files, so they can't be generated all at once. This works because the overlap 103 src/protoc \
127 # isn't linked into a single binary. 104 --objc_out="${OUTPUT_DIR}/google/protobuf" \
105 --proto_path=src/google/protobuf/ \
106 --proto_path=src \
107 $*
108 }
109
128 for a_proto in "${CORE_PROTO_FILES[@]}" ; do 110 for a_proto in "${CORE_PROTO_FILES[@]}" ; do
129 compile_protos "${a_proto}" 111 compile_proto "${a_proto}"
130 done 112 done
131 113
132 # ----------------------------------------------------------------------------- 114 OBJC_PROTO_FILES=(
133 # Generate the Objective C specific testing protos. 115 objectivec/Tests/unittest_cycle.proto
134 compile_protos \ 116 objectivec/Tests/unittest_runtime_proto2.proto
135 --proto_path="objectivec/Tests" \ 117 objectivec/Tests/unittest_runtime_proto3.proto
136 objectivec/Tests/unittest_cycle.proto \ 118 objectivec/Tests/unittest_objc.proto
137 objectivec/Tests/unittest_deprecated.proto \
138 objectivec/Tests/unittest_deprecated_file.proto \
139 objectivec/Tests/unittest_extension_chain_a.proto \
140 objectivec/Tests/unittest_extension_chain_b.proto \
141 objectivec/Tests/unittest_extension_chain_c.proto \
142 objectivec/Tests/unittest_extension_chain_d.proto \
143 objectivec/Tests/unittest_extension_chain_e.proto \
144 objectivec/Tests/unittest_extension_chain_f.proto \
145 objectivec/Tests/unittest_extension_chain_g.proto \
146 objectivec/Tests/unittest_runtime_proto2.proto \
147 objectivec/Tests/unittest_runtime_proto3.proto \
148 objectivec/Tests/unittest_objc.proto \
149 objectivec/Tests/unittest_objc_startup.proto 119 objectivec/Tests/unittest_objc_startup.proto
120 )
121
122 for a_proto in "${OBJC_PROTO_FILES[@]}" ; do
123 compile_proto --proto_path="objectivec/Tests" "${a_proto}"
124 done
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698