aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Kiril Gorovoy <kgorovoy@google.com>2017-01-12 17:05:22 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-01-12 17:23:48 -0800
commit4f6e6eb285e0e925271d632cc688811ca4e8c5a2 (patch)
tree22fcc77bfa41c6b9c2736ed84e1b3ce73c487a9f
parent1013cee707d664e5122084e5fcaf162d168e1dea (diff)
Temporary fix of bazel dependencies when including TensorFlow as a submodule. Undo change when this use-case is supported in native.http_archive in Bazel.
Change: 144390772
-rw-r--r--tensorflow/workspace.bzl21
-rw-r--r--third_party/jpeg/jpeg.BUILD2
2 files changed, 21 insertions, 2 deletions
diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl
index 06f9ca88a7..21557822f4 100644
--- a/tensorflow/workspace.bzl
+++ b/tensorflow/workspace.bzl
@@ -34,6 +34,24 @@ def check_version(bazel_version):
native.bazel_version, bazel_version))
pass
+# Temporary workaround to support including TensorFlow as a submodule until this
+# use-case is supported in the next Bazel release.
+def _temp_workaround_http_archive_impl(repo_ctx):
+ repo_ctx.template("BUILD", repo_ctx.attr.build_file,
+ {"%ws%": repo_ctx.attr.repository}, False)
+ repo_ctx.download_and_extract(repo_ctx.attr.urls, "", repo_ctx.attr.sha256,
+ "", repo_ctx.attr.strip_prefix)
+
+temp_workaround_http_archive = repository_rule(
+ implementation=_temp_workaround_http_archive_impl,
+ attrs = {
+ "build_file": attr.label(),
+ "repository": attr.string(),
+ "urls": attr.string_list(default = []),
+ "sha256": attr.string(default = ""),
+ "strip_prefix": attr.string(default = ""),
+ })
+
# If TensorFlow is linked as a submodule.
# path_prefix and tf_repo_name are no longer used.
def tf_workspace(path_prefix = "", tf_repo_name = ""):
@@ -128,7 +146,7 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
build_file = str(Label("//third_party:nasm.BUILD")),
)
- native.new_http_archive(
+ temp_workaround_http_archive(
name = "jpeg",
urls = [
"http://bazel-mirror.storage.googleapis.com/github.com/libjpeg-turbo/libjpeg-turbo/archive/1.5.1.tar.gz",
@@ -137,6 +155,7 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
sha256 = "c15a9607892113946379ccea3ca8b85018301b200754f209453ab21674268e77",
strip_prefix = "libjpeg-turbo-1.5.1",
build_file = str(Label("//third_party/jpeg:jpeg.BUILD")),
+ repository = tf_repo_name,
)
native.new_http_archive(
diff --git a/third_party/jpeg/jpeg.BUILD b/third_party/jpeg/jpeg.BUILD
index 37401b41d0..78e03eadcf 100644
--- a/third_party/jpeg/jpeg.BUILD
+++ b/third_party/jpeg/jpeg.BUILD
@@ -5,7 +5,7 @@ licenses(["notice"]) # custom notice-style license, see LICENSE.md
exports_files(["LICENSE.md"])
-load("@//third_party:common.bzl", "template_rule")
+load("@%ws%//third_party:common.bzl", "template_rule")
libjpegturbo_nocopts = "-[W]error"