From 4864399edba201239f5128d98567ffe75b9bd461 Mon Sep 17 00:00:00 2001 From: Gary Miguel Date: Thu, 6 Jul 2023 17:02:18 +0000 Subject: [PATCH] add .bazel suffix to all BUILD files this makes syntax highlighting, code search etc easier and is consistent Change-Id: Id1ce92b13f9a87b84ab513e36726428a61b97e6a --- cuda/private/repositories.bzl | 22 +++++++++---------- ...UILD.local_cuda => BUILD.local_cuda.bazel} | 0 ...lang => BUILD.local_toolchain_clang.bazel} | 0 ..._nvcc => BUILD.local_toolchain_nvcc.bazel} | 0 ... => BUILD.local_toolchain_nvcc_msvc.bazel} | 0 5 files changed, 11 insertions(+), 11 deletions(-) rename cuda/runtime/{BUILD.local_cuda => BUILD.local_cuda.bazel} (100%) rename cuda/templates/{BUILD.local_toolchain_clang => BUILD.local_toolchain_clang.bazel} (100%) rename cuda/templates/{BUILD.local_toolchain_nvcc => BUILD.local_toolchain_nvcc.bazel} (100%) rename cuda/templates/{BUILD.local_toolchain_nvcc_msvc => BUILD.local_toolchain_nvcc_msvc.bazel} (100%) diff --git a/cuda/private/repositories.bzl b/cuda/private/repositories.bzl index 9a29f4c7..55693407 100644 --- a/cuda/private/repositories.bzl +++ b/cuda/private/repositories.bzl @@ -50,7 +50,7 @@ def detect_cuda_toolkit(repository_ctx): # Some distributions instead put CUDA binaries in a seperate path # Manually check and redirect there when necessary - alternative = repository_ctx.path('/usr/lib/nvidia-cuda-toolkit/bin/nvcc') + alternative = repository_ctx.path("/usr/lib/nvidia-cuda-toolkit/bin/nvcc") if str(ptxas_path) == "/usr/bin/ptxas" and alternative.exists: ptxas_path = alternative cuda_path = str(ptxas_path.dirname.dirname) @@ -96,14 +96,14 @@ def detect_cuda_toolkit(repository_ctx): ) def config_cuda_toolkit_and_nvcc(repository_ctx, cuda): - """Generate `@local_cuda//BUILD` and `@local_cuda//defs.bzl` and `@local_cuda//toolchain/BUILD` + """Generate `@local_cuda//BUILD.bazel` and `@local_cuda//defs.bzl` and `@local_cuda//toolchain/BUILD.bazel` Args: repository_ctx: repository_ctx cuda: The struct returned from detect_cuda_toolkit """ - # Generate @local_cuda//BUILD and @local_cuda//defs.bzl + # Generate @local_cuda//BUILD.bazel and @local_cuda//defs.bzl defs_bzl_content = "" defs_if_local_cuda = "def if_local_cuda(if_true, if_false = []):\n return %s\n" if cuda.path != None: @@ -113,17 +113,17 @@ def config_cuda_toolkit_and_nvcc(repository_ctx, cuda): repository_ctx.symlink("/usr/lib/x86_64-linux-gnu", "cuda/lib64") else: repository_ctx.symlink(cuda.path, "cuda") - repository_ctx.symlink(Label("//cuda:runtime/BUILD.local_cuda"), "BUILD") + repository_ctx.symlink(Label("//cuda:runtime/BUILD.local_cuda.bazel"), "BUILD.bazel") defs_bzl_content += defs_if_local_cuda % "if_true" else: - repository_ctx.file("BUILD") # Empty file + repository_ctx.file("BUILD.bazel") # Empty file defs_bzl_content += defs_if_local_cuda % "if_false" repository_ctx.file("defs.bzl", defs_bzl_content) - # Generate @local_cuda//toolchain/BUILD + # Generate @local_cuda//toolchain/BUILD.bazel tpl_label = Label( "//cuda:templates/BUILD.local_toolchain_" + - ("nvcc" if _is_linux(repository_ctx) else "nvcc_msvc"), + ("nvcc" if _is_linux(repository_ctx) else "nvcc_msvc") + ".bazel", ) substitutions = { "%{cuda_path}": _to_forward_slash(cuda.path) if cuda.path else "cuda-not-found", @@ -138,7 +138,7 @@ def config_cuda_toolkit_and_nvcc(repository_ctx, cuda): env_tmp = repository_ctx.os.environ.get("TMP", repository_ctx.os.environ.get("TEMP", None)) if env_tmp != None: substitutions["%{env_tmp}"] = _to_forward_slash(env_tmp) - repository_ctx.template("toolchain/BUILD", tpl_label, substitutions = substitutions, executable = False) + repository_ctx.template("toolchain/BUILD.bazel", tpl_label, substitutions = substitutions, executable = False) def detect_clang(repository_ctx): """Detect local clang installation. @@ -171,14 +171,14 @@ def detect_clang(repository_ctx): return clang_path def config_clang(repository_ctx, cuda, clang_path): - """Generate `@local_cuda//toolchain/clang/BUILD` + """Generate `@local_cuda//toolchain/clang/BUILD.bazel` Args: repository_ctx: repository_ctx cuda: The struct returned from `detect_cuda_toolkit` clang_path: Path to clang executable returned from `detect_clang` """ - tpl_label = Label("//cuda:templates/BUILD.local_toolchain_clang") + tpl_label = Label("//cuda:templates/BUILD.local_toolchain_clang.bazel") substitutions = { "%{clang_path}": _to_forward_slash(clang_path) if clang_path else "cuda-clang-not-found", "%{cuda_path}": _to_forward_slash(cuda.path) if cuda.path else "cuda-not-found", @@ -188,7 +188,7 @@ def config_clang(repository_ctx, cuda, clang_path): "%{bin2c_label}": cuda.bin2c_label, "%{fatbinary_label}": cuda.fatbinary_label, } - repository_ctx.template("toolchain/clang/BUILD", tpl_label, substitutions = substitutions, executable = False) + repository_ctx.template("toolchain/clang/BUILD.bazel", tpl_label, substitutions = substitutions, executable = False) def _local_cuda_impl(repository_ctx): cuda = detect_cuda_toolkit(repository_ctx) diff --git a/cuda/runtime/BUILD.local_cuda b/cuda/runtime/BUILD.local_cuda.bazel similarity index 100% rename from cuda/runtime/BUILD.local_cuda rename to cuda/runtime/BUILD.local_cuda.bazel diff --git a/cuda/templates/BUILD.local_toolchain_clang b/cuda/templates/BUILD.local_toolchain_clang.bazel similarity index 100% rename from cuda/templates/BUILD.local_toolchain_clang rename to cuda/templates/BUILD.local_toolchain_clang.bazel diff --git a/cuda/templates/BUILD.local_toolchain_nvcc b/cuda/templates/BUILD.local_toolchain_nvcc.bazel similarity index 100% rename from cuda/templates/BUILD.local_toolchain_nvcc rename to cuda/templates/BUILD.local_toolchain_nvcc.bazel diff --git a/cuda/templates/BUILD.local_toolchain_nvcc_msvc b/cuda/templates/BUILD.local_toolchain_nvcc_msvc.bazel similarity index 100% rename from cuda/templates/BUILD.local_toolchain_nvcc_msvc rename to cuda/templates/BUILD.local_toolchain_nvcc_msvc.bazel