From 365c1252d2e1fe41bbfe48fcddc0ebad56339367 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 28 Sep 2023 11:47:19 -0400 Subject: [PATCH] Add Span.h to a source_set that tracks its dependencies. This requires that those dependencies be separate things that are not the entire "support" library, because some things need Span but can't depend on all of "support". Maybe these should just all be lumped into "support_core"... but then why are these things in support/ and not core/ (which are very much "these are the same thing, but we are going to pretend the are not). Fixes https://github.com/project-chip/connectedhomeip/issues/29490 --- src/lib/core/BUILD.gn | 8 ++++++- src/lib/support/BUILD.gn | 42 +++++++++++++++++++++++++++++++++--- src/platform/Darwin/BUILD.gn | 3 +-- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/lib/core/BUILD.gn b/src/lib/core/BUILD.gn index 1f7f2769f3c5cd..7b95ee115763a2 100644 --- a/src/lib/core/BUILD.gn +++ b/src/lib/core/BUILD.gn @@ -84,6 +84,12 @@ source_set("chip_config_header") { allow_circular_includes_from = [ "${chip_root}/src/ble:ble_config_header" ] } +source_set("chip_error") { + sources = [ "CHIPError.h" ] + + public_deps = [ ":chip_config_header" ] +} + static_library("core") { output_name = "libChipCore" @@ -96,7 +102,6 @@ static_library("core") { "CHIPCore.h", "CHIPEncoding.h", "CHIPError.cpp", - "CHIPError.h", "CHIPKeyIds.cpp", "CHIPKeyIds.h", "ClusterEnums.h", @@ -124,6 +129,7 @@ static_library("core") { public_deps = [ ":chip_config_header", + ":chip_error", "${chip_root}/src/ble", "${chip_root}/src/inet", "${chip_root}/src/lib/support", diff --git a/src/lib/support/BUILD.gn b/src/lib/support/BUILD.gn index 68b39ebb0a802b..f7c18e8bcf9512 100644 --- a/src/lib/support/BUILD.gn +++ b/src/lib/support/BUILD.gn @@ -73,6 +73,42 @@ source_set("attributes") { ] } +source_set("logging_header") { + sources = [ "logging/CHIPLogging.h" ] + + public_deps = [ + ":attributes", + ":logging_constants", + "${chip_root}/src/lib/core:chip_config_header", + ] + + if (chip_pw_tokenizer_logging) { + public_deps += [ "${dir_pw_tokenizer}" ] + } +} + +source_set("codeutils") { + # TODO: Why is ErrorStr.h not just in core along with CHIPError.h? + sources = [ + "CodeUtils.h", + "ErrorStr.h", + ] + + public_deps = [ + ":attributes", + ":logging_header", + "${chip_root}/src/lib/core:chip_config_header", + "${chip_root}/src/lib/core:chip_error", + "${nlassert_root}:nlassert", + ] +} + +source_set("span") { + sources = [ "Span.h" ] + + public_deps = [ ":codeutils" ] +} + source_set("chip_version_header") { sources = get_target_outputs(":gen_chip_version") @@ -102,12 +138,10 @@ static_library("support") { "CHIPMemString.h", "CHIPPlatformMemory.cpp", "CHIPPlatformMemory.h", - "CodeUtils.h", "DLLUtil.h", "DefaultStorageKeyAllocator.h", "Defer.h", "ErrorStr.cpp", - "ErrorStr.h", "FibonacciUtils.cpp", "FibonacciUtils.h", "FixedBufferAllocator.cpp", @@ -143,7 +177,6 @@ static_library("support") { "ZclString.cpp", "ZclString.h", "logging/CHIPLogging.cpp", - "logging/CHIPLogging.h", "verhoeff/Verhoeff.cpp", "verhoeff/Verhoeff.h", "verhoeff/Verhoeff10.cpp", @@ -170,7 +203,10 @@ static_library("support") { public_deps = [ ":attributes", ":chip_version_header", + ":codeutils", ":logging_constants", + ":logging_header", + ":span", "${chip_root}/src/lib/core:chip_config_header", "${chip_root}/src/platform:platform_buildconfig", "${chip_root}/src/platform/logging:headers", diff --git a/src/platform/Darwin/BUILD.gn b/src/platform/Darwin/BUILD.gn index 1769d4a29f3576..a4a8dad1d1bab7 100644 --- a/src/platform/Darwin/BUILD.gn +++ b/src/platform/Darwin/BUILD.gn @@ -137,10 +137,9 @@ static_library("logging") { ] deps = [ - "${chip_root}/src/lib/core:chip_config_header", # for lib/support/Span.h "${chip_root}/src/lib/support:attributes", "${chip_root}/src/lib/support:logging_constants", - "${nlassert_root}:nlassert", # for lib/support/Span.h + "${chip_root}/src/lib/support:span", ] configs += [ "${chip_root}/src:includes" ]