ANDROID: don't glob() multiple times.

Calling glob() in macro implementation is
discouraged. However, for the sake of
simplicity in the API, the kernel_build()
macro implicitly calls glob() for all files
in the ACK tree. This expression is expensive.

To avoid multiple glob()'s when analyzing the
ACK tree, explicitly spell out srcs
for each kernel_build invocation.

Test: manual (by looking at the Bazel profile)
Bug: 305301717
Change-Id: Iabd98326674b97bc76ed037c9c560741dfd8e7ef
Signed-off-by: Yifan Hong <elsk@google.com>
This commit is contained in:
Yifan Hong
2023-10-23 15:18:44 -07:00
committed by Treehugger Robot
parent a862cc23e9
commit dd0992425e
+11
View File
@@ -305,6 +305,7 @@ _DB845C_WATCHDOG_MODULE_OUTS = [
kernel_build(
name = "db845c_no_kgdb",
srcs = [":kernel_aarch64_sources"],
outs = [
"arch/arm64/boot/dts/qcom/qrb5165-rb5.dtb",
"arch/arm64/boot/dts/qcom/sdm845-db845c.dtb",
@@ -325,6 +326,7 @@ kernel_build(
kernel_build(
name = "db845c_with_kgdb",
srcs = [":kernel_aarch64_sources"],
outs = [
"arch/arm64/boot/dts/qcom/qrb5165-rb5.dtb",
"arch/arm64/boot/dts/qcom/sdm845-db845c.dtb",
@@ -446,6 +448,7 @@ _ROCKPI4_WATCHDOG_MODULE_OUTS = [
# TODO(b/258259749): Convert rockpi4 to mixed build
kernel_build(
name = "rockpi4_no_kgdb",
srcs = [":kernel_aarch64_sources"],
outs = [
"Image",
"System.map",
@@ -469,6 +472,7 @@ kernel_build(
# TODO(b/258259749): Convert rockpi4 to mixed build
kernel_build(
name = "rockpi4_with_kgdb",
srcs = [":kernel_aarch64_sources"],
outs = [
"Image",
"System.map",
@@ -529,6 +533,7 @@ copy_to_dist_dir(
# tools/bazel build --allow_undeclared_modules //common:kernel_aarch64_allmodconfig
kernel_build(
name = "kernel_aarch64_allmodconfig",
srcs = [":kernel_aarch64_sources"],
# Hack to actually check the build.
# Otherwise, Bazel thinks that there are no output files, and skip building.
outs = [".config"],
@@ -539,6 +544,7 @@ kernel_build(
# tools/bazel build --allow_undeclared_modules //common:kernel_x86_64_allmodconfig
kernel_build(
name = "kernel_x86_64_allmodconfig",
srcs = [":kernel_x86_64_sources"],
# Hack to actually check the build.
# Otherwise, Bazel thinks that there are no output files, and skip building.
outs = [".config"],
@@ -550,6 +556,8 @@ kernel_build(
# tools/bazel build --allow_undeclared_modules //common:kernel_arm_allmodconfig
kernel_build(
name = "kernel_arm_allmodconfig",
# We don't have an arm-specific source list, so use the common one.
srcs = [":common_kernel_sources"],
# Hack to actually check the build.
# Otherwise, Bazel thinks that there are no output files, and skip building.
outs = [".config"],
@@ -588,6 +596,7 @@ _KUNIT_CLK_MODULES = [
kernel_build(
name = "kunit_aarch64",
srcs = [":kernel_aarch64_sources"],
outs = [],
arch = "arm64",
base_kernel = ":kernel_aarch64",
@@ -610,6 +619,7 @@ copy_to_dist_dir(
kernel_build(
name = "kunit_x86_64",
srcs = [":kernel_x86_64_sources"],
outs = [],
arch = "x86_64",
base_kernel = ":kernel_x86_64",
@@ -632,6 +642,7 @@ copy_to_dist_dir(
kernel_build(
name = "kunit_riscv64",
srcs = [":kernel_riscv64_sources"],
outs = [],
arch = "riscv64",
base_kernel = ":kernel_riscv64",