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

Commit

Permalink
Update bazel workspace to latest versions. (#120)
Browse files Browse the repository at this point in the history
This increases the following versions:

- bazel from 0.11 to 0.20.0
- build_bazel_rules_apple from 7ea0557 to 0.9.0
- build_bazel_rules_swift to 0.4.0 (new)
- bazel_ios_warnings from v1.0.1 to v2.0.0
- Xcode from 8 to 9.
- Swift pinned to 3.
- Unit test upgraded to UI tests.
- MotionInterchange from v1.6.0 to v2.0.0
- Migrate from the bazel runner scripts to the explicit Xcode selection + run pattern used by material-components-ios (https://github.com/material-components/material-components-ios/blob/fe0099d65c4fa67a02d7b842baf16b540bb2fa86/.kokoro#L102)

Tested by running:

    ./.kokoro
  • Loading branch information
jverkoey committed Dec 7, 2018
1 parent c805783 commit e28f79e
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 106 deletions.
87 changes: 39 additions & 48 deletions .kokoro
Expand Up @@ -20,53 +20,44 @@ set -e
# Display commands to stderr.
set -x

KOKORO_RUNNER_VERSION="v4.*"

POSITIONAL=()
while [[ $# -gt 0 ]]; do
key="$1"

case $key in
-v|--verbose)
VERBOSE_OUTPUT="1"
shift
;;
*)
POSITIONAL+=("$1")
shift
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters

if [ -n "$KOKORO_BUILD_NUMBER" ]; then
# Always enable verbose output on kokoro runs.
VERBOSE_OUTPUT=1
fi

if [ -n "$VERBOSE_OUTPUT" ]; then
# Display commands to stderr.
set -x
verbosity_args="-v"
fi

if [ ! -d .kokoro-ios-runner ]; then
git clone https://github.com/material-foundation/kokoro-ios-runner.git .kokoro-ios-runner
fi

pushd .kokoro-ios-runner
git fetch > /dev/null
# https://stackoverflow.com/questions/21394536/how-to-simulate-sort-v-on-mac-osx
TAG=$(git tag --sort=v:refname -l "$KOKORO_RUNNER_VERSION" | tail -n1)
git checkout "$TAG" > /dev/null
popd

if [ -n "$KOKORO_BUILD_NUMBER" ]; then
bazel version
use_bazel.sh latest
bazel version
fi

./.kokoro-ios-runner/bazel.sh test //:UnitTests --min-xcode-version 8.1.0 $verbosity_args
BAZEL_VERSION="0.20.0"
IOS_MINIMUM_OS="8.0"
IOS_CPUS="i386,x86_64"

get_xcode_version_from_path() {
path="$1"
cat "$path/version.plist" \
| grep "CFBundleShortVersionString" -A1 \
| grep string \
| cut -d'>' -f2 \
| cut -d'<' -f1
}

run_bazel() {
echo "Running bazel builds..."

if [ -n "$KOKORO_BUILD_NUMBER" ]; then
bazel version
use_bazel.sh "$BAZEL_VERSION"
bazel version

# Move into our cloned repo
cd github/repo
fi

# Run against whichever Xcode is currently selected.
selected_xcode_developer_path=$(xcode-select -p)
selected_xcode_contents_path=$(dirname "$selected_xcode_developer_path")

xcode_version=$(get_xcode_version_from_path "$selected_xcode_contents_path")

bazel clean
bazel test //... \
--xcode_version "$xcode_version" \
--ios_minimum_os="$IOS_MINIMUM_OS" \
--ios_multi_cpus="$IOS_CPUS"
}

run_bazel

echo "Success!"
8 changes: 5 additions & 3 deletions BUILD
Expand Up @@ -15,9 +15,9 @@
# Description:
# A Motion Animator creates performant, interruptible animations from motion specs.

load("@build_bazel_rules_apple//apple:ios.bzl", "ios_ui_test")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
load("@bazel_ios_warnings//:strict_warnings_objc_library.bzl", "strict_warnings_objc_library")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
load("@build_bazel_rules_apple//apple:swift.bzl", "swift_library")

licenses(["notice"]) # Apache 2.0

Expand Down Expand Up @@ -70,12 +70,14 @@ objc_library(
visibility = ["//visibility:private"],
)

ios_unit_test(
ios_ui_test(
name = "UnitTests",
deps = [
":UnitTestsLib",
":UnitTestsSwiftLib"
],
test_host = "@build_bazel_rules_apple//apple/testing/default_host/ios",
minimum_os_version = "8.0",
timeout = "short",
visibility = ["//visibility:private"],
)
2 changes: 1 addition & 1 deletion MotionAnimator.podspec
Expand Up @@ -12,5 +12,5 @@ Pod::Spec.new do |s|
s.public_header_files = "src/*.h"
s.source_files = "src/*.{h,m,mm}", "src/private/*.{h,m,mm}"

s.dependency "MotionInterchange", "~> 1.6"
s.dependency "MotionInterchange", "~> 2.0"
end
21 changes: 13 additions & 8 deletions Podfile.lock
@@ -1,22 +1,27 @@
PODS:
- CatalogByConvention (2.4.1)
- CatalogByConvention (2.5.1)
- MotionAnimator (2.8.1):
- MotionInterchange (~> 1.6)
- MotionInterchange (1.6.0)
- MotionInterchange (~> 2.0)
- MotionInterchange (2.0.0)

DEPENDENCIES:
- CatalogByConvention
- MotionAnimator (from `./`)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
- CatalogByConvention
- MotionInterchange

EXTERNAL SOURCES:
MotionAnimator:
:path: ./
:path: "./"

SPEC CHECKSUMS:
CatalogByConvention: 16cd56d7e75b816e4eda0d62f9c5f0c82da8baff
MotionAnimator: 07399ec033ab44256276d71037402413922fbb89
MotionInterchange: ead0e3ae1f3a5fb539e289debbc7ae036160a10d
CatalogByConvention: 2b58a9b64e5b1049abb5d3f8e764a551bbe843a7
MotionAnimator: ab78e3a6eb59f1061c2c00dd09dc923f254f4a61
MotionInterchange: 5b7325142e4af884278bab7adcd264976a8c0593

PODFILE CHECKSUM: 3537bf01c11174928ac008c20fec4738722e96f3

COCOAPODS: 1.4.0
COCOAPODS: 1.5.3
43 changes: 29 additions & 14 deletions WORKSPACE
Expand Up @@ -12,34 +12,49 @@
# See the License for the specific language governing permissions and
# limitations under the License.

http_archive(
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")

git_repository(
name = "build_bazel_rules_apple",
url = "https://github.com/bazelbuild/rules_apple/archive/0.3.0.zip",
strip_prefix = "rules_apple-0.3.0",
# Generated by running: openssl sha -sha256 <path to zip>
sha256 = "0c2f7b903c2334a3e7e0b565f0f80a854047ac36202978318f853cb762bf33f3"
remote = "https://github.com/bazelbuild/rules_apple.git",
tag = "0.9.0",
)

load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)

apple_rules_dependencies()

git_repository(
name = "bazel_skylib",
remote = "https://github.com/bazelbuild/bazel-skylib.git",
tag = "0.2.0",
name = "build_bazel_rules_swift",
remote = "https://github.com/bazelbuild/rules_swift.git",
tag = "0.4.0",
)

http_file(
name = "xctestrunner",
executable = 1,
url = "https://github.com/google/xctestrunner/releases/download/0.2.1/ios_test_runner.par",
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)

swift_rules_dependencies()

git_repository(
name = "bazel_ios_warnings",
remote = "https://github.com/material-foundation/bazel_ios_warnings.git",
tag = "v1.0.1",
tag = "v2.0.0",
)

git_repository(
name = "motion_interchange_objc",
remote = "https://github.com/material-motion/motion-interchange-objc.git",
tag = "v1.6.0",
commit = "v2.0.0",
)

http_file(
name = "xctestrunner",
executable = 1,
urls = ["https://github.com/google/xctestrunner/releases/download/0.2.5/ios_test_runner.par"],
)
Expand Up @@ -280,7 +280,6 @@
666FAA7E1D384A6B000363DA /* Resources */,
46589CD14086D52DE668B341 /* Frameworks */,
ADB887B84C3967A0391C7DFD /* [CP] Embed Pods Frameworks */,
3BBBD44AA3DB97C7EC0790DE /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -300,7 +299,6 @@
666FAA921D384A6B000363DA /* Resources */,
B21725FF37D7BCD809C7A6E1 /* Frameworks */,
1457D44967464C8E3A8E97E8 /* [CP] Embed Pods Frameworks */,
5C96FE89C18D5F2BCCB526AD /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -424,21 +422,6 @@
shellScript = "\"${SRCROOT}/../../../Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
3BBBD44AA3DB97C7EC0790DE /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/../../../Pods/Target Support Files/Pods-MotionAnimatorCatalog/Pods-MotionAnimatorCatalog-resources.sh\"\n";
showEnvVarsInLog = 0;
};
5A3F2ED10BF3C472BA1601C5 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -457,21 +440,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
5C96FE89C18D5F2BCCB526AD /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/../../../Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
ADB887B84C3967A0391C7DFD /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down

0 comments on commit e28f79e

Please sign in to comment.