Skip to content

Commit

Permalink
Fixing macOS build.
Browse files Browse the repository at this point in the history
Change-Id: I862c1f90580f32d99d9cf4c44430f749801a0574
ORIGINAL_AUTHOR=Thai Duong <[email protected]>
GitOrigin-RevId: afd20aad283aaae1741e368d7f19208f2291eca7
  • Loading branch information
thaidn committed Sep 25, 2017
1 parent 97caa68 commit dc73250
Show file tree
Hide file tree
Showing 18 changed files with 785 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ tulsigen-*
*.iml
.gradle
**/local.properties
**/build
**/build/**
.externalNativeBuild

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Tink

![Kokoro
Ubuntu](https://storage.googleapis.com/tink-kokoro-build-badges/tink-ubuntu.png)
**`Ubuntu`** | **`macOS`**
----------------------------------------------------------------------------------------- | -----------
![Kokoro Ubuntu](https://storage.googleapis.com/tink-kokoro-build-badges/tink-ubuntu.png) | ![Kokoro macOS](https://storage.googleapis.com/tink-kokoro-build-badges/tink-macos.png)

## Introduction

Expand Down
10 changes: 0 additions & 10 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -276,23 +276,13 @@ maven_jar(
#-----------------------------------------------------------------------------
# objc
#-----------------------------------------------------------------------------
# TODO(thaidn): remove this dependency by porting what needed to
# third_party/rules_protobuf.
git_repository(
name = "org_pubref_rules_protobuf",
commit = "61efe7c69a6bafffd9f1231f9d6ea97c2014aa64",
remote = "https://github.com/pubref/rules_protobuf.git",
)

git_repository(
name = "build_bazel_rules_apple",
commit = "7ea05576182ba82ea9b951fa3d42ecdb3dc8dc59",
remote = "https://github.com/bazelbuild/rules_apple.git",
)

load("@org_pubref_rules_protobuf//objc:rules.bzl", "objc_proto_repositories")
objc_proto_repositories()

load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
5 changes: 3 additions & 2 deletions kokoro/macos_external/presubmit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

build_file: "tink/kokoro/macos_external/presubmit.sh"

gfile_resources: "/x20/teams/blaze/bazel/kokoro/bazel-0.5.3-darwin-x86_64"
gfile_resources: "/x20/teams/ise-team/kokoro/jdk-8u131-macosx-x64/jdk-8u131-macosx-x64.tgz"
gfile_resources: "/x20/teams/ise-crypto/tink/kokoro/jdk-8u131-macosx-x64/jdk-8u131-macosx-x64.tgz"

gfile_resources: "/x20/teams/ise-crypto/tink/kokoro/bazel-c6122b6ad35ebbed61036b0a2bcfea92b10adb8f-darwin-x86_64"
3 changes: 2 additions & 1 deletion kokoro/macos_external/presubmit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set -x
: "${IOS_SDK_VERSION:=10.2}"
: "${XCODE_VERSION:=8.2.1}"

BAZEL_BIN="${KOKORO_GFILE_DIR}/bazel-0.5.3-darwin-x86_64"
BAZEL_BIN="${KOKORO_GFILE_DIR}/bazel-c6122b6ad35ebbed61036b0a2bcfea92b10adb8f-darwin-x86_64"

DISABLE_SANDBOX="--strategy=GenRule=standalone --strategy=Turbine=standalone \
--strategy=CppCompile=standalone --strategy=ProtoCompile=standalone \
Expand All @@ -39,6 +39,7 @@ mkdir jdk; cd jdk;
cp "${KOKORO_GFILE_DIR}/jdk-8u131-macosx-x64.tgz" ./
tar xf jdk-8u131-macosx-x64.tgz

export ANDROID_HOME="/Users/kbuilder/Library/Android/sdk"
export JAVA_HOME="${PWD}/Home"
export PATH="${JAVA_HOME}/bin:$PATH"
chmod -R a+rx "${JAVA_HOME}"
Expand Down
17 changes: 1 addition & 16 deletions proto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package(
licenses(["notice"]) # Apache 2.0

load("@io_bazel_rules_go//proto:go_proto_library.bzl", "go_proto_library")
load("@org_pubref_rules_protobuf//objc:rules.bzl", "objc_proto_compile")
load("//third_party/rules_protobuf/objc:rules.bzl", "objc_proto_compile")
load("//proto:objc.bzl", "tink_objc_proto_library")

# -----------------------------------------------
Expand Down Expand Up @@ -50,7 +50,6 @@ objc_proto_compile(
protos = ["common.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
)

# -----------------------------------------------
Expand Down Expand Up @@ -96,7 +95,6 @@ objc_proto_compile(
protos = ["tink.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
)

# -----------------------------------------------
Expand Down Expand Up @@ -177,7 +175,6 @@ objc_proto_compile(
protos = ["ecdsa.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
deps = [":common_objc_pb"],
)

Expand Down Expand Up @@ -218,7 +215,6 @@ objc_proto_compile(
protos = ["ed25519.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
)

# -----------------------------------------------
Expand Down Expand Up @@ -262,7 +258,6 @@ objc_proto_compile(
protos = ["hmac.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
deps = [":common_objc_pb"],
)

Expand Down Expand Up @@ -303,7 +298,6 @@ objc_proto_compile(
protos = ["aes_ctr.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
)

# -----------------------------------------------
Expand Down Expand Up @@ -351,7 +345,6 @@ objc_proto_compile(
protos = ["aes_ctr_hmac_aead.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
deps = [
":aes_ctr_objc_pb",
":hmac_objc_pb",
Expand Down Expand Up @@ -395,7 +388,6 @@ objc_proto_compile(
protos = ["aes_gcm.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
)

# -----------------------------------------------
Expand Down Expand Up @@ -441,7 +433,6 @@ objc_proto_compile(
protos = ["aes_ctr_hmac_streaming.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
deps = [
":common_objc_pb",
":hmac_objc_pb",
Expand Down Expand Up @@ -487,7 +478,6 @@ objc_proto_compile(
protos = ["aes_gcm_hkdf_streaming.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
deps = [
":common_objc_pb",
],
Expand Down Expand Up @@ -530,7 +520,6 @@ objc_proto_compile(
protos = ["aes_eax.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
)

# -----------------------------------------------
Expand Down Expand Up @@ -570,7 +559,6 @@ objc_proto_compile(
protos = ["chacha20_poly1305.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
)

# -----------------------------------------------
Expand Down Expand Up @@ -610,7 +598,6 @@ objc_proto_compile(
protos = ["kms_aead.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
)

# -----------------------------------------------
Expand Down Expand Up @@ -654,7 +641,6 @@ objc_proto_compile(
protos = ["kms_envelope.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
deps = [
":tink_objc_pb",
],
Expand Down Expand Up @@ -705,7 +691,6 @@ objc_proto_compile(
protos = ["ecies_aead_hkdf.proto"],
tags = ["manual"],
visibility = ["//visibility:private"],
with_grpc = False,
deps = [
":common_objc_pb",
":tink_objc_pb",
Expand Down
2 changes: 1 addition & 1 deletion proto/objc.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The actual rule which does the filtering.
def _do_filter_impl(ctx):
return struct(
files = set([f for f in ctx.files.srcs if f.path.endswith(ctx.attr.suffix)]),
files = depset([f for f in ctx.files.srcs if f.path.endswith(ctx.attr.suffix)]),
)

_do_filter = rule(
Expand Down
5 changes: 5 additions & 0 deletions third_party/rules_protobuf/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0

exports_files(["LICENSE"])
13 changes: 13 additions & 0 deletions third_party/rules_protobuf/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2016 PubRef.org

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.
10 changes: 10 additions & 0 deletions third_party/rules_protobuf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Bazel Skylark rules for building protobufs for ObjC

This is a minimal fork of [Rules Protobuf](https://github.com/pubref/rules_protobuf)
that supports building protobuf for ObjC.

Tink needs temporarily depend on these rules because objc_proto_library is
not working properly. See https://github.com/bazelbuild/bazel/issues/1802.

Once either Bazel or Protobuf team fixes objc_proto_library, these rules
can be removed.
14 changes: 14 additions & 0 deletions third_party/rules_protobuf/objc/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0

load("//third_party/rules_protobuf/protobuf:rules.bzl", "proto_language")

proto_language(
name = "objc",
output_file_style = "pascal",
pb_file_extensions = [
".pbobjc.h",
".pbobjc.m",
],
)
6 changes: 6 additions & 0 deletions third_party/rules_protobuf/objc/rules.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
load("//third_party/rules_protobuf/protobuf:rules.bzl", "proto_compile")

def objc_proto_compile(
langs = [str(Label("//third_party/rules_protobuf/objc"))],
**kwargs):
proto_compile(langs = langs, **kwargs)
3 changes: 3 additions & 0 deletions third_party/rules_protobuf/protobuf/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0
Loading

0 comments on commit dc73250

Please sign in to comment.