diff options
author | Karn Seth <karn@google.com> | 2021-09-29 19:13:29 +0000 |
---|---|---|
committer | Karn Seth <karn@google.com> | 2021-09-29 19:13:29 +0000 |
commit | 505ba981d66c9e5e73e18cfa647b4685f74784cb (patch) | |
tree | d0b5a4a823ce715fd4f25258396ece4b792318ef | |
parent | 5fb148f76a0a40462f4f97aaf858429478f6939b (diff) | |
download | private-join-and-compute-505ba981d66c9e5e73e18cfa647b4685f74784cb.tar.gz |
adds .bazelrc, pjc_deps and .gitignore
-rw-r--r-- | .bazelrc | 10 | ||||
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | WORKSPACE | 68 | ||||
-rw-r--r-- | bazel/BUILD | 17 | ||||
-rw-r--r-- | bazel/pjc_deps.bzl | 68 |
6 files changed, 105 insertions, 64 deletions
diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000..91e82ec --- /dev/null +++ b/.bazelrc @@ -0,0 +1,10 @@ +# Options for compiling PJC code. +# Include these in dependent workspaces by using the --bazelrc flag, or by +# adding import %pjc_workspace%/bazel.rc to the .bazelrc file in the +# dependent workspace. + +build -c opt +build --cxxopt='-std=c++17' + +test -c opt +test --cxxopt='-std=c++17'
\ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b136f6f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# Bazel generated symlinks +bazel-* +# Mac files +.DS_Store
\ No newline at end of file @@ -56,7 +56,7 @@ the Private Join and Compute library and dependencies using Bazel: ```bash cd private-join-and-compute -bazel build --cxxopt='-std=c++17' //private_join_and_compute/:all +bazel build //private_join_and_compute:all ``` (All the following instructions must be run from inside the @@ -12,84 +12,26 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Copyright 2019 Google Inc. -# -# 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 -# -# https://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. - """WORKSPACE file for Private Join and Compute.""" -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "com_github_google_glog", - sha256 = "21bc744fb7f2fa701ee8db339ded7dce4f975d0d55837a97be7d46e8382dea5a", - strip_prefix = "glog-0.5.0", - url = "https://github.com/google/glog/archive/v0.5.0.zip", -) - -# gflags -# Needed for glog -http_archive( - name = "com_github_gflags_gflags", - sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf", - strip_prefix = "gflags-2.2.2", - urls = [ - "https://mirror.bazel.build/github.com/gflags/gflags/archive/v2.2.2.tar.gz", - "https://github.com/gflags/gflags/archive/v2.2.2.tar.gz", - ], -) - -# Abseil C++ libraries -git_repository( - name = "com_google_absl", - remote = "https://github.com/abseil/abseil-cpp.git", - commit = "0f3bb466b868b523cf1dc9b2aaaed65c77b28862", - shallow_since = "1603283562 -0400", -) +load("//bazel:pjc_deps.bzl", "pjc_deps") # gRPC +# must be included separately, since we need to load transitive deps of grpc. http_archive( name = "com_github_grpc_grpc", - strip_prefix = "grpc-1.37.1", sha256 = "acf247ec3a52edaee5dee28644a4e485c5e5badf46bdb24a80ca1d76cb8f1174", + strip_prefix = "grpc-1.37.1", urls = [ "https://github.com/grpc/grpc/archive/v1.37.1.tar.gz", ], ) -# gtest. -git_repository( - name = "com_github_google_googletest", - commit = "703bd9caab50b139428cea1aaff9974ebee5742e", # tag = "release-1.10.0" - remote = "https://github.com/google/googletest.git", - shallow_since = "1570114335 -0400", -) - -# Protobuf -git_repository( - name = "com_google_protobuf", - remote = "https://github.com/protocolbuffers/protobuf.git", - commit = "9647a7c2356a9529754c07235a2877ee676c2fd0", - shallow_since = "1609366209 -0800", -) - load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") - -# Includes boringssl, 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() + +pjc_deps() diff --git a/bazel/BUILD b/bazel/BUILD new file mode 100644 index 0000000..ca48cae --- /dev/null +++ b/bazel/BUILD @@ -0,0 +1,17 @@ +# Copyright 2019 Google LLC. +# +# 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 +# +# https://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. + +licenses(["notice"]) # Apache v2 + +package(default_visibility = ["//:__subpackages__"]) diff --git a/bazel/pjc_deps.bzl b/bazel/pjc_deps.bzl new file mode 100644 index 0000000..ad42e61 --- /dev/null +++ b/bazel/pjc_deps.bzl @@ -0,0 +1,68 @@ +# Copyright 2019 Google LLC. +# +# 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 +# +# https://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. + +""" Dependencies needed to compile and test the PJC library """ + +load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +def pjc_deps(): + """Loads dependencies need to compile and test the PJC library.""" + if "com_github_google_glog" not in native.existing_rules(): + http_archive( + name = "com_github_google_glog", + sha256 = "21bc744fb7f2fa701ee8db339ded7dce4f975d0d55837a97be7d46e8382dea5a", + strip_prefix = "glog-0.5.0", + url = "https://github.com/google/glog/archive/v0.5.0.zip", + ) + + if "com_github_gflags_gflags" not in native.existing_rules(): + # gflags + # Needed for glog + http_archive( + name = "com_github_gflags_gflags", + sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf", + strip_prefix = "gflags-2.2.2", + urls = [ + "https://mirror.bazel.build/github.com/gflags/gflags/archive/v2.2.2.tar.gz", + "https://github.com/gflags/gflags/archive/v2.2.2.tar.gz", + ], + ) + + # Abseil C++ libraries + if "com_google_absl" not in native.existing_rules(): + git_repository( + name = "com_google_absl", + remote = "https://github.com/abseil/abseil-cpp.git", + commit = "0f3bb466b868b523cf1dc9b2aaaed65c77b28862", + shallow_since = "1603283562 -0400", + ) + + # gtest. + if "com_github_google_googletest" not in native.existing_rules(): + git_repository( + name = "com_github_google_googletest", + commit = "703bd9caab50b139428cea1aaff9974ebee5742e", # tag = "release-1.10.0" + remote = "https://github.com/google/googletest.git", + shallow_since = "1570114335 -0400", + ) + + # Protobuf + if "com_google_protobuf" not in native.existing_rules(): + git_repository( + name = "com_google_protobuf", + remote = "https://github.com/protocolbuffers/protobuf.git", + commit = "9647a7c2356a9529754c07235a2877ee676c2fd0", + shallow_since = "1609366209 -0800", + ) |