Skip to content

Commit

Permalink
Update any-sketch dependency (#6)
Browse files Browse the repository at this point in the history
 Update any-sketch dependency
  • Loading branch information
oliver-amzn authored Aug 13, 2021
1 parent a63d47a commit 46b0ea5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 74 deletions.
77 changes: 13 additions & 64 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,21 @@ workspace(name = "any_sketch_java")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")

# Abseil C++ libraries
# Common-cpp
http_archive(
name = "com_google_absl",
sha256 = "dd7db6815204c2a62a2160e32c55e97113b0a0178b2f090d6bab5ce36111db4b",
strip_prefix = "abseil-cpp-20210324.0",
urls = [
"https://github.com/abseil/abseil-cpp/archive/refs/tags/20210324.0.tar.gz",
],
name = "wfa_common_cpp",
sha256 = "3110be93990a449ac8f60b534319d7d3a08aa118908fecd7b571a5e08260e560",
strip_prefix = "common-cpp-0.2.1",
url = "https://github.com/world-federation-of-advertisers/common-cpp/archive/v0.2.1.tar.gz",
)

http_archive(
name = "googletest",
sha256 = "94c634d499558a76fa649edb13721dce6e98fb1e7018dfaeba3cd7a083945e91",
strip_prefix = "googletest-release-1.10.0",
urls = ["https://github.com/google/googletest/archive/release-1.10.0.zip"],
)
load("@wfa_common_cpp//build:common_cpp_repositories.bzl", "common_cpp_repositories")

http_archive(
name = "com_github_glog_glog",
sha256 = "f28359aeba12f30d73d9e4711ef356dc842886968112162bc73002645139c39c",
strip_prefix = "glog-0.4.0",
urls = ["https://github.com/google/glog/archive/v0.4.0.tar.gz"],
)
common_cpp_repositories()

# gflags
# Needed for glog
http_archive(
name = "com_github_gflags_gflags",
sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf",
strip_prefix = "gflags-2.2.2",
urls = [
"https://github.com/gflags/gflags/archive/v2.2.2.tar.gz",
],
)
load("@wfa_common_cpp//build:common_cpp_deps.bzl", "common_cpp_deps")

# Protocol buffers
http_archive(
name = "com_google_protobuf",
sha256 = "65e020a42bdab44a66664d34421995829e9e79c60e5adaa08282fd14ca552f57",
strip_prefix = "protobuf-3.15.6",
urls = [
"https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.15.6.tar.gz",
],
)
common_cpp_deps()

# gRPC
http_archive(
Expand All @@ -60,36 +31,14 @@ http_archive(

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

# Includes boringssl, com_google_absl, and other dependencies.
grpc_deps()

load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")

# Loads transitive dependencies of GRPC.
grpc_extra_deps()

http_archive(
name = "com_google_private_join_and_compute",
sha256 = "13e0414220a2709b0dbeefafe5a4d1b3f3261a541d0405c844857521d5f25f32",
strip_prefix = "private-join-and-compute-89c8d0aae070b9c282043af419e47d7ef897f460",
urls = [
"https://github.com/google/private-join-and-compute/archive/89c8d0aae070b9c282043af419e47d7ef897f460.zip",
],
)

new_git_repository(
name = "farmhash",
build_file_content = """
package(default_visibility = ["//visibility:public"])
cc_library(
name = "farmhash",
hdrs = ["src/farmhash.h"],
srcs = ["src/farmhash.cc"],
deps = [],
)""",
commit = "2f0e005b81e296fa6963e395626137cf729b710c",
remote = "https://github.com/google/farmhash.git",
shallow_since = "1509400690 -0700",
)

# Support Maven sources

http_archive(
Expand Down Expand Up @@ -131,7 +80,7 @@ wfa_repo_archive(

wfa_repo_archive(
name = "any_sketch",
commit = "995fe42006a56f926e568c0b02adae5f834a813d",
version = "0.1.0",
repo = "any-sketch",
sha256 = "2477a9cb52a6a415b0d498f7ba19010965145af4a449029df2e64d2379d3cc01",
sha256 = "904a3dd0b48bccbbd0b84830c85e47aa56fe1257211514bfad99a88595ce6325",
)
30 changes: 24 additions & 6 deletions build/wfa/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,32 @@

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

_URL_TEMPLATE = "https://github.com/world-federation-of-advertisers/{repo}/archive/{commit}.tar.gz"
_PREFIX_TEMPLATE = "{repo}-{commit}"
_RELEASE_URL_TEMPLATE = "https://github.com/world-federation-of-advertisers/{repo}/archive/refs/tags/v{version}.tar.gz"
_COMMIT_URL_TEMPLATE = "https://github.com/world-federation-of-advertisers/{repo}/archive/{commit}.tar.gz"
_PREFIX_TEMPLATE = "{repo}-{suffix}"

def wfa_repo_archive(name, repo, sha256, version = None, commit = None):
"""Adds a WFA repository archive target.
Args:
name: target name
repo: name of repository in world-federation-of-advertisers organization
sha256: SHA256 hash of archive
version: release version number. Either this or commit must be specified.
commit: commit hash. Either this or version must be specified.
"""
if version:
suffix = version
url = _RELEASE_URL_TEMPLATE.format(repo = repo, version = version)
elif commit:
suffix = commit
url = _COMMIT_URL_TEMPLATE.format(repo = repo, commit = commit)
else:
fail("version or commit must be specified")

def wfa_repo_archive(name, repo, commit, sha256 = None):
"""Adds a WFA repository archive target."""
http_archive(
name = name,
urls = [_URL_TEMPLATE.format(repo = repo, commit = commit)],
strip_prefix = _PREFIX_TEMPLATE.format(repo = repo, commit = commit),
urls = [url],
strip_prefix = _PREFIX_TEMPLATE.format(repo = repo, suffix = suffix),
sha256 = sha256,
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

%include "exception.i"
%{
#include "src/main/cc/any_sketch/crypto/sketch_encrypter_adapter.h"
#include "any_sketch/crypto/sketch_encrypter_adapter.h"
%}

// Convert C++ ::absl::StatusOr<std::string> to a Java byte
Expand Down Expand Up @@ -61,4 +61,4 @@
return $jnicall;
}

%include "src/main/cc/any_sketch/crypto/sketch_encrypter_adapter.h"
%include "any_sketch/crypto/sketch_encrypter_adapter.h"
4 changes: 2 additions & 2 deletions src/main/java/org/wfanet/estimation/estimators.swig
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
// limitations under the License.

%{
#include "src/main/cc/estimation/estimators.h"
#include "estimation/estimators.h"
%}

typedef unsigned long int uint64_t;
typedef long long int64_t;

%include "src/main/cc/estimation/estimators.h"
%include "estimation/estimators.h"

0 comments on commit 46b0ea5

Please sign in to comment.