From 25b6a4a6e03447e1dab123a843a9301dbbd53fba Mon Sep 17 00:00:00 2001 From: Jeff Verkoeyen Date: Thu, 5 Apr 2018 22:10:46 -0400 Subject: [PATCH 1/4] Add support for running a specific xcode version. --- bazel.sh | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/bazel.sh b/bazel.sh index adcbf44..0747767 100755 --- a/bazel.sh +++ b/bazel.sh @@ -27,9 +27,13 @@ # -m|--min-xcode-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 : 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: @@ -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 @@ -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 From 128883ea0648ae06e060979fe27a3aa51993c5ea Mon Sep 17 00:00:00 2001 From: Jeff Verkoeyen Date: Thu, 5 Apr 2018 23:06:58 -0400 Subject: [PATCH 2/4] Automatic changelog preparation for release. --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc1a32f..669678c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# #develop# + + TODO: Enumerate changes. + + # 4.2.2 Bazel builds now ignore duplicate installations of Xcode. From 9fc96a614dfa8c706b850c5d2b8e29241a0105cf Mon Sep 17 00:00:00 2001 From: Jeff Verkoeyen Date: Thu, 5 Apr 2018 23:07:44 -0400 Subject: [PATCH 3/4] Update changelog. --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 669678c..39eeb68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ -# #develop# +# 4.3.0 - TODO: Enumerate changes. +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 From 7433981135e74dc615997a66fcc08fa0ecfd07cc Mon Sep 17 00:00:00 2001 From: Jeff Verkoeyen Date: Thu, 5 Apr 2018 23:07:52 -0400 Subject: [PATCH 4/4] Bump the release. --- README.md | 4 ++-- bazel.sh | 2 +- xcodebuild.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a3140cb..c36a86b 100644 --- a/README.md +++ b/README.md @@ -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" @@ -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 diff --git a/bazel.sh b/bazel.sh index 0747767..1892690 100755 --- a/bazel.sh +++ b/bazel.sh @@ -43,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() { diff --git a/xcodebuild.sh b/xcodebuild.sh index 65f73f1..dde3a25 100755 --- a/xcodebuild.sh +++ b/xcodebuild.sh @@ -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"