diff options
author | Yifan Hong <elsk@google.com> | 2024-03-20 10:26:10 -0700 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2024-03-21 19:17:32 +0000 |
commit | 396464d6068021d8ddc52733ef82e327358c3adc (patch) | |
tree | ef2c259a4100844bb335edb53d7d23b86ebbc589 | |
parent | 1dc8c54a7285372cfe433ee57f941864cf589c9a (diff) | |
download | build-396464d6068021d8ddc52733ef82e327358c3adc.tar.gz |
kleaf: Rename to filegroup_decl_build_frag.txt.
This is a fragment of a BUILD file.
Rename the template of the fragment to
filegroup_decl_build_frag_template.txt.
Test: TH
Bug: 291918087
Change-Id: I2c993fc3dc019a5d5da3149094c1c0661fc776cb
-rw-r--r-- | kleaf/impl/constants.bzl | 2 | ||||
-rw-r--r-- | kleaf/impl/kernel_filegroup_declaration.bzl | 11 | ||||
-rw-r--r-- | kleaf/impl/kernel_prebuilt_repo.bzl | 4 |
3 files changed, 9 insertions, 8 deletions
diff --git a/kleaf/impl/constants.bzl b/kleaf/impl/constants.bzl index 7858ec6..624049b 100644 --- a/kleaf/impl/constants.bzl +++ b/kleaf/impl/constants.bzl @@ -56,5 +56,5 @@ UNSTRIPPED_MODULES_ARCHIVE = "unstripped_modules.tar.gz" # Archive emitted by kernel_build that contains the kernel_filegroup # definition and extra files. -FILEGROUP_DEF_TEMPLATE_NAME = "filegroup_decl_template.txt" +FILEGROUP_DEF_BUILD_FRAGMENT_NAME = "filegroup_decl_build_frag.txt" FILEGROUP_DEF_ARCHIVE_SUFFIX = "_filegroup_decl.tar.gz" diff --git a/kleaf/impl/kernel_filegroup_declaration.bzl b/kleaf/impl/kernel_filegroup_declaration.bzl index 3d8b4ac..61b04a1 100644 --- a/kleaf/impl/kernel_filegroup_declaration.bzl +++ b/kleaf/impl/kernel_filegroup_declaration.bzl @@ -19,7 +19,7 @@ load(":common_providers.bzl", "KernelBuildFilegroupDeclInfo") load( ":constants.bzl", "FILEGROUP_DEF_ARCHIVE_SUFFIX", - "FILEGROUP_DEF_TEMPLATE_NAME", + "FILEGROUP_DEF_BUILD_FRAGMENT_NAME", ) load(":hermetic_toolchain.bzl", "hermetic_toolchain") @@ -109,7 +109,7 @@ kernel_filegroup( """ template_file = ctx.actions.declare_file("{}/{}_template.txt".format( ctx.attr.kernel_build.label.name, - FILEGROUP_DEF_TEMPLATE_NAME, + FILEGROUP_DEF_BUILD_FRAGMENT_NAME.removesuffix(".txt"), )) ctx.actions.write(output = template_file, content = template_content) return template_file @@ -186,7 +186,7 @@ def _write_filegroup_decl_file(ctx, info, deps_files, kernel_uapi_headers, templ filegroup_decl_file = ctx.actions.declare_file("{}/{}".format( ctx.attr.kernel_build.label.name, - FILEGROUP_DEF_TEMPLATE_NAME, + FILEGROUP_DEF_BUILD_FRAGMENT_NAME, )) ctx.actions.expand_template( template = template_file, @@ -223,14 +223,15 @@ def _create_archive(ctx, info, deps_files, kernel_uapi_headers, filegroup_decl_f transitive = transitive_inputs, ) - # filegroup_decl_template.txt stays at root so that + # FILEGROUP_DEF_BUILD_FRAGMENT_NAME stays at root so that # kernel_prebuilt_repo can find it. command = hermetic_tools.setup + """ tar cf {archive} --dereference \\ - --transform 's:.*/filegroup_decl_template.txt:filegroup_decl_template.txt:g' \\ + --transform 's:.*/{fragment}:{fragment}:g' \\ "$@" """.format( archive = filegroup_decl_archive.path, + fragment = FILEGROUP_DEF_BUILD_FRAGMENT_NAME, ) args = ctx.actions.args() args.add_all(inputs) diff --git a/kleaf/impl/kernel_prebuilt_repo.bzl b/kleaf/impl/kernel_prebuilt_repo.bzl index 6882752..78addc9 100644 --- a/kleaf/impl/kernel_prebuilt_repo.bzl +++ b/kleaf/impl/kernel_prebuilt_repo.bzl @@ -17,7 +17,7 @@ load( ":constants.bzl", "FILEGROUP_DEF_ARCHIVE_SUFFIX", - "FILEGROUP_DEF_TEMPLATE_NAME", + "FILEGROUP_DEF_BUILD_FRAGMENT_NAME", ) load( ":kernel_prebuilt_utils.bzl", @@ -292,7 +292,7 @@ workspace({}) output = repository_ctx.path(bazel_target_name), ) - template_path = repository_ctx.path(_join(bazel_target_name, FILEGROUP_DEF_TEMPLATE_NAME)) + template_path = repository_ctx.path(_join(bazel_target_name, FILEGROUP_DEF_BUILD_FRAGMENT_NAME)) template_content = repository_ctx.read(template_path) repository_ctx.file(repository_ctx.path(_join(bazel_target_name, "BUILD.bazel")), """\ |