From b0d432dcc8c52177ebbaeb3a74d488f0af702f21 Mon Sep 17 00:00:00 2001 From: lissyx Date: Fri, 2 Feb 2018 03:03:31 +0100 Subject: Force sorting of CUDA and Python headers to avoid spurious rebuilds (#16586) If one does try to re-use Bazel cache of a TensorFlow CUDA-enabled or Python-enabled build, then it might happen that readdir() syscall behind the use of find in _read_dir() will generate a different ordering of the very same list of headers. This will make new genrules for symlinking the CUDA headers and in the end it will result in different actionKey computed by Bazel, hence invalidating the action cache. Fixes #16585 --- third_party/py/python_configure.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'third_party/py') diff --git a/third_party/py/python_configure.bzl b/third_party/py/python_configure.bzl index c16eb3a12a..954f21f5f8 100644 --- a/third_party/py/python_configure.bzl +++ b/third_party/py/python_configure.bzl @@ -118,7 +118,7 @@ def _symlink_genrule_for_dir(repository_ctx, src_dir, dest_dir, genrule_name, if src_dir != None: src_dir = _norm_path(src_dir) dest_dir = _norm_path(dest_dir) - files = _read_dir(repository_ctx, src_dir) + files = '\n'.join(sorted(_read_dir(repository_ctx, src_dir).splitlines())) # Create a list with the src_dir stripped to use for outputs. dest_files = files.replace(src_dir, '').splitlines() src_files = files.splitlines() -- cgit v1.2.3