diff --git a/.jazzy.yaml b/.jazzy.yaml index a3243f5..c77e723 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -1,7 +1,7 @@ module: MotionAnimator -module_version: 2.8.1 +module_version: 3.0.0 sdk: iphonesimulator umbrella_header: src/MotionAnimator.h objc: true github_url: https://github.com/material-motion/motion-animator-objc -github_file_prefix: https://github.com/material-motion/motion-animator-objc/tree/v2.8.1 +github_file_prefix: https://github.com/material-motion/motion-animator-objc/tree/v3.0.0 diff --git a/.kokoro b/.kokoro index cda1d70..76149df 100755 --- a/.kokoro +++ b/.kokoro @@ -20,47 +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 - -./.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!" diff --git a/.travis.yml b/.travis.yml index 35095c9..4e49237 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: objective-c -osx_image: xcode9.2 sudo: false env: global: diff --git a/BUILD b/BUILD index 1d7ad95..77a8368 100644 --- a/BUILD +++ b/BUILD @@ -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 @@ -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"], ) diff --git a/CHANGELOG.md b/CHANGELOG.md index f61a8fb..0779adf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +# 3.0.0 + +This major release upgrades the bazel dependencies and workspace. This change is breaking for anyone +using bazel to build this library. In order to use this library with bazel, you will also need to +upgrade your workspace versions to match the ones now used in this library's `WORKSPACE` file. + +## Source changes + +* [Make tests more robust to crashing failures. (#118)](https://github.com/material-motion/motion-animator-objc/commit/d2f5971a554d2e63b74a3ad7d36cd9b7ed7823ca) (featherless) + +## Non-source changes + +* [Automatic changelog preparation for release.](https://github.com/material-motion/motion-animator-objc/commit/2f7d3af5fd9cf6bdcb88e0b955e7ceb903dc9b22) (Jeff Verkoeyen) +* [Update bazel workspace to latest versions. (#120)](https://github.com/material-motion/motion-animator-objc/commit/e28f79e51bbfa7a41d7c9941e7a0ba7beaaa05ff) (featherless) +* [Don't animate system views with the animator. (#119)](https://github.com/material-motion/motion-animator-objc/commit/c8057832a9f961585978d59a7ea03e8f641d8ae6) (featherless) +* [Update .travis.yml](https://github.com/material-motion/motion-animator-objc/commit/e839e817c80aa8df34faacf7fe95d6fb1d508643) (featherless) +* [Update .kokoro](https://github.com/material-motion/motion-animator-objc/commit/4eed01c25d7fd84fe9e48f147f195987ebbf26e9) (featherless) +* [Update .kokoro](https://github.com/material-motion/motion-animator-objc/commit/55dd1b14f243418bf4d4fe4ea0eb0a6bcfbb88de) (featherless) +* [Update bazel workspace and version to latest. (#117)](https://github.com/material-motion/motion-animator-objc/commit/b8261f30f3437c75e8bc1b9f25c074304acc43b5) (featherless) + # 2.8.1 This patch release resolves some runtime crashes, improves the stability of our unit tests, and features an improved README.md. diff --git a/MotionAnimator.podspec b/MotionAnimator.podspec index cdaad98..1ada9f6 100644 --- a/MotionAnimator.podspec +++ b/MotionAnimator.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "MotionAnimator" s.summary = "A Motion Animator creates performant, interruptible animations from motion specs." - s.version = "2.8.1" + s.version = "3.0.0" s.authors = "The Material Motion Authors" s.license = "Apache 2.0" s.homepage = "https://github.com/material-motion/motion-animator-objc" @@ -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 diff --git a/Podfile.lock b/Podfile.lock index 393c140..bac1b7c 100644 --- a/Podfile.lock +++ b/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 diff --git a/WORKSPACE b/WORKSPACE index a57711a..0f75bae 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -12,20 +12,49 @@ # See the License for the specific language governing permissions and # limitations under the License. +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", remote = "https://github.com/bazelbuild/rules_apple.git", - commit = "7ea0557", + tag = "0.9.0", +) + +load( + "@build_bazel_rules_apple//apple:repositories.bzl", + "apple_rules_dependencies", +) + +apple_rules_dependencies() + +git_repository( + name = "build_bazel_rules_swift", + remote = "https://github.com/bazelbuild/rules_swift.git", + tag = "0.4.0", +) + +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"], ) diff --git a/examples/CalendarCardExpansionExample.m b/examples/CalendarCardExpansionExample.m index 3648e49..ae9edd8 100644 --- a/examples/CalendarCardExpansionExample.m +++ b/examples/CalendarCardExpansionExample.m @@ -48,9 +48,7 @@ - (void)didTap { animator.shouldReverseValues = !_expanded; animator.beginFromCurrentState = YES; - [animator animateWithTraits:traits.navigationBarY animations:^{ - [self.navigationController setNavigationBarHidden:_expanded animated:YES]; - }]; + [self.navigationController setNavigationBarHidden:_expanded animated:YES]; CGRect chipFrame = [self frameForChip]; CGRect headerFrame = [self frameForHeader]; diff --git a/examples/CalendarChipMotionSpec.h b/examples/CalendarChipMotionSpec.h index d7989f2..21a9d21 100644 --- a/examples/CalendarChipMotionSpec.h +++ b/examples/CalendarChipMotionSpec.h @@ -26,8 +26,6 @@ @property(nonatomic, strong, nonnull, readonly) MDMAnimationTraits *chipContentOpacity; @property(nonatomic, strong, nonnull, readonly) MDMAnimationTraits *headerContentOpacity; -@property(nonatomic, strong, nonnull, readonly) MDMAnimationTraits *navigationBarY; - @end @interface CalendarChipMotionSpec: NSObject diff --git a/examples/CalendarChipMotionSpec.m b/examples/CalendarChipMotionSpec.m index 51bffc3..567e9ea 100644 --- a/examples/CalendarChipMotionSpec.m +++ b/examples/CalendarChipMotionSpec.m @@ -80,10 +80,6 @@ - (MDMAnimationTraits *)headerContentOpacity { return [[MDMAnimationTraits alloc] initWithDelay:0.000 duration:0.075 timingCurve:LinearTimingCurve()]; } -- (MDMAnimationTraits *)navigationBarY { - return [[MDMAnimationTraits alloc] initWithDelay:0.045 duration:0.150 timingCurve:StandardTimingCurve()]; -} - @end @implementation CalendarChipMotionSpec diff --git a/examples/apps/Catalog/MotionAnimatorCatalog.xcodeproj/project.pbxproj b/examples/apps/Catalog/MotionAnimatorCatalog.xcodeproj/project.pbxproj index f5e5a1f..7b0732d 100644 --- a/examples/apps/Catalog/MotionAnimatorCatalog.xcodeproj/project.pbxproj +++ b/examples/apps/Catalog/MotionAnimatorCatalog.xcodeproj/project.pbxproj @@ -280,7 +280,6 @@ 666FAA7E1D384A6B000363DA /* Resources */, 46589CD14086D52DE668B341 /* Frameworks */, ADB887B84C3967A0391C7DFD /* [CP] Embed Pods Frameworks */, - 3BBBD44AA3DB97C7EC0790DE /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -300,7 +299,6 @@ 666FAA921D384A6B000363DA /* Resources */, B21725FF37D7BCD809C7A6E1 /* Frameworks */, 1457D44967464C8E3A8E97E8 /* [CP] Embed Pods Frameworks */, - 5C96FE89C18D5F2BCCB526AD /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -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; @@ -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; diff --git a/tests/unit/BeginFromCurrentStateTests.swift b/tests/unit/BeginFromCurrentStateTests.swift index 430825e..64fe90b 100644 --- a/tests/unit/BeginFromCurrentStateTests.swift +++ b/tests/unit/BeginFromCurrentStateTests.swift @@ -240,10 +240,12 @@ class BeginFromCurrentStateTests: XCTestCase { XCTAssertEqual(addedAnimations.count, 2) - let animation = addedAnimations.last as! CABasicAnimation - XCTAssertFalse(animation.isAdditive) - XCTAssertEqual(animation.keyPath, AnimatableKeyPath.opacity.rawValue) - XCTAssertEqual(animation.fromValue as! Float, initialValue) - XCTAssertEqualWithAccuracy(animation.toValue as! CGFloat, 1.0, accuracy: 0.0001) + if addedAnimations.count == 2 { + let animation = addedAnimations.last as! CABasicAnimation + XCTAssertFalse(animation.isAdditive) + XCTAssertEqual(animation.keyPath, AnimatableKeyPath.opacity.rawValue) + XCTAssertEqual(animation.fromValue as! Float, initialValue) + XCTAssertEqualWithAccuracy(animation.toValue as! CGFloat, 1.0, accuracy: 0.0001) + } } } diff --git a/tests/unit/ImplicitAnimationTests.swift b/tests/unit/ImplicitAnimationTests.swift index 4f27042..9ecf8d0 100644 --- a/tests/unit/ImplicitAnimationTests.swift +++ b/tests/unit/ImplicitAnimationTests.swift @@ -78,6 +78,9 @@ class ImplicitAnimationTests: XCTestCase { } XCTAssertEqual(addedAnimations.count, 1) + guard addedAnimations.count == 1 else { + return + } let animation = addedAnimations.first as! CABasicAnimation XCTAssertEqual(animation.keyPath, AnimatableKeyPath.opacity.rawValue) XCTAssertEqual(animation.fromValue as! CGFloat, 1) @@ -102,6 +105,9 @@ class ImplicitAnimationTests: XCTestCase { } XCTAssertEqual(addedAnimations.count, 2) + guard addedAnimations.count == 2 else { + return + } do { let animation = addedAnimations.first as! CABasicAnimation @@ -147,6 +153,9 @@ class ImplicitAnimationTests: XCTestCase { } XCTAssertEqual(addedAnimations.count, 2) + guard addedAnimations.count == 2 else { + return + } do { let animation = addedAnimations @@ -218,7 +227,10 @@ class ImplicitAnimationTests: XCTestCase { self.view.layer.opacity = 0.5 } - XCTAssertEqual(view.layer.animationKeys()!, ["opacity"]) + XCTAssertNotNil(view.layer.animationKeys) + if let animationKeys = view.layer.animationKeys() { + XCTAssertEqual(animationKeys, ["opacity"]) + } } func testDurationOfZeroRunsAnimationsBlockButGeneratesNoAnimations() {