Skip to content

Commit

Permalink
Add Span.h to a source_set that tracks its dependencies. (project-chi…
Browse files Browse the repository at this point in the history
…p#29491)

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 authored Oct 13, 2023
1 parent 842f454 commit d1b59df
Show file tree
Hide file tree
Showing 39 changed files with 126 additions and 57 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/pigweed-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ target_include_directories(
${pigweed_dir}/pw_rpc/nanopb/public

${chip_dir_output}/gen/include
${chip_dir}/third_party/nlassert/repo/include/
)

target_link_libraries(${chip_main} PUBLIC
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
50 changes: 46 additions & 4 deletions src/lib/support/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,49 @@ source_set("memory") {
]
}

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

public_deps = [
":attributes",
":logging_constants",
":verifymacros_no_logging",
"${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 +175,6 @@ static_library("support") {
"CHIPArgParser.cpp",
"CHIPCounter.h",
"CHIPMemString.h",
"CodeUtils.h",
"DLLUtil.h",
"DefaultStorageKeyAllocator.h",
"Defer.h",
Expand Down Expand Up @@ -172,8 +214,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 +243,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
17 changes: 0 additions & 17 deletions src/lib/support/CodeUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,23 +154,6 @@ constexpr inline const _T & max(const _T & a, const _T & b)

} // namespace chip

/**
* @def IgnoreUnusedVariable(aVariable)
*
* @brief
* This casts the specified @a aVariable to void to quell any
* compiler-issued unused variable warnings or errors.
*
* @code
* void foo (int err)
* {
* IgnoreUnusedVariable(err)
* }
* @endcode
*
*/
#define IgnoreUnusedVariable(aVariable) ((void) (aVariable))

/**
* @def ReturnErrorOnFailure(expr)
*
Expand Down
17 changes: 17 additions & 0 deletions src/lib/support/VerificationMacrosNoLogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,20 @@
#include <nlassert.h>

#define VerifyOrDieWithoutLogging(aCondition) nlABORT(aCondition)

/**
* @def IgnoreUnusedVariable(aVariable)
*
* @brief
* This casts the specified @a aVariable to void to quell any
* compiler-issued unused variable warnings or errors.
*
* @code
* void foo (int err)
* {
* IgnoreUnusedVariable(err)
* }
* @endcode
*
*/
#define IgnoreUnusedVariable(aVariable) ((void) (aVariable))
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/lib/support/logging/TextOnlyLogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

#include <lib/support/DLLUtil.h>
#include <lib/support/EnforceFormat.h>
#include <lib/support/VerificationMacrosNoLogging.h>
#include <lib/support/logging/Constants.h>

#include <inttypes.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
Loading

0 comments on commit d1b59df

Please sign in to comment.