From 77da168dbc0d2324a8cf75a0933924eac2eab39f Mon Sep 17 00:00:00 2001 From: Kiril Gorovoy <kgorovoy@google.com> Date: Wed, 24 Feb 2016 18:02:16 -0800 Subject: [PATCH] Move all Tensorflow WORKSPACE rules to a skylark macro Change: 115515678 --- WORKSPACE | 57 +----------------- .../core/platform/default/build_config.bzl | 2 +- tensorflow/core/platform/posix/test.cc | 2 + tensorflow/workspace.bzl | 58 +++++++++++++++++++ 4 files changed, 63 insertions(+), 56 deletions(-) create mode 100644 tensorflow/workspace.bzl diff --git a/WORKSPACE b/WORKSPACE index 22133c5dfc6..7c9a9a60013 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -12,61 +12,8 @@ # path="<PATH_TO_NDK>", # api_level=21) -new_http_archive( - name = "gmock_archive", - url = "https://googlemock.googlecode.com/files/gmock-1.7.0.zip", - sha256 = "26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b", - build_file = "google/protobuf/gmock.BUILD", -) - -new_http_archive( - name = "eigen_archive", - url = "https://bitbucket.org/eigen/eigen/get/ed4c9730b545.tar.gz", - sha256 = "3d9eceb8a2add299e37b1f32759157cc2574f7684936c151552a5ae3f33aebd5", - build_file = "eigen.BUILD", -) - -bind( - name = "gtest", - actual = "@gmock_archive//:gtest", -) - -bind( - name = "gtest_main", - actual = "@gmock_archive//:gtest_main", -) - -git_repository( - name = "re2", - remote = "https://github.com/google/re2.git", - commit = "791beff", -) - -new_http_archive( - name = "jpeg_archive", - url = "http://www.ijg.org/files/jpegsrc.v9a.tar.gz", - sha256 = "3a753ea48d917945dd54a2d97de388aa06ca2eb1066cbfdc6652036349fe05a7", - build_file = "jpeg.BUILD", -) - -new_http_archive( - name = "png_archive", - url = "https://storage.googleapis.com/libpng-public-archive/libpng-1.2.53.tar.gz", - sha256 = "e05c9056d7f323088fd7824d8c6acc03a4a758c4b4916715924edc5dd3223a72", - build_file = "png.BUILD", -) - -new_http_archive( - name = "six_archive", - url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55", - sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", - build_file = "six.BUILD", -) - -bind( - name = "six", - actual = "@six_archive//:six", -) +load("//tensorflow:workspace.bzl", "tf_workspace") +tf_workspace() # TENSORBOARD_BOWER_AUTOGENERATED_BELOW_THIS_LINE_DO_NOT_EDIT diff --git a/tensorflow/core/platform/default/build_config.bzl b/tensorflow/core/platform/default/build_config.bzl index 9082104fe9a..efee64a7a84 100644 --- a/tensorflow/core/platform/default/build_config.bzl +++ b/tensorflow/core/platform/default/build_config.bzl @@ -71,7 +71,7 @@ def tf_additional_test_deps(): return [] def tf_additional_test_srcs(): - return ["platform/default/test_benchmark.cc"] + return ["platform/default/test_benchmark.cc", "platform/posix/test.cc"] def tf_kernel_tests_linkstatic(): return 0 diff --git a/tensorflow/core/platform/posix/test.cc b/tensorflow/core/platform/posix/test.cc index 366aa0fd537..26218a49538 100644 --- a/tensorflow/core/platform/posix/test.cc +++ b/tensorflow/core/platform/posix/test.cc @@ -23,6 +23,8 @@ limitations under the License. #include <sys/types.h> #include <unistd.h> +#include "tensorflow/core/platform/logging.h" + namespace tensorflow { namespace testing { diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl new file mode 100644 index 00000000000..5c8e4f34ba6 --- /dev/null +++ b/tensorflow/workspace.bzl @@ -0,0 +1,58 @@ +# Tensorflow external dependencies that can be loaded in WORKSPACE files. + +def tf_workspace(path_prefix = ""): + native.new_http_archive( + name = "gmock_archive", + url = "https://googlemock.googlecode.com/files/gmock-1.7.0.zip", + sha256 = "26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b", + build_file = path_prefix + "google/protobuf/gmock.BUILD", + ) + + native.new_http_archive( + name = "eigen_archive", + url = "https://bitbucket.org/eigen/eigen/get/ed4c9730b545.tar.gz", + sha256 = "3d9eceb8a2add299e37b1f32759157cc2574f7684936c151552a5ae3f33aebd5", + build_file = path_prefix + "eigen.BUILD", + ) + + native.bind( + name = "gtest", + actual = "@gmock_archive//:gtest", + ) + + native.bind( + name = "gtest_main", + actual = "@gmock_archive//:gtest_main", + ) + + native.git_repository( + name = "re2", + remote = "https://github.com/google/re2.git", + commit = "791beff", + ) + + native.new_http_archive( + name = "jpeg_archive", + url = "http://www.ijg.org/files/jpegsrc.v9a.tar.gz", + sha256 = "3a753ea48d917945dd54a2d97de388aa06ca2eb1066cbfdc6652036349fe05a7", + build_file = path_prefix + "jpeg.BUILD", + ) + + native.new_http_archive( + name = "png_archive", + url = "https://storage.googleapis.com/libpng-public-archive/libpng-1.2.53.tar.gz", + sha256 = "e05c9056d7f323088fd7824d8c6acc03a4a758c4b4916715924edc5dd3223a72", + build_file = path_prefix + "png.BUILD", + ) + + native.new_http_archive( + name = "six_archive", + url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55", + sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", + build_file = path_prefix + "six.BUILD", + ) + + native.bind( + name = "six", + actual = "@six_archive//:six", + )