Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
Refactor and update tink-cc dependencies
Browse files Browse the repository at this point in the history
 * Move testonly deps to `tink_cc_testonly_deps()`
 * Upgrade deps:
   * googletest (=> 1.14)
   * absl (=> 20230802.1)
   * BoringSSL (=> commit 667d54c96acda029523c5bf425e8eb9079dbe94a from the `master-with-bazel` branch)
   * bazel_skylib (=> 1.5.0)
   * bazel (=> 6.4.0) (this is needed because of [1] and [2])

[1] bazelbuild/bazel#15073
[2] google/boringssl@235ee97

PiperOrigin-RevId: 596709495
  • Loading branch information
morambro authored and copybara-github committed Jan 8, 2024
1 parent 7a746d2 commit 830f9b1
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 97 deletions.
2 changes: 1 addition & 1 deletion cc/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.0
6.4.0
4 changes: 3 additions & 1 deletion cc/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ workspace(name = "tink_cc")
# path = "third_party/boringssl_fips/",
# )

load("@tink_cc//:tink_cc_deps.bzl", "tink_cc_deps")
load("@tink_cc//:tink_cc_deps.bzl", "tink_cc_deps", "tink_cc_testonly_deps")

tink_cc_deps()

tink_cc_testonly_deps()

load("@tink_cc//:tink_cc_deps_init.bzl", "tink_cc_deps_init")

tink_cc_deps_init()
2 changes: 1 addition & 1 deletion cc/examples/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.0
6.4.0
43 changes: 22 additions & 21 deletions cc/examples/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
workspace(name = "tink_cc_examples")

# The local_repository() rule is used below because the workspaces referenced
# are all located within the Tink git repository.
#
# To replicate this setup in a workspace located in a separate repository, you
# can:
#
# 1. Load the http_archive() rule by using:
#
# load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
#
# 2. Use the equivalent, commented-out http_archive() rules below as a starting
# point.
#
# See the Tink C++ HOW-TO for more details:
# https://github.com/google/tink/blob/master/docs/CPP-HOWTO.md

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

local_repository(
name = "tink_cc",
path = "../",
)
# http_archive(
# name = "tink_cc",
# urls = ["https://github.com/google/tink/archive/master.zip"],
# strip_prefix = "tink-master/cc",
# )

# Release from 2023-09-18.
maybe(
http_archive,
name = "com_google_absl",
sha256 = "497ebdc3a4885d9209b9bd416e8c3f71e7a1fb8af249f6c2a80b7cbeefcd7e21",
strip_prefix = "abseil-cpp-20230802.1",
urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.1.zip"],
)

# Release from 2023-08-02.
maybe(
http_archive,
name = "com_google_googletest",
sha256 = "1f357c27ca988c3f7c6b4bf68a9395005ac6761f034046e9dde0896e3aba00e4",
strip_prefix = "googletest-1.14.0",
url = "https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip",
)

# Load Tink dependencies.

load("@tink_cc//:tink_cc_deps.bzl", "tink_cc_deps")

tink_cc_deps()

load("@tink_cc//:tink_cc_deps_init.bzl", "tink_cc_deps_init")

tink_cc_deps_init()
132 changes: 70 additions & 62 deletions cc/tink_cc_deps.bzl
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
"""Dependencies of C++ Tink."""
"""Dependencies of Tink C++."""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

def tink_cc_deps():
"""Loads dependencies of C++ Tink."""

# Basic rules we need to add to bazel.
if not native.existing_rule("bazel_skylib"):
# Release from 2022-09-01: https://github.com/bazelbuild/bazel-skylib/releases/tag/1.3.0
http_archive(
name = "bazel_skylib",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
],
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
)
# Release from 2023-11-06.
maybe(
http_archive,
name = "bazel_skylib",
sha256 = "cd55a062e763b9349921f0f5db8c3933288dc8ba4f76dd9416aac68acee3cb94",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz",
],
)

# -------------------------------------------------------------------------
# Protobuf.
Expand All @@ -26,68 +27,75 @@ def tink_cc_deps():
# * @com_google_protobuf//:cc_toolchain
# * @com_google_protobuf//:java_toolchain
# This statement defines the @com_google_protobuf repo.
if not native.existing_rule("com_google_protobuf"):
# Release X.25.1 from 2023-11-15.
http_archive(
name = "com_google_protobuf",
strip_prefix = "protobuf-25.1",
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protobuf-25.1.zip"],
sha256 = "5c86c077b0794c3e9bb30cac872cf883043febfb0f992137f0a8b1c3d534617c",
)
# Release X.25.1 from 2023-11-15.
maybe(
http_archive,
name = "com_google_protobuf",
sha256 = "5c86c077b0794c3e9bb30cac872cf883043febfb0f992137f0a8b1c3d534617c",
strip_prefix = "protobuf-25.1",
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protobuf-25.1.zip"],
)

# -------------------------------------------------------------------------
# Abseil.
# -------------------------------------------------------------------------
if not native.existing_rule("com_google_absl"):
# Release from 2023-08-02.
http_archive(
name = "com_google_absl",
strip_prefix = "abseil-cpp-20230802.0",
urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.0.zip"],
sha256 = "2942db09db29359e0c1982986167167d226e23caac50eea1f07b2eb2181169cf",
)
# Release from 2023-09-18.
maybe(
http_archive,
name = "com_google_absl",
sha256 = "497ebdc3a4885d9209b9bd416e8c3f71e7a1fb8af249f6c2a80b7cbeefcd7e21",
strip_prefix = "abseil-cpp-20230802.1",
urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.1.zip"],
)

# -------------------------------------------------------------------------
# BoringSSL.
# -------------------------------------------------------------------------
if not native.existing_rule("boringssl"):
# Commit from 2023-02-15.
http_archive(
name = "boringssl",
strip_prefix = "boringssl-5c22014ca513807ed03c657e8ede076164663979",
url = "https://github.com/google/boringssl/archive/5c22014ca513807ed03c657e8ede076164663979.zip",
sha256 = "863fc670c456f30923740c1639305132fdfb9d1b25ba385a67ae3862ef12a8af",
)
# Commit from 2023-09-08.
maybe(
http_archive,
name = "boringssl",
sha256 = "21b2086e9242b87415767fd6d2d13bd0481e2eb3c336c7ffa24b1f3d7afb09ae",
strip_prefix = "boringssl-667d54c96acda029523c5bf425e8eb9079dbe94a",
url = "https://github.com/google/boringssl/archive/667d54c96acda029523c5bf425e8eb9079dbe94a.zip",
)

# -------------------------------------------------------------------------
# GoogleTest/GoogleMock.
# Rapidjson.
# -------------------------------------------------------------------------
# Release from 2016-08-25 (still the latest release as of 2022-05-05).
maybe(
http_archive,
build_file = "@tink_cc//:third_party/rapidjson.BUILD.bazel",
name = "rapidjson",
sha256 = "bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e",
strip_prefix = "rapidjson-1.1.0",
url = "https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz",
)

def tink_cc_testonly_deps():
"""Test only dependencies for tink-cc."""

# -------------------------------------------------------------------------
# Wycheproof.
# -------------------------------------------------------------------------
if not native.existing_rule("com_google_googletest"):
# Release from 2021-06-11.
http_archive(
name = "com_google_googletest",
strip_prefix = "googletest-release-1.11.0",
url = "https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz",
sha256 = "b4870bf121ff7795ba20d20bcdd8627b8e088f2d1dab299a031c1034eddc93d5",
)
# Commit from 2019-12-17.
maybe(
http_archive,
name = "wycheproof",
sha256 = "eb1d558071acf1aa6d677d7f1cabec2328d1cf8381496c17185bd92b52ce7545",
strip_prefix = "wycheproof-d8ed1ba95ac4c551db67f410c06131c3bc00a97c",
url = "https://github.com/google/wycheproof/archive/d8ed1ba95ac4c551db67f410c06131c3bc00a97c.zip",
)

# -------------------------------------------------------------------------
# Wycheproof (depends on Rapidjson).
# GoogleTest/GoogleMock.
# -------------------------------------------------------------------------
if not native.existing_rule("rapidjson"):
# Release from 2016-08-25 (still the latest release as of 2022-05-05).
http_archive(
name = "rapidjson",
url = "https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz",
sha256 = "bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e",
strip_prefix = "rapidjson-1.1.0",
build_file = "@tink_cc//:third_party/rapidjson.BUILD.bazel",
)
if not native.existing_rule("wycheproof"):
# Commit from 2019-12-17.
http_archive(
name = "wycheproof",
strip_prefix = "wycheproof-d8ed1ba95ac4c551db67f410c06131c3bc00a97c",
url = "https://github.com/google/wycheproof/archive/d8ed1ba95ac4c551db67f410c06131c3bc00a97c.zip",
sha256 = "eb1d558071acf1aa6d677d7f1cabec2328d1cf8381496c17185bd92b52ce7545",
)
# Release from 2023-08-02.
maybe(
http_archive,
name = "com_google_googletest",
sha256 = "1f357c27ca988c3f7c6b4bf68a9395005ac6761f034046e9dde0896e3aba00e4",
strip_prefix = "googletest-1.14.0",
url = "https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip",
)
20 changes: 9 additions & 11 deletions cmake/TinkWorkspace.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ if (TINK_BUILD_TESTS)
else()
http_archive(
NAME googletest
URL https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz
SHA256 b4870bf121ff7795ba20d20bcdd8627b8e088f2d1dab299a031c1034eddc93d5
URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip
SHA256 1f357c27ca988c3f7c6b4bf68a9395005ac6761f034046e9dde0896e3aba00e4
)
endif()

Expand All @@ -79,11 +79,11 @@ if (TINK_BUILD_TESTS)
endif()

if (NOT TINK_USE_INSTALLED_ABSEIL)
# Release from 2023-08-02.
# Release from 2023-09-18.
http_archive(
NAME abseil
URL https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.0.zip
SHA256 2942db09db29359e0c1982986167167d226e23caac50eea1f07b2eb2181169cf
URL https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.1.zip
SHA256 497ebdc3a4885d9209b9bd416e8c3f71e7a1fb8af249f6c2a80b7cbeefcd7e21
)
else()
# This is everything that needs to be done here. Abseil already defines its
Expand All @@ -95,14 +95,12 @@ endif()
# defined.
if (NOT TARGET crypto)
if (NOT TINK_USE_SYSTEM_OPENSSL)
# Commit from Feb 15, 2023.
# NOTE: This is one commit ahead of Bazel; the commit fixes a CMake issue,
# which made build fail on CMake 3.10.
# See https://github.com/google/boringssl/compare/5c22014...e27ff0e.
# Commit from 2023-09-08.
# TODO(b/319145660): Use a later version once we can force /std:c11 on MSVC.
http_archive(
NAME boringssl
URL https://github.com/google/boringssl/archive/e27ff0e4312c91357778b36bbd8a7ec7bfc67be3.zip
SHA256 11d3c87906bed215a915b0db11cefd0fc7b939ddbec4952a29e343a83ce3bc50
URL https://github.com/google/boringssl/archive/667d54c96acda029523c5bf425e8eb9079dbe94a.zip
SHA256 21b2086e9242b87415767fd6d2d13bd0481e2eb3c336c7ffa24b1f3d7afb09ae
CMAKE_SUBDIR src
)
# BoringSSL targets do not carry include directory info, this fixes it.
Expand Down

0 comments on commit 830f9b1

Please sign in to comment.