diff options
author | Yifan Hong <elsk@google.com> | 2022-09-02 15:52:40 -0700 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2022-09-06 17:16:39 +0000 |
commit | ca156b8c8128bcce5276fee6d1a266eac1642e0d (patch) | |
tree | a79d04df4369ef61589a0ec18770479096c08f8a | |
parent | f67eea6aa43b30326960b39fe5f4c99c1519b86a (diff) | |
download | build-ca156b8c8128bcce5276fee6d1a266eac1642e0d.tar.gz |
Add short aliases for kernel_build.*outs.
This enables the following labels for 5.15 branches
//common:kernel_aarch64/zram.ko
//common:kernel_aarch64/zsmalloc.ko
Test: TH
Bug: 244215515
Change-Id: I248ada8bc51645e567c3d73141562c3a46713f63
-rw-r--r-- | kleaf/docs/impl.md | 4 | ||||
-rw-r--r-- | kleaf/impl/kernel_build.bzl | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/kleaf/docs/impl.md b/kleaf/docs/impl.md index 84aad568..af3f31c3 100644 --- a/kleaf/docs/impl.md +++ b/kleaf/docs/impl.md @@ -223,8 +223,8 @@ that the outputs are analogous to those produced by `build/build.sh`: * GKI modules * If you are using all GKI modules, add `//common:kernel_aarch64_modules`. * If you are using part of the GKI modules, add them individually, e.g.: - * `//common:kernel_aarch64/drivers/block/zram/zram.ko` - * `//common:kernel_aarch64/mm/zsmalloc.ko` + * `//common:kernel_aarch64/zram.ko` + * `//common:kernel_aarch64/zsmalloc.ko` * Modules from the device kernel build with the same name as GKI modules (e.g. on android13-5.15, you have `zram.ko` in `kernel_build.module_outs`) does not need to be specified, because `module_outs` are added to diff --git a/kleaf/impl/kernel_build.bzl b/kleaf/impl/kernel_build.bzl index 2c99b773..fc37e10e 100644 --- a/kleaf/impl/kernel_build.bzl +++ b/kleaf/impl/kernel_build.bzl @@ -441,6 +441,8 @@ def kernel_build( if type(out_attr_val) == type([]): for out in out_attr_val: native.filegroup(name = name + "/" + out, srcs = [":" + name], output_group = out, **kwargs) + if out != paths.basename(out): + native.filegroup(name = name + "/" + paths.basename(out), srcs = [":" + name], output_group = out, **kwargs) real_outs[out_name] = [name + "/" + out for out in out_attr_val] elif type(out_attr_val) == type({}): # out_attr_val = {config_setting: [out, ...], ...} @@ -457,6 +459,18 @@ def kernel_build( # Use "manual" tags to prevent it to be built with ... **kwargs_with_manual ) + if out != paths.basename(out): + native.filegroup( + name = name + "/" + paths.basename(out), + # Use a select() to prevent this rule to build when config_setting is not fulfilled. + srcs = select({ + config_setting: [":" + name] + for config_setting in config_settings + }), + output_group = out, + # Use "manual" tags to prevent it to be built with ... + **kwargs_with_manual + ) real_outs[out_name] = [name + "/" + out for out, _ in utils.reverse_dict(out_attr_val).items()] else: fail("Unexpected type {} for {}: {}".format(type(out_attr_val), out_name, out_attr_val)) |