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

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

Issue 1322483002: Revert https://codereview.chromium.org/1291903002 (protobuf roll). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 # Helper to do build so you don't have to remember all the steps/args.
4
5
6 set -eu
7
8 # Some base locations.
9 readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
10 readonly ProtoRootDir="${ScriptDir}/../.."
11
12 printUsage() {
13 NAME=$(basename "${0}")
14 cat << EOF
15 usage: ${NAME} [OPTIONS]
16
17 This script does the common build steps needed.
18
19 OPTIONS:
20
21 General:
22
23 -h, --help
24 Show this message
25 -c, --clean
26 Issue a clean before the normal build.
27 -a, --autogen
28 Start by rerunning autogen & configure.
29 -r, --regenerate-descriptors
30 The descriptor.proto is checked in generated, cause it to regenerate.
31 -j #, --jobs #
32 Force the number of parallel jobs (useful for debugging build issues).
33 --skip-xcode
34 Skip the invoke of Xcode to test the runtime on both iOS and OS X.
35 --skip-xcode-ios
36 Skip the invoke of Xcode to test the runtime on iOS.
37 --skip-xcode-osx
38 Skip the invoke of Xcode to test the runtime on OS X.
39
40 EOF
41 }
42
43 header() {
44 echo ""
45 echo "======================================================================== "
46 echo " ${@}"
47 echo "======================================================================== "
48 }
49
50 # Thanks to libtool, builds can fail in odd ways and since it eats some output
51 # it can be hard to spot, so force error output if make exits with a non zero.
52 wrapped_make() {
53 set +e # Don't stop if the command fails.
54 make $*
55 MAKE_EXIT_STATUS=$?
56 if [ ${MAKE_EXIT_STATUS} -ne 0 ]; then
57 echo "Error: 'make $*' exited with status ${MAKE_EXIT_STATUS}"
58 exit ${MAKE_EXIT_STATUS}
59 fi
60 set -e
61 }
62
63 NUM_MAKE_JOBS=$(/usr/sbin/sysctl -n hw.ncpu)
64 if [[ "${NUM_MAKE_JOBS}" -lt 4 ]] ; then
65 NUM_MAKE_JOBS=4
66 fi
67
68 DO_AUTOGEN=no
69 DO_CLEAN=no
70 REGEN_CPP_DESCRIPTORS=no
71 DO_XCODE_IOS_TESTS=yes
72 DO_XCODE_OSX_TESTS=yes
73 while [[ $# != 0 ]]; do
74 case "${1}" in
75 -h | --help )
76 printUsage
77 exit 0
78 ;;
79 -c | --clean )
80 DO_CLEAN=yes
81 ;;
82 -a | --autogen )
83 DO_AUTOGEN=yes
84 ;;
85 -r | --regenerate-cpp-descriptors )
86 REGEN_CPP_DESCRIPTORS=yes
87 ;;
88 -j | --jobs )
89 shift
90 NUM_MAKE_JOBS="${1}"
91 ;;
92 --skip-xcode )
93 DO_XCODE_IOS_TESTS=no
94 DO_XCODE_OSX_TESTS=no
95 ;;
96 --skip-xcode-ios )
97 DO_XCODE_IOS_TESTS=no
98 ;;
99 --skip-xcode-osx )
100 DO_XCODE_OSX_TESTS=no
101 ;;
102 -*)
103 echo "ERROR: Unknown option: ${1}" 1>&2
104 printUsage
105 exit 1
106 ;;
107 *)
108 echo "ERROR: Unknown argument: ${1}" 1>&2
109 printUsage
110 exit 1
111 ;;
112 esac
113 shift
114 done
115
116 # Into the proto dir.
117 pushd "${ProtoRootDir}"
118
119 # if no Makefile, force the autogen.
120 if [[ ! -f Makefile ]] ; then
121 DO_AUTOGEN=yes
122 fi
123
124 if [[ "${DO_AUTOGEN}" == "yes" ]] ; then
125 header "Running autogen & configure"
126 ./autogen.sh
127 ./configure CXXFLAGS="-mmacosx-version-min=10.9 -Wnon-virtual-dtor -Woverloade d-virtual -Wunused-const-variable -Wunused-function"
128 fi
129
130 if [[ "${DO_CLEAN}" == "yes" ]] ; then
131 header "Cleaning"
132 wrapped_make clean
133 if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then
134 XCODEBUILD_CLEAN_BASE_IOS=(
135 xcodebuild
136 -project objectivec/ProtocolBuffers_iOS.xcodeproj
137 -scheme ProtocolBuffers
138 )
139 "${XCODEBUILD_CLEAN_BASE_IOS[@]}" -configuration Debug clean
140 "${XCODEBUILD_CLEAN_BASE_IOS[@]}" -configuration Release clean
141 fi
142 if [[ "${DO_XCODE_OSX_TESTS}" == "yes" ]] ; then
143 XCODEBUILD_CLEAN_BASE_OSX=(
144 xcodebuild
145 -project objectivec/ProtocolBuffers_OSX.xcodeproj
146 -scheme ProtocolBuffers
147 )
148 "${XCODEBUILD_CLEAN_BASE_OSX[@]}" -configuration Debug clean
149 "${XCODEBUILD_CLEAN_BASE_OSX[@]}" -configuration Release clean
150 fi
151 fi
152
153 if [[ "${REGEN_CPP_DESCRIPTORS}" == "yes" ]] ; then
154 header "Regenerating the C++ descriptor sources."
155 ./generate_descriptor_proto.sh -j "${NUM_MAKE_JOBS}"
156 fi
157
158 header "Building"
159 # Can't issue these together, when fully parallel, something sometimes chokes
160 # at random.
161 wrapped_make -j "${NUM_MAKE_JOBS}" all
162 wrapped_make -j "${NUM_MAKE_JOBS}" check
163
164 header "Ensuring the ObjC descriptors are current."
165 # Find the newest input file (protos, compiler, and the generator script).
166 # (these patterns catch some extra stuff, but better to over sample than under)
167 readonly NewestInput=$(find \
168 src/google/protobuf/*.proto \
169 src/.libs src/*.la src/protoc \
170 objectivec/generate_descriptors_proto.sh \
171 -type f -print0 \
172 | xargs -0 stat -f "%m %N" \
173 | sort -n | tail -n1 | cut -f2- -d" ")
174 # Find the oldest output file.
175 readonly OldestOutput=$(find \
176 "${ProtoRootDir}/objectivec/google" \
177 -type f -print0 \
178 | xargs -0 stat -f "%m %N" \
179 | sort -n -r | tail -n1 | cut -f2- -d" ")
180 # If the newest input is newer than the oldest output, regenerate.
181 if [[ "${NewestInput}" -nt "${OldestOutput}" ]] ; then
182 echo ">> Newest input is newer than oldest output, regenerating."
183 objectivec/generate_descriptors_proto.sh -j "${NUM_MAKE_JOBS}"
184 else
185 echo ">> Newest input is older than oldest output, no need to regenerating."
186 fi
187
188 header "Checking on the ObjC Runtime Code"
189 objectivec/DevTools/pddm_tests.py
190 if ! objectivec/DevTools/pddm.py --dry-run objectivec/*.[hm] objectivec/Tests/*. [hm] ; then
191 echo ""
192 echo "Update by running:"
193 echo " objectivec/DevTools/pddm.py objectivec/*.[hm] objectivec/Tests/*.[hm] "
194 exit 1
195 fi
196
197 if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then
198 XCODEBUILD_TEST_BASE_IOS=(
199 xcodebuild
200 -project objectivec/ProtocolBuffers_iOS.xcodeproj
201 -scheme ProtocolBuffers
202 # Don't need to worry about form factors or retina/non retina;
203 # just pick a mix of OS Versions and 32/64 bit.
204 -destination "platform=iOS Simulator,name=iPhone 4s,OS=7.1" # 32bit
205 -destination "platform=iOS Simulator,name=iPhone 6,OS=8.3" # 64bit
206 -destination "platform=iOS Simulator,name=iPad 2,OS=7.1" # 32bit
207 -destination "platform=iOS Simulator,name=iPad Air,OS=8.3" # 64bit
208 )
209 header "Doing Xcode iOS build/tests - Debug"
210 "${XCODEBUILD_TEST_BASE_IOS[@]}" -configuration Debug test
211 header "Doing Xcode iOS build/tests - Release"
212 "${XCODEBUILD_TEST_BASE_IOS[@]}" -configuration Release test
213 # Don't leave the simulator in the developer's face.
214 killall "iOS Simulator"
215 fi
216 if [[ "${DO_XCODE_OSX_TESTS}" == "yes" ]] ; then
217 XCODEBUILD_TEST_BASE_OSX=(
218 xcodebuild
219 -project objectivec/ProtocolBuffers_OSX.xcodeproj
220 -scheme ProtocolBuffers
221 # Since the ObjC 2.0 Runtime is required, 32bit OS X isn't supported.
222 -destination "platform=OS X,arch=x86_64" # 64bit
223 )
224 header "Doing Xcode OS X build/tests - Debug"
225 "${XCODEBUILD_TEST_BASE_OSX[@]}" -configuration Debug test
226 header "Doing Xcode OS X build/tests - Release"
227 "${XCODEBUILD_TEST_BASE_OSX[@]}" -configuration Release test
228 fi
OLDNEW
« no previous file with comments | « third_party/protobuf/objectivec/DevTools/compile_testing_protos.sh ('k') | third_party/protobuf/objectivec/DevTools/pddm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698