message: [bazel] Use tmp dir for intermediate NVCC source files
  * When using the local cuda cross-compilation toolchain,
  header file changes to cc_library would not trigger rebuilds for
  dependent cc_binary rules.
diff: @@ -144,13 +144,20 @@ def _get_python_bin(repository_ctx):
  def _get_nvcc_tmp_dir_for_windows(repository_ctx):
  - """Return the tmp directory for nvcc to generate intermediate source files."""
  + """Return the Windows tmp directory for nvcc to generate intermediate source files."""
  escaped_tmp_dir = escape_string(
  get_env_var(repository_ctx, "TMP", "C:\\Windows\\Temp").replace(
  "\\", "\\\\"),)
  return escaped_tmp_dir + "\\\\nvcc_inter_files_tmp_dir"
  +def _get_nvcc_tmp_dir_for_unix(repository_ctx):
  + """Return the UNIX tmp directory for nvcc to generate intermediate source files."""
  + escaped_tmp_dir = escape_string(
  + get_env_var(repository_ctx, "TMPDIR", "/tmp"))
  + return escaped_tmp_dir + "/nvcc_inter_files_tmp_dir"
  +
  +
  def _get_msvc_compiler(repository_ctx):
  vc_path = find_vc_path(repository_ctx)
  return find_msvc_tool(repository_ctx, vc_path, "cl.exe").replace("\\", "/")
  @@ -162,6 +169,8 @@ def _get_win_cuda_defines(repository_ctx):
  # If we are not on Windows, return empty vaules for Windows specific fields.
  # This ensures the CROSSTOOL file parser is happy.
  if not _is_windows(repository_ctx):
  + escaped_cxx_include_directory = \
  + "cxx_builtin_include_directory: \"%s\"" % _get_nvcc_tmp_dir_for_unix(repository_ctx)
  return {
  "%{msvc_env_tmp}": "",
  "%{msvc_env_path}": "",
  @@ -171,7 +180,7 @@ def _get_win_cuda_defines(repository_ctx):
  "%{msvc_ml_path}": "",
  "%{msvc_link_path}": "",
  "%{msvc_lib_path}": "",
  - "%{cxx_builtin_include_directory}": "",
  + "%{cxx_builtin_include_directory}": escaped_cxx_include_directory,
  }
  vc_path = find_vc_path(repository_ctx)
  