@@ -52,9 +52,7 @@ min_xcode_version="$(version_as_number $3)"
52
52
53
53
# Dependencies
54
54
55
- if [ -z " $KOKORO_BUILD_NUMBER " ]; then
56
- : # Local run - nothing to do.
57
- else
55
+ if [ -n " $KOKORO_BUILD_NUMBER " ]; then
58
56
# Move into our cloned repo
59
57
cd github/repo
60
58
fi
@@ -66,9 +64,7 @@ ls /Applications/ | grep "Xcode" | while read -r xcode_path; do
66
64
| grep string \
67
65
| cut -d' >' -f2 \
68
66
| cut -d' <' -f1)
69
- if [ -z " $min_xcode_version " ]; then
70
- :
71
- else
67
+ if [ -n " $min_xcode_version " ]; then
72
68
xcode_version_as_number=" $( version_as_number $xcode_version ) "
73
69
74
70
# TODO: This doesn't work yet.
@@ -77,14 +73,23 @@ ls /Applications/ | grep "Xcode" | while read -r xcode_path; do
77
73
fi
78
74
fi
79
75
80
- set +x
76
+ extra_args= " "
81
77
if [ " $action " == " build" ]; then
82
78
echo " 🏗️ $target with Xcode $xcode_version ..."
83
79
elif [ " $action " == " test" ]; then
84
80
echo " 🛠️ $target with Xcode $xcode_version ..."
81
+ extra_args=" --test_output=errors"
82
+
83
+ if [ -n " $KOKORO_BUILD_NUMBER " ]; then
84
+ sudo xcode-select --switch /Applications/$xcode_path /Contents/Developer
85
+ xcodebuild -version
86
+
87
+ # Resolves the following crash when switching Xcode versions:
88
+ # "Failed to locate a valid instance of CoreSimulatorService in the bootstrap"
89
+ launchctl remove com.apple.CoreSimulator.CoreSimulatorService || true
90
+ fi
85
91
fi
86
- set -x
87
92
88
93
bazel clean
89
- bazel $action $target --xcode_version $xcode_version
94
+ bazel $action $target --xcode_version $xcode_version $extra_args
90
95
done
0 commit comments