diff --git a/.gitignore b/.gitignore index d1dd78e..b74ee8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +bazel-* +.kokoro-ios-runner +.clang-format-ci-src + # Xcode # # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore diff --git a/.kokoro b/.kokoro new file mode 100755 index 0000000..575e2b2 --- /dev/null +++ b/.kokoro @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Copyright 2019-present The Material Foundation 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. + +# Fail on any error. +set -e + +# Display commands to stderr. +set -x + +KOKORO_RUNNER_VERSION="v3.*" + +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 --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 1.1.0 + bazel version +fi + +./.kokoro-ios-runner/bazel.sh test //:UnitTests --min-xcode-version 9.0 + +echo "Success!" diff --git a/BUILD b/BUILD new file mode 100644 index 0000000..f143434 --- /dev/null +++ b/BUILD @@ -0,0 +1,96 @@ +# Copyright 2019-present The Material Foundation 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. + +load("@bazel_skylib//rules:build_test.bzl", "build_test") +load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test_suite") +load("@build_bazel_rules_apple//apple/testing/default_runner:ios_test_runner.bzl", "ios_test_runner") +load("@bazel_ios_warnings//:strict_warnings_objc_library.bzl", "strict_warnings_objc_library") + +licenses(["notice"]) # Apache 2.0 + +exports_files(["LICENSE"]) + +strict_warnings_objc_library( + name = "MDFSpritedAnimationView", + srcs = glob([ + "src/*.m", + ]), + hdrs = glob([ + "src/*.h", + ]), + sdk_frameworks = [ + "UIKit", + "CoreGraphics", + "QuartzCore", + ], + enable_modules = 1, + includes = ["src"], + visibility = ["//visibility:public"], +) + +build_test( + name = "BuildTest", + targets = [ + ":MDFSpritedAnimationView" + ], +) + +objc_library( + name = "UnitTestsLib", + srcs = glob([ + "tests/unit/*.m", + ]), + deps = [ + ":MDFSpritedAnimationView", + ], +) + +ios_test_runner( + name = "IPAD_PRO_12_9_IN_9_3", + device_type = "iPad Pro (12.9-inch)", + os_version = "9.3", +) + +ios_test_runner( + name = "IPHONE_7_PLUS_IN_10_3", + device_type = "iPhone 7 Plus", + os_version = "10.3", +) + +ios_test_runner( + name = "IPHONE_X_IN_11_4", + device_type = "iPhone X", + os_version = "11.4", +) + +ios_test_runner( + name = "IPHONE_XS_MAX_IN_12_2", + device_type = "iPhone Xs Max", + os_version = "12.2", +) + +ios_unit_test_suite( + name = "UnitTests", + deps = [ + ":UnitTestsLib", + ], + minimum_os_version = "9.0", + timeout = "short", + runners = [ + ":IPAD_PRO_12_9_IN_9_3", + ":IPHONE_7_PLUS_IN_10_3", + ":IPHONE_X_IN_11_4", + ":IPHONE_XS_MAX_IN_12_2", + ], +) \ No newline at end of file diff --git a/MDFSpritedAnimationView.podspec b/MDFSpritedAnimationView.podspec index 93f4a51..46947d9 100644 --- a/MDFSpritedAnimationView.podspec +++ b/MDFSpritedAnimationView.podspec @@ -6,7 +6,7 @@ Pod::Spec.new do |s| s.homepage = "https://github.com/material-foundation/MDFSpritedAnimationView" s.license = 'Apache 2.0' s.source = { :git => "https://github.com/material-foundation/MDFSpritedAnimationView.git", :tag => s.version.to_s } - s.platform = :ios, '7.0' + s.platform = :ios, '9.0' s.requires_arc = true s.public_header_files = 'src/*.h' diff --git a/README.md b/README.md index 266d093..ad1d38f 100644 --- a/README.md +++ b/README.md @@ -96,3 +96,32 @@ animationView.tintColor = [UIColor blueColor]; NSLog(@"Done animating."); }]; ``` + +## Bazel support + +This library can be depended on by adding a dependency to your project's `WORKSPACE` file... + +``` +git_repository( + name = "material_sprited_animation_view_ios", + remote = "https://github.com/material-foundation/material-sprited-animation-view-ios.git", + commit = "<#fill me in#>", +) +``` + +...and then depending on the target in your `BUILD` files: + +``` + deps = [ + "@material_sprited_animation_view_ios//:MDFSpritedAnimationView", + ], +``` + +### Build and test with Bazel + +The source can be built and tested using [Bazel](http://bazel.build/): + +```bash +bazel build --ios_sdk_version=13.2 --apple_platform_type=ios //... +bazel test --ios_sdk_version=13.2 --apple_platform_type=ios //... +``` diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..b2f615a --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,51 @@ +# Copyright 2019-present The Material Foundation 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. + +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 = "19f031f09185e0fcd722c22e596d09bd6fff7944", # 0.19.0 + shallow_since = "1570721035 -0700", # 10-10-2019 +) + +load( + "@build_bazel_rules_apple//apple:repositories.bzl", + "apple_rules_dependencies", +) + +apple_rules_dependencies() + +load( + "@build_bazel_rules_swift//swift:repositories.bzl", + "swift_rules_dependencies", +) + +swift_rules_dependencies() + +load( + "@build_bazel_apple_support//lib:repositories.bzl", + "apple_support_dependencies", +) + +apple_support_dependencies() + +git_repository( + name = "bazel_ios_warnings", + remote = "https://github.com/material-foundation/bazel_ios_warnings.git", + commit = "c3f720c0838af1ee53299aa6efda87cf729146b4", # v3.0.0 + shallow_since = "1545400728 -0500" # 12-21-2018 +)