create importable function for defining zlib

pull/5786/head
Kent Ross 6 years ago committed by Adam Cozzette
parent e4e5bc49d7
commit b6375e03aa
  1. 17
      WORKSPACE
  2. 14
      examples/WORKSPACE
  3. 20
      protobuf_deps.bzl

@ -1,6 +1,10 @@
workspace(name = "com_google_protobuf")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//:protobuf_deps.bzl", "protobuf_deps")
# Load common dependencies.
protobuf_deps()
new_local_repository(
name = "submodule_gmock",
@ -22,14 +26,6 @@ http_archive(
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/2169ae1c374aab4a09aa90e65efe1a3aad4e279b.tar.gz"],
)
http_archive(
name = "net_zlib",
build_file = "//:third_party/zlib.BUILD",
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11",
urls = ["https://zlib.net/zlib-1.2.11.tar.gz"],
)
bind(
name = "python_headers",
actual = "//util/python:python_headers",
@ -69,8 +65,3 @@ bind(
name = "gson",
actual = "@gson_maven//jar",
)
bind(
name = "zlib",
actual = "@net_zlib//:zlib",
)

@ -41,18 +41,10 @@ http_archive(
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/2169ae1c374aab4a09aa90e65efe1a3aad4e279b.tar.gz"],
)
http_archive(
name = "net_zlib",
build_file = "//:third_party/zlib.BUILD",
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11",
urls = ["https://zlib.net/zlib-1.2.11.tar.gz"],
)
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
bind(
name = "zlib",
actual = "@net_zlib//:zlib",
)
protobuf_deps()
load("@bazel_skylib//lib:versions.bzl", "versions")
versions.check(minimum_bazel_version = "0.5.4")

@ -0,0 +1,20 @@
"""Load dependencies needed to compile the protobuf library as a 3rd-party consumer."""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def protobuf_deps():
"""Loads common dependencies needed to compile the protobuf library."""
native.bind(
name = "zlib",
actual = "@net_zlib//:zlib",
)
if "net_zlib" not in native.existing_rules():
http_archive(
name = "net_zlib",
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11",
urls = ["https://zlib.net/zlib-1.2.11.tar.gz"],
)
Loading…
Cancel
Save