Skip to content
This repository has been archived by the owner on Aug 30, 2023. 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 Nov 8, 2017
2 parents 62a650b + 7b7624e commit 92996ad
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 36 deletions.
23 changes: 0 additions & 23 deletions .kokoro
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,6 @@ set -x

KOKORO_RUNNER_VERSION="v3.*"

fix_bazel_imports() {
if [ -z "$KOKORO_BUILD_NUMBER" ]; then
tests_dir_prefix=""
else
tests_dir_prefix="github/repo/"
fi

# Fixes a bug in bazel where objc_library targets have a _ prefix.
find "${tests_dir_prefix}tests/unit" -type f -name '*.swift' -exec sed -i '' -E "s/import Motion(.+)/import _Motion\1/" {} + || true
# CocoaPods requires that public headers of dependent pods be implemented using framework import
# notation, while bazel requires that dependency headers be imported with quoted notation.
find "${tests_dir_prefix}src" -type f -name '*.h' -exec sed -i '' -E "s/import <MotionInterchange\/MotionInterchange\.h>/import \"MotionInterchange.h\"/" {} + || true
stashed_dir=$(pwd)
reset_imports() {
# Undoes our source changes from above.
find "${stashed_dir}/${tests_dir_prefix}tests/unit" -type f -name '*.swift' -exec sed -i '' -E "s/import _Motion(.+)/import Motion\1/" {} + || true
find "${stashed_dir}/${tests_dir_prefix}src" -type f -name '*.h' -exec sed -i '' -E "s/import \"MotionInterchange.h\"/import <MotionInterchange\/MotionInterchange.h>/" {} + || true
}
trap reset_imports EXIT
}

if [ ! -d .kokoro-ios-runner ]; then
git clone https://github.com/material-foundation/kokoro-ios-runner.git .kokoro-ios-runner
fi
Expand All @@ -54,8 +33,6 @@ TAG=$(git tag --sort=v:refname -l "$KOKORO_RUNNER_VERSION" | tail -n1)
git checkout "$TAG" > /dev/null
popd

fix_bazel_imports

./.kokoro-ios-runner/bazel.sh test //:UnitTests 8.1.0

echo "Success!"
2 changes: 2 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ strict_warnings_objc_library(
"src/*.h",
"src/private/*.h",
]),
defines = ["IS_BAZEL_BUILD"],
deps = [
"@motion_interchange_objc//:MotionInterchange"
],
Expand All @@ -46,6 +47,7 @@ swift_library(
srcs = glob([
"tests/unit/*.swift",
]),
defines = ["IS_BAZEL_BUILD"],
deps = [":MotionAnimator"],
visibility = ["//visibility:private"],
)
Expand Down
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# 2.1.1

This patch release fixes issues with downstream bazel builds.

## Source changes

* [Touch up the block animations docs. (#35)](https://github.com/material-motion/motion-animator-objc/commit/64d6c3107872fc5d430d960c7d87f93799592457) (featherless)
* [Resolve bazel build dependency issues. (#29)](https://github.com/material-motion/motion-animator-objc/commit/94b86e6c4af2702d1153166eb2855fcde8d5c92c) (featherless)

## Non-source changes

* [Fix typo in the changelog.](https://github.com/material-motion/motion-animator-objc/commit/602c656b7fbad73831b6e495003000cfbd59e0e0) (Jeff Verkoeyen)

# 2.1.0

This minor releae introduces new implicit animation APIs. These APIs provide a migration path from
This minor release introduces new implicit animation APIs. These APIs provide a migration path from
existing UIView `animateWithDuration:...` code.

## New features
Expand Down
2 changes: 1 addition & 1 deletion MotionAnimator.podspec
Original file line number Diff line number Diff line change
@@ -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.1.0"
s.version = "2.1.1"
s.authors = "The Material Motion Authors"
s.license = "Apache 2.0"
s.homepage = "https://github.com/material-motion/motion-animator-objc"
Expand Down
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- CatalogByConvention (2.2.0)
- MotionAnimator (2.1.0):
- MotionAnimator (2.1.1):
- MotionInterchange (~> 1.2)
- MotionInterchange (1.2.0)

Expand All @@ -14,7 +14,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
CatalogByConvention: 5df5831e48b8083b18570dcb804f20fd1c90694f
MotionAnimator: 82a455d6e57d3670c1e2a89cd92f6a700a0433a4
MotionAnimator: f306d8ee1a6600b039345c548cb543ebaa9cdec4
MotionInterchange: 499c98e7628a8a078905749734dbfedbfae54cca

PODFILE CHECKSUM: 3c50d819e57d8329e39f3f5677139bf93ac34b8b
Expand Down
4 changes: 4 additions & 0 deletions src/MDMMotionAnimator.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>

#ifdef IS_BAZEL_BUILD
#import "MotionInterchange.h"
#else
#import <MotionInterchange/MotionInterchange.h>
#endif

#import "MDMAnimatableKeyPaths.h"
#import "MDMCoreAnimationTraceable.h"
Expand Down
16 changes: 8 additions & 8 deletions src/private/MDMBlockAnimations.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
#import <UIKit/UIKit.h>
#import <objc/runtime.h>

static IMP sOriginalActionForLayerImp = NULL;

@interface MDMActionContext: NSObject
@property(nonatomic, readonly) NSArray<MDMImplicitAction *> *interceptedActions;
@end

// The original UIView method implementation of actionForLayer:forKey:.
static IMP sOriginalActionForLayerImp = NULL;
static NSMutableArray<MDMActionContext *> *sActionContext = nil;

@implementation MDMImplicitAction

- (instancetype)initWithLayer:(CALayer *)layer
Expand Down Expand Up @@ -67,8 +69,6 @@ - (void)addActionForLayer:(CALayer *)layer

@end

static NSMutableArray *sActionContext = nil;

static id<CAAction> ActionForLayer(id self, SEL _cmd, CALayer *layer, NSString *event) {
NSCAssert([NSStringFromSelector(_cmd) isEqualToString:
NSStringFromSelector(@selector(actionForLayer:forKey:))],
Expand All @@ -87,7 +87,7 @@ - (void)addActionForLayer:(CALayer *)layer
// We don't have access to the "to" value of our animation here, so we unfortunately can't
// calculate additive values if the animator is configured as such. So, to support additive
// animations, we queue up the modified actions and then add them all at the end of our
// MDMAnimateBlock invocation.
// MDMAnimateImplicitly invocation.
id initialValue = [layer valueForKeyPath:event];
[context addActionForLayer:layer keyPath:event withInitialValue:initialValue];
return [NSNull null];
Expand All @@ -98,8 +98,8 @@ - (void)addActionForLayer:(CALayer *)layer
return nil;
}

// This method can be called recursively, so we maintain a recursive context stack in the scope of
// this method. Note that this is absolutely not thread safe, but neither is Core Animation.
// This method can be called recursively, so we maintain a context stack in the scope of this
// method. Note that this is absolutely not thread safe, but neither is Core Animation.
if (!sActionContext) {
sActionContext = [NSMutableArray array];
}
Expand All @@ -110,7 +110,7 @@ - (void)addActionForLayer:(CALayer *)layer

if (sOriginalActionForLayerImp == nil) {
// Swap the original UIView implementation with our own so that we can intercept all
// actionForLayer:forKey: events. All events will be
// actionForLayer:forKey: events.
sOriginalActionForLayerImp = method_setImplementation(method, (IMP)ActionForLayer);
}

Expand Down
5 changes: 4 additions & 1 deletion tests/unit/ImplicitAnimationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
*/

import XCTest

#if IS_BAZEL_BUILD
import _MotionAnimator
#else
import MotionAnimator
#endif

class ImplicitAnimationTests: XCTestCase {
var animator: MotionAnimator!
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/MotionAnimatorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
*/

import XCTest

#if IS_BAZEL_BUILD
import _MotionAnimator
#else
import MotionAnimator
#endif

class MotionAnimatorTests: XCTestCase {

Expand Down
4 changes: 4 additions & 0 deletions tests/unit/TimeScaleFactorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
*/

import XCTest
#if IS_BAZEL_BUILD
import _MotionAnimator
#else
import MotionAnimator
#endif

class TimeScaleFactorTests: XCTestCase {

Expand Down

0 comments on commit 92996ad

Please sign in to comment.