diff options
Diffstat (limited to 'tensorflow/BUILD')
-rw-r--r-- | tensorflow/BUILD | 103 |
1 files changed, 75 insertions, 28 deletions
diff --git a/tensorflow/BUILD b/tensorflow/BUILD index 768d4107d8..c8e24e3aff 100644 --- a/tensorflow/BUILD +++ b/tensorflow/BUILD @@ -12,6 +12,7 @@ exports_files([ # The leakr files are used by //third_party/cloud_tpu. "leakr_badwords.dic", "leakr_badfiles.dic", + "leakr_file_type_recipe.ftrcp", ]) load("//tensorflow:tensorflow.bzl", "tf_cc_shared_object") @@ -23,6 +24,11 @@ load( "//tensorflow/python/tools/api/generator:api_gen.bzl", "gen_api_init_files", # @unused ) +load("//tensorflow/python/tools/api/generator:api_gen.bzl", "get_compat_files") +load( + "//tensorflow/python/tools/api/generator:api_init_files.bzl", + "TENSORFLOW_API_INIT_FILES", # @unused +) load( "//tensorflow/python/tools/api/generator:api_init_files_v1.bzl", "TENSORFLOW_API_INIT_FILES_V1", # @unused @@ -32,6 +38,11 @@ load( "if_ngraph", ) +# @unused +TENSORFLOW_API_INIT_FILES_V2 = ( + TENSORFLOW_API_INIT_FILES + get_compat_files(TENSORFLOW_API_INIT_FILES_V1, 1) +) + # Config setting used when building for products # which requires restricted licenses to be avoided. config_setting( @@ -427,6 +438,13 @@ config_setting( visibility = ["//visibility:public"], ) +# This flag specifies whether TensorFlow 2.0 API should be built instead +# of 1.* API. Note that TensorFlow 2.0 API is currently under development. +config_setting( + name = "api_version_2", + define_values = {"tf_api_version": "2"}, +) + package_group( name = "internal", packages = [ @@ -590,34 +608,6 @@ exports_files( ], ) -gen_api_init_files( - name = "tensorflow_python_api_gen", - srcs = ["api_template.__init__.py"], - api_version = 1, - output_files = TENSORFLOW_API_INIT_FILES_V1, - root_init_template = "api_template.__init__.py", -) - -py_library( - name = "tensorflow_py", - srcs = ["//tensorflow/python/estimator/api:estimator_python_api_gen"], - srcs_version = "PY2AND3", - visibility = ["//visibility:public"], - deps = [ - ":tensorflow_py_no_contrib", - "//tensorflow/contrib:contrib_py", - "//tensorflow/python/estimator:estimator_py", - ], -) - -py_library( - name = "tensorflow_py_no_contrib", - srcs = [":tensorflow_python_api_gen"], - srcs_version = "PY2AND3", - visibility = ["//visibility:public"], - deps = ["//tensorflow/python:no_contrib"], -) - genrule( name = "install_headers", srcs = [ @@ -645,3 +635,60 @@ genrule( tags = ["manual"], visibility = ["//visibility:public"], ) + +genrule( + name = "root_init_gen", + srcs = select({ + "api_version_2": [":tf_python_api_gen_v2"], + "//conditions:default": [":tf_python_api_gen_v1"], + }), + outs = ["__init__.py"], + cmd = select({ + "api_version_2": "cp $(@D)/_api/v2/__init__.py $(OUTS)", + "//conditions:default": "cp $(@D)/_api/v1/__init__.py $(OUTS)", + }), +) + +gen_api_init_files( + name = "tf_python_api_gen_v1", + srcs = ["api_template.__init__.py"], + api_version = 1, + output_dir = "_api/v1/", + output_files = TENSORFLOW_API_INIT_FILES_V1, + output_package = "tensorflow._api.v1", + root_init_template = "api_template.__init__.py", +) + +gen_api_init_files( + name = "tf_python_api_gen_v2", + srcs = ["api_template.__init__.py"], + api_version = 2, + compat_api_versions = [1], + output_dir = "_api/v2/", + output_files = TENSORFLOW_API_INIT_FILES_V2, + output_package = "tensorflow._api.v2", + root_init_template = "api_template.__init__.py", +) + +py_library( + name = "tensorflow_py", + srcs = ["//tensorflow/python/estimator/api:estimator_python_api_gen"], + srcs_version = "PY2AND3", + visibility = ["//visibility:public"], + deps = [ + ":tensorflow_py_no_contrib", + "//tensorflow/contrib:contrib_py", + "//tensorflow/python/estimator:estimator_py", + ], +) + +py_library( + name = "tensorflow_py_no_contrib", + srcs = select({ + "api_version_2": [":tf_python_api_gen_v2"], + "//conditions:default": [":tf_python_api_gen_v1"], + }) + [":root_init_gen"], + srcs_version = "PY2AND3", + visibility = ["//visibility:public"], + deps = ["//tensorflow/python:no_contrib"], +) |