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

Commit

Permalink
Merge branch 'release-candidate' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Verkoeyen committed Apr 6, 2018
2 parents f4d62fa + 7433981 commit e1516d0
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 12 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 4.3.0

Add support for running bazel against a specific Xcode version.

## Source changes

* [Add support for running a specific xcode version.](https://github.com/material-foundation/kokoro-ios-runner/commit/25b6a4a6e03447e1dab123a843a9301dbbd53fba) (Jeff Verkoeyen)


# 4.2.2

Bazel builds now ignore duplicate installations of Xcode.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fi

pushd .kokoro-ios-runner
git fetch
git checkout v4.2.2
git checkout v4.3.0
popd

./.kokoro-ios-runner/xcodebuild.sh "MotionInterchange/MotionInterchange.xcodeproj" MotionInterchange "iPhone SE"
Expand All @@ -44,7 +44,7 @@ fi

pushd .kokoro-ios-runner
git fetch
git checkout v4.2.2
git checkout v4.3.0
popd

./.kokoro-ios-runner/bazel.sh test //:CatalogByConventionTests --min-xcode-version 8.0.0
Expand Down
32 changes: 23 additions & 9 deletions bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@
# -m|--min-xcode-version <version>: Every Xcode version equal to or greater than this value will
# build and run tests. E.g. "8.2.1" will run 8.2.1, 8.3.3, 9,
# etc...
# -s|--xcode-version <version>: Only build and test with this specific Xcode version.
# -v|--verbose: Generates verbose output on local runs.
# Does not affect kokoro runs.
#
# Only one of -m or -s should be provided. If both are provided, -s will take precedence. If neither
# are provided, then all Xcode versions will be built and tested against.
#
# Any unrecognized arguments will be passed along to the bazel invocation.
#
# Example usage:
Expand All @@ -39,7 +43,7 @@
# Fail on any error.
set -e

script_version="v4.2.2"
script_version="v4.3.0"
echo "$(basename $0) version $script_version"

version_as_number() {
Expand All @@ -61,6 +65,11 @@ while [[ $# -gt 0 ]]; do
shift
shift
;;
-s|--xcode-version)
SPECIFIC_XCODE_VERSION="$(version_as_number $2)"
shift
shift
;;
-v|--verbose)
VERBOSE_OUTPUT="1"
shift
Expand Down Expand Up @@ -111,25 +120,30 @@ if [ -n "$KOKORO_BUILD_NUMBER" ]; then
# Runs our tests on every available Xcode installation.
BUILDS_TMP_PATH=$(mktemp -d)
SEEN_XCODES_FILE_PATH="$BUILDS_TMP_PATH/seen_xcodes"
touch "$SEEN_XCODES_FILE_PATH"
ls /Applications/ | grep "Xcode" | while read -r xcode_path; do
xcode_version=$(cat /Applications/$xcode_path/Contents/version.plist \
| grep "CFBundleShortVersionString" -A1 \
| grep string \
| cut -d'>' -f2 \
| cut -d'<' -f1)
if [ -n "$MIN_XCODE_VERSION" ]; then
xcode_version_as_number="$(version_as_number $xcode_version)"
xcode_version_as_number="$(version_as_number $xcode_version)"

if [ "$xcode_version_as_number" -lt "$MIN_XCODE_VERSION" ]; then
# Ignore duplicate Xcode installations
if grep -xq "$xcode_version_as_number" "$SEEN_XCODES_FILE_PATH"; then
continue
fi

echo "$xcode_version_as_number" >> "$SEEN_XCODES_FILE_PATH"

if [ -n "$SPECIFIC_XCODE_VERSION" ]; then
if [ "$xcode_version_as_number" -ne "$SPECIFIC_XCODE_VERSION" ]; then
continue
fi

# Ignore duplicate Xcode installations
if grep -xq "$xcode_version_as_number" "$SEEN_XCODES_FILE_PATH"; then
elif [ -n "$MIN_XCODE_VERSION" ]; then
if [ "$xcode_version_as_number" -lt "$MIN_XCODE_VERSION" ]; then
continue
fi

echo "$xcode_version_as_number" > "$SEEN_XCODES_FILE_PATH"
fi

if [ "$ACTION" == "test" ]; then
Expand Down
2 changes: 1 addition & 1 deletion xcodebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ run() {
fi
}

script_version="v4.2.2"
script_version="v4.3.0"
echo "build_and_test version $script_version"

project="$1"
Expand Down

0 comments on commit e1516d0

Please sign in to comment.