From 6549fd8be620f617889b1c39f6a6ea9585922de0 Mon Sep 17 00:00:00 2001 From: Caoruihong Date: Fri, 6 Aug 2021 12:05:56 +0800 Subject: [PATCH] chore: add default group automatly if needed the name of the default group is the same with the directory name. Signed-off-by: Caoruihong Change-Id: I3d889a361534adc44e3b1bedfec13efe8e1babf2 --- arch/arm/arm/BUILD.gn | 4 ---- bsd/dev/usb/BUILD.gn | 4 ---- lib/zlib/BUILD.gn | 4 ---- liteos.gni | 12 ++++++++++++ net/lwip-2.1/BUILD.gn | 4 ---- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/arch/arm/arm/BUILD.gn b/arch/arm/arm/BUILD.gn index f2ef7610..11f3115b 100644 --- a/arch/arm/arm/BUILD.gn +++ b/arch/arm/arm/BUILD.gn @@ -70,10 +70,6 @@ kernel_module(module_name) { public_configs = [ ":public" ] } -group("arm") { - public_deps = [ ":$module_name" ] -} - config("public") { include_dirs = [ "include", diff --git a/bsd/dev/usb/BUILD.gn b/bsd/dev/usb/BUILD.gn index c2cb6c1d..e31ba650 100644 --- a/bsd/dev/usb/BUILD.gn +++ b/bsd/dev/usb/BUILD.gn @@ -144,10 +144,6 @@ kernel_module(module_name) { public_configs = [ ":public" ] } -group("usb") { - public_deps = [ ":$module_name" ] -} - config("public") { include_dirs = [ "." ] include_dirs += [ "$LITEOSTHIRDPARTY/FreeBSD/sys/dev/evdev" ] diff --git a/lib/zlib/BUILD.gn b/lib/zlib/BUILD.gn index 5b75164e..af3aec07 100644 --- a/lib/zlib/BUILD.gn +++ b/lib/zlib/BUILD.gn @@ -56,7 +56,3 @@ kernel_module(module_name) { config("public") { include_dirs = [ "$LITEOSTHIRDPARTY/zlib" ] } - -group("zlib") { - public_deps = [ ":$module_name" ] -} diff --git a/liteos.gni b/liteos.gni index a792d3aa..517c22c5 100644 --- a/liteos.gni +++ b/liteos.gni @@ -34,6 +34,18 @@ LITEOSTHIRDPARTY = "//third_party" HDFTOPDIR = "//drivers/adapter/khdf/liteos" template("kernel_module") { + current_dir_name = get_path_info(rebase_path("."), "file") + if (target_name != current_dir_name) { + build_gn = rebase_path("BUILD.gn") + cmd = "if grep -q '^\s*group\s*(\s*\"$current_dir_name\"\s*)\s*{\s*\$' $build_gn; then echo true; else echo false; fi" + has_current_dir_group = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") + if (!has_current_dir_group) { + module_name = target_name + group(current_dir_name) { + public_deps = [ ":$module_name" ] + } + } + } if (defined(invoker.module_switch) && !invoker.module_switch) { group(target_name) { not_needed(invoker, "*") diff --git a/net/lwip-2.1/BUILD.gn b/net/lwip-2.1/BUILD.gn index f4009b22..dcc7934f 100644 --- a/net/lwip-2.1/BUILD.gn +++ b/net/lwip-2.1/BUILD.gn @@ -57,7 +57,3 @@ config("public") { include_dirs += LWIP_PORTING_INCLUDE_DIRS include_dirs += LWIP_INCLUDE_DIRS } - -group("lwip-2.1") { - public_deps = [ ":$module_name" ] -}