Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for bazel 1.1.0. #9

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
Expand Down
43 changes: 43 additions & 0 deletions .kokoro
Original file line number Diff line number Diff line change
@@ -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!"
96 changes: 96 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -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",
],
)
2 changes: 1 addition & 1 deletion MDFSpritedAnimationView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 //...
```
51 changes: 51 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -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
)