Skip to content
This repository was archived by the owner on Aug 4, 2022. It is now read-only.

Commit 3db5bc8

Browse files
author
Jeff Verkoeyen
committed
Merge branch 'release-candidate' into stable
2 parents bc3fcc7 + f92247d commit 3db5bc8

File tree

4 files changed

+52
-13
lines changed

4 files changed

+52
-13
lines changed

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
# 3.1.0
2+
3+
This minor release adds support for specifying a minimum Xcode version and improved support for unit
4+
test runs when using bazel.sh.
5+
6+
## New features
7+
8+
- It's now possible to specify a minimum Xcode version when running bazel commands.
9+
10+
## Source changes
11+
12+
* [Improved support for unit test runs (#7)](https://github.com/material-foundation/kokoro-ios-runner/commit/3f4c27c7af116ec72208beaffb7a11bd0366494b) (featherless)
13+
* [Add support for specifying a minimum Xcode version. (#6)](https://github.com/material-foundation/kokoro-ios-runner/commit/0f07d8f376189dcce3715dca89d00f2eb4461d0b) (featherless)
14+
115
# 3.0.0
216

3-
This major change adds support for running arbitrary bazel commands (notably test) on targets.
17+
This major release adds support for running arbitrary bazel commands (notably test) on targets.
418

519
## Breaking changes
620

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fi
1818

1919
pushd .kokoro-ios-runner
2020
git fetch
21-
git checkout v3.0.0
21+
git checkout v3.1.0
2222
popd
2323

2424
./.kokoro-ios-runner/xcodebuild.sh "MotionInterchange/MotionInterchange.xcodeproj" MotionInterchange "iPhone SE"
@@ -44,9 +44,9 @@ fi
4444

4545
pushd .kokoro-ios-runner
4646
git fetch
47-
git checkout v3.0.0
47+
git checkout v3.1.0
4848
popd
4949

50-
./.kokoro-ios-runner/bazel.sh build //:CatalogByConvention
51-
./.kokoro-ios-runner/bazel.sh test //:CatalogByConventionTests
50+
./.kokoro-ios-runner/bazel.sh build //:CatalogByConvention 8.0.0
51+
./.kokoro-ios-runner/bazel.sh test //:CatalogByConventionTests 8.0.0
5252
```

bazel.sh

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# Arguments:
2323
# 1. bazel action (build or test, usually)
2424
# 2. BUILD target.
25+
# 3. Minimum Xcode version. E.g. "8" or "8.2.1"
2526
#
2627
# Example usage:
2728
# bazel.sh build //:CatalogByConvention
@@ -33,17 +34,25 @@ set -e
3334
# Display commands to stderr.
3435
set -x
3536

36-
script_version="v3.0.0"
37+
script_version="v3.1.0"
3738
echo "bazel_build_and_test version $script_version"
3839

40+
version_as_number() {
41+
padded_version="${1%.}" # Strip any trailing dots
42+
# Pad with .0 until we get a M.m.p version string.
43+
while [ $(grep -o "\." <<< "$padded_version" | wc -l) -lt "2" ]; do
44+
padded_version=${padded_version}.0
45+
done
46+
echo "${padded_version//.}"
47+
}
48+
3949
action="$1"
4050
target="$2"
51+
min_xcode_version="$(version_as_number $3)"
4152

4253
# Dependencies
4354

44-
if [ -z "$KOKORO_BUILD_NUMBER" ]; then
45-
: # Local run - nothing to do.
46-
else
55+
if [ -n "$KOKORO_BUILD_NUMBER" ]; then
4756
# Move into our cloned repo
4857
cd github/repo
4958
fi
@@ -55,15 +64,31 @@ ls /Applications/ | grep "Xcode" | while read -r xcode_path; do
5564
| grep string \
5665
| cut -d'>' -f2 \
5766
| cut -d'<' -f1)
67+
if [ -n "$min_xcode_version" ]; then
68+
xcode_version_as_number="$(version_as_number $xcode_version)"
69+
70+
if [ "$xcode_version_as_number" -lt "$min_xcode_version" ]; then
71+
continue
72+
fi
73+
fi
5874

59-
set +x
75+
extra_args=""
6076
if [ "$action" == "build" ]; then
6177
echo "🏗️ $target with Xcode $xcode_version..."
6278
elif [ "$action" == "test" ]; then
6379
echo "🛠️ $target with Xcode $xcode_version..."
80+
extra_args="--test_output=errors"
81+
82+
if [ -n "$KOKORO_BUILD_NUMBER" ]; then
83+
sudo xcode-select --switch /Applications/$xcode_path/Contents/Developer
84+
xcodebuild -version
85+
86+
# Resolves the following crash when switching Xcode versions:
87+
# "Failed to locate a valid instance of CoreSimulatorService in the bootstrap"
88+
launchctl remove com.apple.CoreSimulator.CoreSimulatorService || true
89+
fi
6490
fi
65-
set -x
6691

6792
bazel clean
68-
bazel $action $target --xcode_version $xcode_version
93+
bazel $action $target --xcode_version $xcode_version $extra_args
6994
done

xcodebuild.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ run() {
9898
fi
9999
}
100100

101-
script_version="v3.0.0"
101+
script_version="v3.1.0"
102102
echo "build_and_test version $script_version"
103103

104104
project="$1"

0 commit comments

Comments
 (0)