Skip to content

Commit a8efb63

Browse files
authored
Ensure Firestore emulator is shut down on build failure (#2954)
1 parent 8ed545b commit a8efb63

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

scripts/build.sh

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,10 @@ case "$product-$method-$platform" in
284284
test
285285
;;
286286

287-
Firestore-xcodebuild-iOS)
287+
Firestore-xcodebuild-*)
288288
"${firestore_emulator}" start
289+
trap '"${firestore_emulator}" stop' ERR EXIT
290+
289291
RunXcodebuild \
290292
-workspace 'Firestore/Example/Firestore.xcworkspace' \
291293
-scheme "Firestore_Tests_$platform" \
@@ -294,10 +296,10 @@ case "$product-$method-$platform" in
294296
test
295297

296298
# Firestore_SwiftTests_iOS require Swift 4, which needs Xcode 9
297-
if [[ "$xcode_major" -ge 9 ]]; then
299+
if [[ "$platform" == 'iOS' && "$xcode_major" -ge 9 ]]; then
298300
RunXcodebuild \
299301
-workspace 'Firestore/Example/Firestore.xcworkspace' \
300-
-scheme "Firestore_SwiftTests_$platform" \
302+
-scheme "Firestore_SwiftTests_iOS" \
301303
"${xcb_flags[@]}" \
302304
build \
303305
test
@@ -309,28 +311,6 @@ case "$product-$method-$platform" in
309311
"${xcb_flags[@]}" \
310312
build \
311313
test
312-
313-
"${firestore_emulator}" stop
314-
;;
315-
316-
Firestore-xcodebuild-macOS | Firestore-xcodebuild-tvOS)
317-
# TODO(wilhuff): Combine with above once all targets exist
318-
"${firestore_emulator}" start
319-
RunXcodebuild \
320-
-workspace 'Firestore/Example/Firestore.xcworkspace' \
321-
-scheme "Firestore_Tests_$platform" \
322-
"${xcb_flags[@]}" \
323-
build \
324-
test
325-
326-
RunXcodebuild \
327-
-workspace 'Firestore/Example/Firestore.xcworkspace' \
328-
-scheme "Firestore_IntegrationTests_$platform" \
329-
"${xcb_flags[@]}" \
330-
build \
331-
test
332-
333-
"${firestore_emulator}" stop
334314
;;
335315

336316
Firestore-cmake-macOS)

0 commit comments

Comments
 (0)