Remove temp_workaround_http_archive.

PiperOrigin-RevId: 177230105
This commit is contained in:
Michael Case 2017-11-28 15:45:09 -08:00 committed by TensorFlower Gardener
parent b8969d12f9
commit 5a1e22b753
9 changed files with 51 additions and 89 deletions

View File

@ -57,33 +57,6 @@ def check_version(bazel_version):
fail("\nCurrent Bazel version is {}, expected at least {}\n".format(
native.bazel_version, bazel_version))
def _repos_are_siblings():
return Label("@foo//bar").workspace_root.startswith("../")
# 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, {
"%prefix%": ".." if _repos_are_siblings() else "external",
"%ws%": repo_ctx.attr.repository
}, False)
repo_ctx.download_and_extract(repo_ctx.attr.urls, "", repo_ctx.attr.sha256,
"", repo_ctx.attr.strip_prefix)
if repo_ctx.attr.patch_file != None:
_apply_patch(repo_ctx, repo_ctx.attr.patch_file)
temp_workaround_http_archive = repository_rule(
attrs = {
"build_file": attr.label(),
"repository": attr.string(),
"patch_file": attr.label(default = None),
"urls": attr.string_list(default = []),
"sha256": attr.string(default = ""),
"strip_prefix": attr.string(default = ""),
},
implementation = _temp_workaround_http_archive_impl,
)
# Executes specified command with arguments and calls 'fail' if it exited with
# non-zero code
def _execute_and_check_ret_code(repo_ctx, cmd_and_args):
@ -121,8 +94,6 @@ def _patched_http_archive_impl(repo_ctx):
patched_http_archive = repository_rule(
attrs = {
"patch_file": attr.label(),
"build_file": attr.label(),
"repository": attr.string(),
"urls": attr.string_list(default = []),
"sha256": attr.string(default = ""),
"strip_prefix": attr.string(default = ""),
@ -157,7 +128,6 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
sha256 = "57ba56c4c243f403ff78f417ff854ef50b9eddf4a610a917b7c95e7fa8553a4b",
strip_prefix = "mklml_lnx_2018.0.20170720",
build_file = str(Label("//third_party/mkl:mkl.BUILD")),
repository = tf_repo_name,
)
if path_prefix:
@ -292,7 +262,7 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
build_file = str(Label("//third_party:nasm.BUILD")),
)
temp_workaround_http_archive(
native.new_http_archive(
name = "jpeg",
urls = [
"https://mirror.bazel.build/github.com/libjpeg-turbo/libjpeg-turbo/archive/1.5.1.tar.gz",
@ -301,7 +271,6 @@ 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(
@ -502,7 +471,7 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
build_file = str(Label("//third_party:swig.BUILD")),
)
temp_workaround_http_archive(
native.new_http_archive(
name = "curl",
sha256 = "ff3e80c1ca6a068428726cd7dd19037a47cc538ce58ef61c59587191039b2ca6",
urls = [
@ -511,7 +480,6 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
],
strip_prefix = "curl-7.49.1",
build_file = str(Label("//third_party:curl.BUILD")),
repository = tf_repo_name
)
# grpc expects //external:protobuf_clib and //external:protobuf_compiler
@ -575,7 +543,7 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
# TODO(phawkins): currently, this rule uses an unofficial LLVM mirror.
# Switch to an official source of snapshots if/when possible.
temp_workaround_http_archive(
native.new_http_archive(
name = "llvm",
urls = [
"https://mirror.bazel.build/github.com/llvm-mirror/llvm/archive/9ab4c272cb604a7f947865428c4ef2169fee2100.tar.gz",
@ -584,7 +552,6 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
sha256 = "1b1b7d3800a94ca2302e3dd670dbe84238749583027883784b55297059d83da8",
strip_prefix = "llvm-9ab4c272cb604a7f947865428c4ef2169fee2100",
build_file = str(Label("//third_party/llvm:llvm.BUILD")),
repository = tf_repo_name,
)
native.new_http_archive(
@ -650,7 +617,7 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
build_file = str(Label("//third_party/fft2d:fft2d.BUILD")),
)
temp_workaround_http_archive(
native.new_http_archive(
name = "snappy",
urls = [
"https://mirror.bazel.build/github.com/google/snappy/archive/1.1.4.tar.gz",
@ -659,10 +626,9 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
sha256 = "2f7504c73d85bac842e893340333be8cb8561710642fc9562fccdd9d2c3fcc94",
strip_prefix = "snappy-1.1.4",
build_file = str(Label("//third_party:snappy.BUILD")),
repository = tf_repo_name,
)
temp_workaround_http_archive(
native.new_http_archive(
name = "nccl_archive",
urls = [
"https://mirror.bazel.build/github.com/nvidia/nccl/archive/03d856977ecbaac87e598c0c4bafca96761b9ac7.tar.gz",
@ -671,10 +637,9 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
sha256 = "2ca86fb6179ecbff789cc67c836139c1bbc0324ed8c04643405a30bf26325176",
strip_prefix = "nccl-03d856977ecbaac87e598c0c4bafca96761b9ac7",
build_file = str(Label("//third_party:nccl.BUILD")),
repository = tf_repo_name,
)
temp_workaround_http_archive(
native.new_http_archive(
name = "aws",
urls = [
"https://mirror.bazel.build/github.com/aws/aws-sdk-cpp/archive/1.0.90.tar.gz",
@ -683,7 +648,6 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
sha256 = "f599b57aec4f03ad696044dd430b2d201864113937353adc346f53ad47991319",
strip_prefix = "aws-sdk-cpp-1.0.90",
build_file = str(Label("//third_party:aws.BUILD")),
repository = tf_repo_name
)
java_import_external(
@ -711,7 +675,7 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
testonly_ = True,
)
temp_workaround_http_archive(
native.new_http_archive(
name = "jemalloc",
urls = [
"https://mirror.bazel.build/github.com/jemalloc/jemalloc/archive/4.4.0.tar.gz",
@ -720,7 +684,6 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
sha256 = "3c8f25c02e806c3ce0ab5fb7da1817f89fc9732709024e2a81b6b82f7cc792a8",
strip_prefix = "jemalloc-4.4.0",
build_file = str(Label("//third_party:jemalloc.BUILD")),
repository = tf_repo_name,
)
java_import_external(

16
third_party/aws.BUILD vendored
View File

@ -7,21 +7,21 @@ licenses(["notice"]) # Apache 2.0
exports_files(["LICENSE"])
load("@%ws%//third_party:common.bzl", "template_rule")
load("@org_tensorflow//third_party:common.bzl", "template_rule")
cc_library(
name = "aws",
srcs = select({
"@%ws%//tensorflow:linux_x86_64": glob([
"@org_tensorflow//tensorflow:linux_x86_64": glob([
"aws-cpp-sdk-core/source/platform/linux-shared/*.cpp",
]),
"@%ws%//tensorflow:darwin": glob([
"@org_tensorflow//tensorflow:darwin": glob([
"aws-cpp-sdk-core/source/platform/linux-shared/*.cpp",
]),
"@%ws%//tensorflow:linux_ppc64le": glob([
"@org_tensorflow//tensorflow:linux_ppc64le": glob([
"aws-cpp-sdk-core/source/platform/linux-shared/*.cpp",
]),
"@%ws%//tensorflow:raspberry_pi_armeabi": glob([
"@org_tensorflow//tensorflow:raspberry_pi_armeabi": glob([
"aws-cpp-sdk-core/source/platform/linux-shared/*.cpp",
]),
"//conditions:default": [],
@ -53,17 +53,17 @@ cc_library(
"aws-cpp-sdk-core/include/aws/core/SDKConfig.h",
],
defines = select({
"@%ws%//tensorflow:linux_x86_64": [
"@org_tensorflow//tensorflow:linux_x86_64": [
"PLATFORM_LINUX",
"ENABLE_CURL_CLIENT",
"ENABLE_NO_ENCRYPTION",
],
"@%ws%//tensorflow:darwin": [
"@org_tensorflow//tensorflow:darwin": [
"PLATFORM_APPLE",
"ENABLE_CURL_CLIENT",
"ENABLE_NO_ENCRYPTION",
],
"@%ws%//tensorflow:linux_ppc64le": [
"@org_tensorflow//tensorflow:linux_ppc64le": [
"PLATFORM_LINUX",
"ENABLE_CURL_CLIENT",
"ENABLE_NO_ENCRYPTION",

View File

@ -6,7 +6,7 @@ licenses(["notice"]) # MIT/X derivative license
exports_files(["COPYING"])
CURL_WIN_COPTS = [
"/I%prefix%/curl/lib",
"/Iexternal/curl/lib",
"/DHAVE_CONFIG_H",
"/DCURL_DISABLE_FTP",
"/DCURL_DISABLE_NTLM",
@ -224,14 +224,14 @@ cc_library(
"lib/wildcard.h",
"lib/x509asn1.h",
] + select({
"@%ws%//tensorflow:darwin": [
"@org_tensorflow//tensorflow:darwin": [
"lib/vtls/darwinssl.c",
],
"@%ws%//tensorflow:ios": [
"@org_tensorflow//tensorflow:ios": [
"lib/vtls/darwinssl.c",
],
"@%ws%//tensorflow:windows": CURL_WIN_SRCS,
"@%ws%//tensorflow:windows_msvc": CURL_WIN_SRCS,
"@org_tensorflow//tensorflow:windows": CURL_WIN_SRCS,
"@org_tensorflow//tensorflow:windows_msvc": CURL_WIN_SRCS,
"//conditions:default": [
"lib/vtls/openssl.c",
],
@ -248,10 +248,10 @@ cc_library(
"include/curl/typecheck-gcc.h",
],
copts = select({
"@%ws%//tensorflow:windows": CURL_WIN_COPTS,
"@%ws%//tensorflow:windows_msvc": CURL_WIN_COPTS,
"@org_tensorflow//tensorflow:windows": CURL_WIN_COPTS,
"@org_tensorflow//tensorflow:windows_msvc": CURL_WIN_COPTS,
"//conditions:default": [
"-I%prefix%/curl/lib",
"-Iexternal/curl/lib",
"-D_GNU_SOURCE",
"-DHAVE_CONFIG_H",
"-DCURL_DISABLE_FTP",
@ -261,14 +261,14 @@ cc_library(
"-Wno-string-plus-int",
],
}) + select({
"@%ws%//tensorflow:darwin": [
"@org_tensorflow//tensorflow:darwin": [
"-fno-constant-cfstrings",
],
"@%ws%//tensorflow:windows": [
"@org_tensorflow//tensorflow:windows": [
# See curl.h for discussion of write size and Windows
"/DCURL_MAX_WRITE_SIZE=16384",
],
"@%ws%//tensorflow:windows_msvc": [
"@org_tensorflow//tensorflow:windows_msvc": [
# See curl.h for discussion of write size and Windows
"/DCURL_MAX_WRITE_SIZE=16384",
],
@ -278,20 +278,20 @@ cc_library(
}),
includes = ["include"],
linkopts = select({
"@%ws%//tensorflow:android": [
"@org_tensorflow//tensorflow:android": [
"-pie",
],
"@%ws%//tensorflow:darwin": [
"@org_tensorflow//tensorflow:darwin": [
"-Wl,-framework",
"-Wl,CoreFoundation",
"-Wl,-framework",
"-Wl,Security",
],
"@%ws%//tensorflow:ios": [],
"@%ws%//tensorflow:windows": [
"@org_tensorflow//tensorflow:ios": [],
"@org_tensorflow//tensorflow:windows": [
"-Wl,ws2_32.lib",
],
"@%ws%//tensorflow:windows_msvc": [
"@org_tensorflow//tensorflow:windows_msvc": [
"-Wl,ws2_32.lib",
],
"//conditions:default": [
@ -302,9 +302,9 @@ cc_library(
deps = [
"@zlib_archive//:zlib",
] + select({
"@%ws%//tensorflow:ios": [],
"@%ws%//tensorflow:windows": [],
"@%ws%//tensorflow:windows_msvc": [],
"@org_tensorflow//tensorflow:ios": [],
"@org_tensorflow//tensorflow:windows": [],
"@org_tensorflow//tensorflow:windows_msvc": [],
"//conditions:default": [
"@boringssl//:ssl",
],
@ -312,7 +312,7 @@ cc_library(
)
CURL_BIN_WIN_COPTS = [
"/I%prefix%/curl/lib",
"/Iexternal/curl/lib",
"/DHAVE_CONFIG_H",
"/DCURL_DISABLE_LIBCURL_OPTION",
]
@ -406,10 +406,10 @@ cc_binary(
"src/tool_xattr.h",
],
copts = select({
"@%ws%//tensorflow:windows": CURL_BIN_WIN_COPTS,
"@%ws%//tensorflow:windows_msvc": CURL_BIN_WIN_COPTS,
"@org_tensorflow//tensorflow:windows": CURL_BIN_WIN_COPTS,
"@org_tensorflow//tensorflow:windows_msvc": CURL_BIN_WIN_COPTS,
"//conditions:default": [
"-I%prefix%/curl/lib",
"-Iexternal/curl/lib",
"-D_GNU_SOURCE",
"-DHAVE_CONFIG_H",
"-DCURL_DISABLE_LIBCURL_OPTION",

View File

@ -21,7 +21,7 @@ cc_library(
],
hdrs = ["lib/gif_lib.h"],
defines = select({
#"@%ws%//tensorflow:android": [
#"@org_tensorflow//tensorflow:android": [
":android": [
"S_IREAD=S_IRUSR",
"S_IWRITE=S_IWUSR",

View File

@ -5,7 +5,7 @@ licenses(["notice"]) # BSD
exports_files(["COPYING"])
load("@%ws%//third_party:common.bzl", "template_rule")
load("@org_tensorflow//third_party:common.bzl", "template_rule")
cc_library(
name = "jemalloc_headers",
@ -97,10 +97,10 @@ cc_library(
includes = ["include"],
# pthread_atfork() is called for PPC.
linkopts = select({
"@%ws%//tensorflow:linux_ppc64le": [
"@org_tensorflow//tensorflow:linux_ppc64le": [
"-lpthread",
],
"@%ws%//tensorflow:linux_x86_64": [
"@org_tensorflow//tensorflow:linux_x86_64": [
"-lpthread",
],
"//conditions:default": [
@ -208,8 +208,8 @@ genrule(
name = "size_classes_h",
outs = ["include/jemalloc/internal/size_classes.h"],
cmd = select({
"@%ws%//tensorflow:linux_ppc64le": "$(location :size_classes_sh) \"3 4\" 3 16 2 >$@",
"@%ws%//tensorflow:linux_x86_64": "$(location :size_classes_sh) \"3 4\" 3 12 2 >$@",
"@org_tensorflow//tensorflow:linux_ppc64le": "$(location :size_classes_sh) \"3 4\" 3 16 2 >$@",
"@org_tensorflow//tensorflow:linux_x86_64": "$(location :size_classes_sh) \"3 4\" 3 12 2 >$@",
"//conditions:default": "$(location :size_classes_sh) \"3 4\" 3 12 2 >$@",
}),
tools = [":size_classes_sh"],

View File

@ -5,7 +5,7 @@ licenses(["notice"]) # custom notice-style license, see LICENSE.md
exports_files(["LICENSE.md"])
load("@%ws%//third_party:common.bzl", "template_rule")
load("@org_tensorflow//third_party:common.bzl", "template_rule")
libjpegturbo_nocopts = "-[W]error"

View File

@ -60,7 +60,6 @@ mkl_repository = repository_rule(
],
attrs = {
"build_file": attr.label(),
"repository": attr.string(),
"urls": attr.string_list(default = []),
"sha256": attr.string(default = ""),
"strip_prefix": attr.string(default = ""),

View File

@ -44,17 +44,17 @@ cc_library(
"-O3",
] + cuda_default_copts(),
linkopts = select({
"@%ws%//tensorflow:android": [
"@org_tensorflow//tensorflow:android": [
"-pie",
],
"@%ws%//tensorflow:darwin": [
"@org_tensorflow//tensorflow:darwin": [
"-Wl,-framework",
"-Wl,CoreFoundation",
"-Wl,-framework",
"-Wl,Security",
],
"@%ws%//tensorflow:ios": [],
"@%ws%//tensorflow:windows": [
"@org_tensorflow//tensorflow:ios": [],
"@org_tensorflow//tensorflow:windows": [
"ws2_32.lib",
],
"//conditions:default": [

View File

@ -50,8 +50,8 @@ genrule(
"-e 's/@ac_cv_have_stddef_h@/1/g' " +
"-e 's/@ac_cv_have_stdint_h@/1/g' " +
select({
"@%ws%//tensorflow:windows": "-e 's/@ac_cv_have_sys_uio_h@/0/g' ",
"@%ws%//tensorflow:windows_msvc": "-e 's/@ac_cv_have_sys_uio_h@/0/g' ",
"@org_tensorflow//tensorflow:windows": "-e 's/@ac_cv_have_sys_uio_h@/0/g' ",
"@org_tensorflow//tensorflow:windows_msvc": "-e 's/@ac_cv_have_sys_uio_h@/0/g' ",
"//conditions:default": "-e 's/@ac_cv_have_sys_uio_h@/1/g' ",
}) +
"-e 's/@SNAPPY_MAJOR@/1/g' " +