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".

Fixes project-chip#29490
  • Loading branch information
bzbarsky-apple committed Oct 12, 2023
1 parent 2a37b68 commit 7e30c5b
Show file tree
Hide file tree
Showing 32 changed files with 98 additions and 37 deletions.
1 change: 1 addition & 0 deletions examples/chip-tool/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ static_library("chip-tool-utils") {
sources += [ "commands/interactive/InteractiveCommands.cpp" ]
deps += [
"${chip_root}/examples/common/websocket-server",
"${chip_root}/src/platform/logging:headers",
"${editline_root}:editline",
]
}
Expand Down
1 change: 1 addition & 0 deletions examples/darwin-framework-tool/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ executable("darwin-framework-tool") {

deps += [
"${chip_root}/examples/common/websocket-server",
"${chip_root}/src/platform/logging:headers",
"${editline_root}:editline",
]
}
Expand Down
1 change: 1 addition & 0 deletions examples/placeholder/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ executable("chip-${chip_tests_zap_config}") {
"${chip_root}/src/lib",
"${chip_root}/src/lib/support:testing", # For sleepMillis. TODO: this is
# odd and should be fixed
"${chip_root}/src/platform/logging:headers",
"${chip_root}/third_party/jsoncpp",
]

Expand Down
11 changes: 1 addition & 10 deletions src/credentials/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,7 @@ source_set("test_paa_store") {
"attestation_verifier/TestPAAStore.h",
]

public_deps = [
"${chip_root}/src/lib/core:chip_config_header", # for lib/support/Span.h
"${nlassert_root}:nlassert", # for lib/support/Span.h
]
if (chip_pw_tokenizer_logging) {
import("//build_overrides/pigweed.gni")
public_deps += [
"${dir_pw_tokenizer}", # for /lib/support/Span.h
]
}
public_deps = [ "${chip_root}/src/lib/support:span" ]
}

static_library("default_attestation_verifier") {
Expand Down
49 changes: 45 additions & 4 deletions src/lib/support/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,48 @@ source_set("memory") {
]
}

source_set("text_only_logging") {
sources = [
"logging/TextOnlyLogging.cpp",
"logging/TextOnlyLogging.h",
]

public_deps = [
":attributes",
":logging_constants",
"${chip_root}/src/lib/core:chip_config_header",
]

if (chip_pw_tokenizer_logging) {
public_deps += [ "${dir_pw_tokenizer}" ]
}

deps = [
":memory",
"${chip_root}/src/lib/core:chip_config_header",
"${chip_root}/src/platform/logging:headers",
]
}

source_set("verifymacros") {
sources = [ "CodeUtils.h" ]

public_deps = [
":attributes",
":text_only_logging",
":verifymacros_no_logging",
"${chip_root}/src/lib/core:chip_config_header",
"${chip_root}/src/lib/core:error",
"${nlassert_root}:nlassert",
]
}

source_set("span") {
sources = [ "Span.h" ]

public_deps = [ ":verifymacros" ]
}

source_set("chip_version_header") {
sources = get_target_outputs(":gen_chip_version")

Expand All @@ -132,7 +174,6 @@ static_library("support") {
"CHIPArgParser.cpp",
"CHIPCounter.h",
"CHIPMemString.h",
"CodeUtils.h",
"DLLUtil.h",
"DefaultStorageKeyAllocator.h",
"Defer.h",
Expand Down Expand Up @@ -172,8 +213,6 @@ static_library("support") {
"logging/BinaryLogging.cpp",
"logging/BinaryLogging.h",
"logging/CHIPLogging.h",
"logging/TextOnlyLogging.cpp",
"logging/TextOnlyLogging.h",
"verhoeff/Verhoeff.cpp",
"verhoeff/Verhoeff.h",
"verhoeff/Verhoeff10.cpp",
Expand Down Expand Up @@ -203,11 +242,13 @@ static_library("support") {
":logging_constants",
":memory",
":safeint",
":span",
":text_only_logging",
":verifymacros",
":verifymacros_no_logging",
"${chip_root}/src/lib/core:chip_config_header",
"${chip_root}/src/lib/core:error",
"${chip_root}/src/platform:platform_buildconfig",
"${chip_root}/src/platform/logging:headers",
"${nlassert_root}:nlassert",
"${nlio_root}:nlio",
]
Expand Down
3 changes: 1 addition & 2 deletions src/lib/support/logging/TextOnlyLogging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@

#include "TextOnlyLogging.h"

#include <lib/core/CHIPCore.h>
#include <lib/core/CHIPConfig.h>
#include <lib/support/CHIPMem.h>
#include <lib/support/CodeUtils.h>

#include <platform/logging/LogV.h>

Expand Down
1 change: 1 addition & 0 deletions src/platform/ASR/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static_library("ASR") {

deps = [
"${chip_root}/src/lib/dnssd:platform_header",
"${chip_root}/src/platform/logging:headers",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions src/platform/Ameba/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ static_library("Ameba") {

deps = [
"${chip_root}/src/lib/dnssd:platform_header",
"${chip_root}/src/platform/logging:headers",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions src/platform/Beken/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static_library("Beken") {

deps = [
"${chip_root}/src/lib/dnssd:platform_header",
"${chip_root}/src/platform/logging:headers",
"${chip_root}/src/setup_payload",
]

Expand Down
4 changes: 2 additions & 2 deletions src/platform/Darwin/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ static_library("Darwin") {
deps = [
":logging",
"${chip_root}/src/lib/dnssd:platform_header",
"${chip_root}/src/platform/logging:headers",
"${chip_root}/src/setup_payload",
]

Expand Down Expand Up @@ -137,10 +138,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
1 change: 1 addition & 0 deletions src/platform/ESP32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ static_library("ESP32") {

deps = [
"${chip_root}/src/lib/dnssd:platform_header",
"${chip_root}/src/platform/logging:headers",
"${chip_root}/src/setup_payload",
]

Expand Down
5 changes: 4 additions & 1 deletion src/platform/Infineon/CYW30739/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ static_library("CYW30739") {
]
}

deps = [ "${chip_root}/src/crypto" ]
deps = [
"${chip_root}/src/crypto",
"${chip_root}/src/platform/logging:headers",
]

public = [
"${chip_root}/src/credentials/DeviceAttestationCredsProvider.h",
Expand Down
1 change: 1 addition & 0 deletions src/platform/Infineon/PSOC6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ static_library("PSOC6") {

deps = [
"${chip_root}/src/lib/dnssd:platform_header",
"${chip_root}/src/platform/logging:headers",
"${chip_root}/src/setup_payload",
]

Expand Down
5 changes: 3 additions & 2 deletions src/platform/Linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@ static_library("Linux") {
"SystemTimeSupport.cpp",
]

deps = [ "${chip_root}/src/setup_payload" ]

if (!chip_use_external_logging) {
sources += [ "Logging.cpp" ]
deps += [ "${chip_root}/src/platform/logging:headers" ]
}

if (chip_enable_openthread) {
Expand All @@ -96,8 +99,6 @@ static_library("Linux") {
]
}

deps = [ "${chip_root}/src/setup_payload" ]

public_deps = [
"${chip_root}/src/app/common:cluster-objects",
"${chip_root}/src/platform:platform_base",
Expand Down
5 changes: 4 additions & 1 deletion src/platform/Tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ static_library("Tizen") {
"SystemTimeSupport.cpp",
]

deps = [ "${chip_root}/src/setup_payload" ]
deps = [
"${chip_root}/src/platform/logging:headers",
"${chip_root}/src/setup_payload",
]

public_deps = [
"${chip_root}/src/platform:platform_base",
Expand Down
3 changes: 2 additions & 1 deletion src/platform/Zephyr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static_library("Zephyr") {
]

public_deps = [ "${chip_root}/src/platform:platform_base" ]
deps = [ "${chip_root}/src/platform/logging:headers" ]

if (chip_enable_openthread) {
sources += [
Expand All @@ -66,7 +67,7 @@ static_library("Zephyr") {
"../OpenThread/OpenThreadDnssdImpl.cpp",
"../OpenThread/OpenThreadDnssdImpl.h",
]
deps = [ "${chip_root}/src/lib/dnssd:platform_header" ]
deps += [ "${chip_root}/src/lib/dnssd:platform_header" ]
}
}

Expand Down
1 change: 1 addition & 0 deletions src/platform/bouffalolab/BL602/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ static_library("BL602") {
deps = [
"${chip_root}/src/credentials:credentials_header",
"${chip_root}/src/lib/dnssd:platform_header",
"${chip_root}/src/platform/logging:headers",
]
public_deps = [ "${chip_root}/src/platform:platform_base" ]
}
8 changes: 5 additions & 3 deletions src/platform/bouffalolab/BL702/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ static_library("BL702") {
]
}

deps = [ "${chip_root}/src/platform/logging:headers" ]

defines =
[ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ]
if (chip_enable_factory_data || chip_enable_factory_data_test) {
Expand All @@ -76,15 +78,15 @@ static_library("BL702") {
"wifi_mgmr_portable.c",
]

deps = [ "${chip_root}/src/lib/dnssd:platform_header" ]
deps += [ "${chip_root}/src/lib/dnssd:platform_header" ]
}

if (chip_enable_openthread) {
# needed for MTD/FTD

import("//build_overrides/bouffalolab_iot_sdk.gni")
import("${bouffalolab_iot_sdk_build_root}/bl702/bl_iot_sdk.gni")
deps = [ "${bouffalolab_iot_sdk_build_root}/bl702:bl_iot_sdk" ]
deps += [ "${bouffalolab_iot_sdk_build_root}/bl702:bl_iot_sdk" ]

sources += [
"../../OpenThread/OpenThreadUtils.cpp",
Expand All @@ -108,7 +110,7 @@ static_library("BL702") {
"EthernetInterface.c",
]

deps = [ "${chip_root}/src/lib/dnssd:platform_header" ]
deps += [ "${chip_root}/src/lib/dnssd:platform_header" ]
}

deps += [ "${chip_root}/src/credentials:credentials_header" ]
Expand Down
4 changes: 3 additions & 1 deletion src/platform/bouffalolab/BL702L/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ static_library("BL702L") {
]
}

deps = [ "${chip_root}/src/platform/logging:headers" ]

defines =
[ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ]
if (chip_enable_factory_data || chip_enable_factory_data_test) {
Expand All @@ -71,7 +73,7 @@ static_library("BL702L") {

import("//build_overrides/bouffalolab_iot_sdk.gni")
import("${bouffalolab_iot_sdk_build_root}/bl702l/bl_iot_sdk.gni")
deps = [ "${bouffalolab_iot_sdk_build_root}/bl702l:bl_iot_sdk" ]
deps += [ "${bouffalolab_iot_sdk_build_root}/bl702l:bl_iot_sdk" ]

sources += [
"../../OpenThread/OpenThreadUtils.cpp",
Expand Down
2 changes: 1 addition & 1 deletion src/platform/cc13xx_26xx/cc13x2_26x2/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static_library("cc13x2_26x2") {
"SystemPlatformConfig.h",
]

deps = []
deps = [ "${chip_root}/src/platform/logging:headers" ]

public_deps = [
"${chip_root}/src/crypto",
Expand Down
2 changes: 1 addition & 1 deletion src/platform/cc13xx_26xx/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static_library("cc13x4_26x4") {
"SystemPlatformConfig.h",
]

deps = []
deps = [ "${chip_root}/src/platform/logging:headers" ]

public_deps = [
"${chip_root}/src/crypto",
Expand Down
2 changes: 2 additions & 0 deletions src/platform/logging/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ if (current_os == "android") {
"${chip_root}/src/lib/support:attributes",
"${chip_root}/src/lib/support:logging_constants",
"${chip_root}/src/platform:platform_buildconfig",
"${chip_root}/src/platform/logging:headers",
]

libs = [ "log" ]
Expand All @@ -43,6 +44,7 @@ static_library("stdio") {
"${chip_root}/src/lib/support:attributes",
"${chip_root}/src/lib/support:logging_constants",
"${chip_root}/src/platform:platform_buildconfig",
"${chip_root}/src/platform/logging:headers",
]

# Ensure we end up with the expected output file name
Expand Down
1 change: 1 addition & 0 deletions src/platform/mbed/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static_library("mbed") {
]

public_deps = [ "${chip_root}/src/platform:platform_base" ]
deps = [ "${chip_root}/src/platform/logging:headers" ]

if (chip_enable_wifi) {
sources += [
Expand Down
3 changes: 1 addition & 2 deletions src/platform/mt793x/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ static_library("mt793x") {

public_deps += [ "${chip_root}/third_party/mt793x_sdk/mDNSResponder" ]

deps = []
public_deps += []
deps = [ "${chip_root}/src/platform/logging:headers" ]

# mDNS
if (chip_mdns == "platform") {
Expand Down
2 changes: 1 addition & 1 deletion src/platform/nxp/k32w/k32w0/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static_library("k32w0") {
}
}

deps = []
deps = [ "${chip_root}/src/platform/logging:headers" ]

public_deps = [ "${chip_root}/src/platform:platform_base" ]

Expand Down
2 changes: 1 addition & 1 deletion src/platform/nxp/k32w/k32w1/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static_library("k32w1") {
public_deps += [ "${mbedtls_root}:mbedtls" ]
}

deps = []
deps = [ "${chip_root}/src/platform/logging:headers" ]

if (chip_enable_openthread) {
sources += [
Expand Down
2 changes: 1 addition & 1 deletion src/platform/nxp/mw320/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static_library("mw320") {
# Use ethernet/wifi interface for network commissioning. Default: WiFi
defines += [ "USE_ETHERNET_COMMISSION=0" ]

deps = []
deps = [ "${chip_root}/src/platform/logging:headers" ]

public_deps = [ "${chip_root}/src/platform:platform_base" ]

Expand Down
Loading

0 comments on commit 7e30c5b

Please sign in to comment.