Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Commit

Permalink
Update bazel workspace to latest versions. (#49)
Browse files Browse the repository at this point in the history
This increases the following versions:

- bazel from 0.11 to 0.20.0
- build_bazel_rules_apple from 0.5.0 to 0.9.0
- build_bazel_rules_swift to 0.4.0 (new)
- bazel_skylib from 0.4.0 to 0.6.0

Tested by running:

    bazel build //...

This change removes the need for header rewrites because we now rely on bazel to handle framework style imports correctly.
  • Loading branch information
jverkoey committed Dec 5, 2018
1 parent 539c58f commit 2ff1038
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 47 deletions.
31 changes: 5 additions & 26 deletions .kokoro
Expand Up @@ -22,31 +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

rewrite_source() {
find "${stashed_dir}${tests_dir_prefix}Tests" -type f -name '*.h' -exec sed -i '' -E "$1" {} + || true
find "${stashed_dir}${tests_dir_prefix}Tests" -type f -name '*.m' -exec sed -i '' -E "$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.
stashed_dir=""
rewrite_source "s/import <MDFInternationalization\/(.+)\.h>/import \"\1.h\"/"
stashed_dir="$(pwd)/"
reset_imports() {
# Undoes our source changes from above.
rewrite_source "s/import \"MDF(.+).h\"/import <MDFInternationalization\/MDF\1.h>/"
rewrite_source "s/import \"(.+)\+MaterialRTL\.h\"/import <MDFInternationalization\/\1+MaterialRTL.h>/"
}
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 @@ -57,7 +32,11 @@ TAG=$(git tag --sort=v:refname -l "$KOKORO_RUNNER_VERSION" | tail -n1)
git checkout "$TAG" > /dev/null
popd

fix_bazel_imports
if [ -n "$KOKORO_BUILD_NUMBER" ]; then
bazel version
use_bazel.sh 0.20.0
bazel version
fi

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

Expand Down
4 changes: 2 additions & 2 deletions BUILD
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@bazel_ios_warnings//:strict_warnings_objc_library.bzl", "strict_warnings_objc_library")
load("@build_bazel_rules_apple//apple:swift.bzl", "swift_library")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_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(":apple_framework_relative_headers.bzl", "apple_framework_relative_headers")

licenses(["notice"]) # Apache 2.0
Expand Down
46 changes: 27 additions & 19 deletions WORKSPACE
Expand Up @@ -12,41 +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 = "io_bazel",
# remote = "https://github.com/bazelbuild/bazel.git",
# tag = "0.14.0",
#)
git_repository(
name = "build_bazel_rules_apple",
remote = "https://github.com/bazelbuild/rules_apple.git",
tag = "0.9.0",
)

load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)

apple_rules_dependencies()

git_repository(
name = "com_github_bazelbuild_buildtools",
remote = "https://github.com/bazelbuild/buildtools.git",
tag = "0.11.1",
name = "build_bazel_rules_swift",
remote = "https://github.com/bazelbuild/rules_swift.git",
tag = "0.4.0",
)

git_repository(
name = "build_bazel_rules_apple",
remote = "https://github.com/bazelbuild/rules_apple.git",
tag = "0.5.0",
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)

swift_rules_dependencies()

git_repository(
name = "bazel_skylib",
remote = "https://github.com/bazelbuild/bazel-skylib.git",
tag = "0.4.0",
)

http_file(
name = "xctestrunner",
executable = 1,
url = "https://github.com/google/xctestrunner/releases/download/0.2.3/ios_test_runner.par",
tag = "0.6.0",
)

git_repository(
name = "bazel_ios_warnings",
remote = "https://github.com/material-foundation/bazel_ios_warnings.git",
tag = "v2.0.0",
)

http_file(
name = "xctestrunner",
executable = 1,
urls = ["https://github.com/google/xctestrunner/releases/download/0.2.5/ios_test_runner.par"],
)

0 comments on commit 2ff1038

Please sign in to comment.