This repository was archived by the owner on Aug 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Replace arc with bazel and kokoro build runner for continuous integration #47
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
bazel-* | ||
.kokoro-ios-runner | ||
|
||
# Jazzy | ||
docs/ | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Fail on any error. | ||
set -e | ||
|
||
# Display commands to stderr. | ||
set -x | ||
|
||
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 | ||
TAG=$(git tag -l "v3*" | sort | tail -n1) | ||
git checkout $TAG > /dev/null | ||
popd | ||
|
||
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 | ||
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 | ||
} | ||
trap reset_imports EXIT | ||
|
||
./.kokoro-ios-runner/bazel.sh test //:UnitTests 8.1.0 | ||
|
||
echo "Success!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Description: | ||
# Light-weight API for building UIViewController transitions. | ||
|
||
licenses(["notice"]) # Apache 2.0 | ||
|
||
exports_files(["LICENSE"]) | ||
|
||
load("@bazel_ios_warnings//:strict_warnings_objc_library.bzl", "strict_warnings_objc_library") | ||
|
||
strict_warnings_objc_library( | ||
name = "MotionTransitioning", | ||
srcs = glob([ | ||
"src/*.m", | ||
"src/private/*.m", | ||
]), | ||
hdrs = glob([ | ||
"src/*.h", | ||
"src/private/*.h", | ||
]), | ||
enable_modules = 1, | ||
includes = ["src"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
load("@build_bazel_rules_apple//apple:swift.bzl", "swift_library") | ||
|
||
swift_library( | ||
name = "UnitTestsSwiftLib", | ||
srcs = glob([ | ||
"tests/unit/*.swift", | ||
"tests/unit/Transitions/*.swift", | ||
]), | ||
deps = [":MotionTransitioning"], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
objc_library( | ||
name = "UnitTestsLib", | ||
srcs = glob([ | ||
"tests/unit/*.m", | ||
]), | ||
deps = [":MotionTransitioning"], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test") | ||
|
||
ios_unit_test( | ||
name = "UnitTests", | ||
deps = [ | ||
":UnitTestsLib", | ||
":UnitTestsSwiftLib" | ||
], | ||
minimum_os_version = "8.0", | ||
timeout = "short", | ||
visibility = ["//visibility:private"], | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
git_repository( | ||
name = "build_bazel_rules_apple", | ||
remote = "https://github.com/bazelbuild/rules_apple.git", | ||
commit = "7ea0557", | ||
) | ||
|
||
git_repository( | ||
name = "bazel_ios_warnings", | ||
remote = "https://github.com/material-foundation/bazel_ios_warnings.git", | ||
commit = "3e61cb5b60f52c8b9c77b5d62364d8b4d25e528f", | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
Copyright 2017-present The Material Motion Authors. All Rights Reserved. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import UIKit | ||
import MotionTransitioning | ||
|
||
final class CompositeTransition: NSObject, Transition, TransitionWithCustomDuration { | ||
|
||
let transitions: [Transition] | ||
init(transitions: [Transition]) { | ||
self.transitions = transitions | ||
|
||
super.init() | ||
} | ||
|
||
// The sole method we're expected to implement, start is invoked each time the view controller is | ||
// presented or dismissed. | ||
func start(with context: TransitionContext) { | ||
transitions.forEach { context.compose(with: $0) } | ||
|
||
context.transitionDidEnd() | ||
} | ||
|
||
// MARK: TransitionWithCustomDuration | ||
|
||
func transitionDuration(with context: TransitionContext) -> TimeInterval { | ||
let duration = transitions.flatMap { $0 as? TransitionWithCustomDuration }.map { $0.transitionDuration(with: context) }.max { $0 < $1 } | ||
if let duration = duration { | ||
return duration | ||
} | ||
return 0.35 | ||
} | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semantic Versioning support FTW!