From b41fbcbf851bce1fcf462ad8f251756d9a6e166e Mon Sep 17 00:00:00 2001 From: Brian Zhao Date: Sun, 8 Dec 2019 08:45:59 -0800 Subject: [PATCH] Expand the globs for legacy_srcs_no_runtime and legacy_srcs_no_runtime_google, and extract their common files into a single filegroup. This change helps prepare for a subsequent change adding BUILD files to tf/core/platform/default and tf/core/platform/windows. This change is part of the Tensorflow Build Improvements RFC described here: https://github.com/tensorflow/community/pull/179 PiperOrigin-RevId: 284436373 Change-Id: I695ef8042388ad2bc17c763b87f4f7d0e189cd74 --- tensorflow/core/platform/BUILD | 217 ++++++++++++------ .../core/platform/default/build_refactor.bzl | 3 + 2 files changed, 151 insertions(+), 69 deletions(-) diff --git a/tensorflow/core/platform/BUILD b/tensorflow/core/platform/BUILD index d30a343128a..94657280223 100644 --- a/tensorflow/core/platform/BUILD +++ b/tensorflow/core/platform/BUILD @@ -20,6 +20,7 @@ load( load( "//tensorflow/core/platform:default/build_refactor.bzl", "tf_instantiate_platform_libraries", + "tf_legacy_srcs_no_runtime_google", "tf_logging_deps", "tf_mobile_aware_deps", "tf_monitoring_deps", @@ -767,82 +768,160 @@ filegroup( visibility = ["//tensorflow/core:__pkg__"], ) +# These are the files in common between :legacy_srcs_no_runtime +# and :legacy_srcs_no_runtime_google +# These files as basically all the headers + cc files under tensorflow/core/platform, +# excluding any test sources, testing utilities, cuda, rocm, stream_executor, +# image headers (gif.h, jpeg.h, png.h), and certain translation units ( +# env_time.cc, logging.cc, logger.cc, mutex.cc) that would cause collisions +# with :platform_base, a common dependency for downstream targets. +filegroup( + name = "legacy_srcs_common", + srcs = [ + "//tensorflow/core/platform:abi.cc", + "//tensorflow/core/platform:abi.h", + "//tensorflow/core/platform:base64.cc", + "//tensorflow/core/platform:base64.h", + "//tensorflow/core/platform:blocking_counter.h", + "//tensorflow/core/platform:byte_order.h", + "//tensorflow/core/platform:coding.cc", + "//tensorflow/core/platform:coding.h", + "//tensorflow/core/platform:context.h", + "//tensorflow/core/platform:cord.h", + "//tensorflow/core/platform:cpu_feature_guard.cc", + "//tensorflow/core/platform:cpu_feature_guard.h", + "//tensorflow/core/platform:cpu_info.cc", + "//tensorflow/core/platform:cpu_info.h", + "//tensorflow/core/platform:demangle.h", + "//tensorflow/core/platform:denormal.cc", + "//tensorflow/core/platform:denormal.h", + "//tensorflow/core/platform:dynamic_annotations.h", + "//tensorflow/core/platform:env.cc", + "//tensorflow/core/platform:env.h", + "//tensorflow/core/platform:env_time.h", + "//tensorflow/core/platform:error.cc", + "//tensorflow/core/platform:error.h", + "//tensorflow/core/platform:errors.h", + "//tensorflow/core/platform:file_statistics.h", + "//tensorflow/core/platform:file_system.cc", + "//tensorflow/core/platform:file_system.h", + "//tensorflow/core/platform:file_system_helper.cc", + "//tensorflow/core/platform:file_system_helper.h", + "//tensorflow/core/platform:fingerprint.h", + "//tensorflow/core/platform:hash.cc", + "//tensorflow/core/platform:hash.h", + "//tensorflow/core/platform:host_info.h", + "//tensorflow/core/platform:human_readable_json.h", + "//tensorflow/core/platform:init_main.h", + "//tensorflow/core/platform:load_library.h", + "//tensorflow/core/platform:logger.h", + "//tensorflow/core/platform:logging.h", + "//tensorflow/core/platform:macros.h", + "//tensorflow/core/platform:mem.h", + "//tensorflow/core/platform:monitoring.h", + "//tensorflow/core/platform:mutex.h", + "//tensorflow/core/platform:net.h", + "//tensorflow/core/platform:notification.h", + "//tensorflow/core/platform:null_file_system.h", + "//tensorflow/core/platform:numa.h", + "//tensorflow/core/platform:numbers.cc", + "//tensorflow/core/platform:numbers.h", + "//tensorflow/core/platform:path.cc", + "//tensorflow/core/platform:path.h", + "//tensorflow/core/platform:platform.h", + "//tensorflow/core/platform:platform_strings.cc", + "//tensorflow/core/platform:platform_strings.h", + "//tensorflow/core/platform:platform_strings_computed.h", + "//tensorflow/core/platform:prefetch.h", + "//tensorflow/core/platform:profile_utils/android_armv7a_cpu_utils_helper.cc", + "//tensorflow/core/platform:profile_utils/android_armv7a_cpu_utils_helper.h", + "//tensorflow/core/platform:profile_utils/clock_cycle_profiler.cc", + "//tensorflow/core/platform:profile_utils/clock_cycle_profiler.h", + "//tensorflow/core/platform:profile_utils/cpu_utils.cc", + "//tensorflow/core/platform:profile_utils/cpu_utils.h", + "//tensorflow/core/platform:profile_utils/i_cpu_utils_helper.h", + "//tensorflow/core/platform:protobuf.cc", + "//tensorflow/core/platform:protobuf.h", + "//tensorflow/core/platform:protobuf_compiler.h", + "//tensorflow/core/platform:protobuf_internal.h", + "//tensorflow/core/platform:protobuf_util.cc", + "//tensorflow/core/platform:random.cc", + "//tensorflow/core/platform:random.h", + "//tensorflow/core/platform:raw_coding.h", + "//tensorflow/core/platform:refcount.h", + "//tensorflow/core/platform:regexp.h", + "//tensorflow/core/platform:scanner.cc", + "//tensorflow/core/platform:scanner.h", + "//tensorflow/core/platform:setround.cc", + "//tensorflow/core/platform:setround.h", + "//tensorflow/core/platform:snappy.h", + "//tensorflow/core/platform:stacktrace.h", + "//tensorflow/core/platform:stacktrace_handler.h", + "//tensorflow/core/platform:status.cc", + "//tensorflow/core/platform:status.h", + "//tensorflow/core/platform:str_util.cc", + "//tensorflow/core/platform:str_util.h", + "//tensorflow/core/platform:strcat.cc", + "//tensorflow/core/platform:strcat.h", + "//tensorflow/core/platform:stream_executor_no_cuda.h", + "//tensorflow/core/platform:stringpiece.h", + "//tensorflow/core/platform:stringprintf.cc", + "//tensorflow/core/platform:stringprintf.h", + "//tensorflow/core/platform:strong_hash.h", + "//tensorflow/core/platform:subprocess.h", + "//tensorflow/core/platform:tensor_coding.cc", + "//tensorflow/core/platform:tensor_coding.h", + "//tensorflow/core/platform:test_benchmark.h", + "//tensorflow/core/platform:thread_annotations.h", + "//tensorflow/core/platform:threadpool.cc", + "//tensorflow/core/platform:threadpool.h", + "//tensorflow/core/platform:threadpool_interface.h", + "//tensorflow/core/platform:threadpool_options.h", + "//tensorflow/core/platform:tracing.cc", + "//tensorflow/core/platform:tracing.h", + "//tensorflow/core/platform:tstring.h", + "//tensorflow/core/platform:types.h", + "//tensorflow/core/platform:unbounded_work_queue.h", + ], + visibility = ["//visibility:private"], +) + filegroup( name = "legacy_srcs_no_runtime", - srcs = glob( - [ - "**/*.h", - "**/*.cc", - ], - exclude = [ - "*test.*", - "*testutil*", - "*testlib*", - "*main.cc", - "**/*test.*", - "**/*testutil*", - "**/*testlib*", - "**/*main.cc", - "**/cuda_libdevice_path.*", - # Exclude env_time and logging to avoid collisions with - # :platform_base, a common dependency for downstream targets. - "**/env_time.cc", - "**/logging.cc", - "**/mutex.cc", - "**/rocm_rocdl_path.*", - "default/test_benchmark.*", - "cuda.h", - "rocm.h", - "google/**/*", - "hadoop/**/*", - "gif.h", - "jpeg.h", - "png.h", - "logger.cc", - "stream_executor.*", - "windows/**/*", - ], - ), + srcs = [ + ":legacy_srcs_common", + "//tensorflow/core/platform:default/context.h", + "//tensorflow/core/platform:default/cord.h", + "//tensorflow/core/platform:default/dynamic_annotations.h", + "//tensorflow/core/platform:default/env.cc", + "//tensorflow/core/platform:default/human_readable_json.cc", + "//tensorflow/core/platform:default/integral_types.h", + "//tensorflow/core/platform:default/load_library.cc", + "//tensorflow/core/platform:default/logging.h", + "//tensorflow/core/platform:default/monitoring.cc", + "//tensorflow/core/platform:default/mutex.h", + "//tensorflow/core/platform:default/mutex_data.h", + "//tensorflow/core/platform:default/net.cc", + "//tensorflow/core/platform:default/notification.h", + "//tensorflow/core/platform:default/port.cc", + "//tensorflow/core/platform:default/posix_file_system.cc", + "//tensorflow/core/platform:default/posix_file_system.h", + "//tensorflow/core/platform:default/stacktrace.h", + "//tensorflow/core/platform:default/stacktrace_handler.cc", + "//tensorflow/core/platform:default/strong_hash.h", + "//tensorflow/core/platform:default/subprocess.cc", + "//tensorflow/core/platform:default/subprocess.h", + "//tensorflow/core/platform:default/tracing.cc", + "//tensorflow/core/platform:default/tracing_impl.h", + "//tensorflow/core/platform:default/unbounded_work_queue.cc", + "//tensorflow/core/platform:default/unbounded_work_queue.h", + ], visibility = ["//tensorflow/core:__pkg__"], ) filegroup( name = "legacy_srcs_no_runtime_google", - srcs = glob( - [ - "**/*.h", - "**/*.cc", - ], - exclude = [ - "*test.*", - "*testutil*", - "*testlib*", - "*main.cc", - "**/*test.*", - "**/*testutil*", - "**/*testlib*", - "**/*main.cc", - "**/cuda_libdevice_path.*", - # Exclude env_time and logging to avoid collisions with - # :platform_base, a common dependency for downstream targets. - "**/env_time.cc", - "**/logging.cc", - "**/mutex.cc", - "**/rocm_rocdl_path.*", - "google/test_benchmark.*", - "google/monitoring.*", - "cuda.h", - "rocm.h", - "default/**/*", - "hadoop/**/*", - "gif.h", - "jpeg.h", - "png.h", - "logger.cc", - "stream_executor.*", - "windows/**/*", - ], - ), + srcs = [":legacy_srcs_common"] + tf_legacy_srcs_no_runtime_google(), visibility = ["//tensorflow/core:__pkg__"], ) diff --git a/tensorflow/core/platform/default/build_refactor.bzl b/tensorflow/core/platform/default/build_refactor.bzl index 906e97070ce..76033a880ae 100644 --- a/tensorflow/core/platform/default/build_refactor.bzl +++ b/tensorflow/core/platform/default/build_refactor.bzl @@ -656,3 +656,6 @@ def tf_logging_deps(): def tf_monitoring_deps(): return [":monitoring_impl"] + +def tf_legacy_srcs_no_runtime_google(): + return []