Skip to content

Commit

Permalink
Add Span.h to a source_set that tracks its dependencies.
Browse files Browse the repository at this point in the history
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 project-chip#29490
  • Loading branch information
bzbarsky-apple committed Sep 28, 2023
1 parent 7b4df1c commit 365c125
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 6 deletions.
8 changes: 7 additions & 1 deletion src/lib/core/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -96,7 +102,6 @@ static_library("core") {
"CHIPCore.h",
"CHIPEncoding.h",
"CHIPError.cpp",
"CHIPError.h",
"CHIPKeyIds.cpp",
"CHIPKeyIds.h",
"ClusterEnums.h",
Expand Down Expand Up @@ -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",
Expand Down
42 changes: 39 additions & 3 deletions src/lib/support/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions src/platform/Darwin/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down

0 comments on commit 365c125

Please sign in to comment.