Skip to content

Commit 2245560

Browse files
bzbarsky-applepull[bot]
authored andcommitted
Add Span.h to a source_set that tracks its dependencies. (#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 #29490
1 parent 902e103 commit 2245560

File tree

39 files changed

+126
-57
lines changed

39 files changed

+126
-57
lines changed

examples/chip-tool/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ static_library("chip-tool-utils") {
8989
sources += [ "commands/interactive/InteractiveCommands.cpp" ]
9090
deps += [
9191
"${chip_root}/examples/common/websocket-server",
92+
"${chip_root}/src/platform/logging:headers",
9293
"${editline_root}:editline",
9394
]
9495
}

examples/darwin-framework-tool/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ executable("darwin-framework-tool") {
217217

218218
deps += [
219219
"${chip_root}/examples/common/websocket-server",
220+
"${chip_root}/src/platform/logging:headers",
220221
"${editline_root}:editline",
221222
]
222223
}

examples/pigweed-app/ameba/chip_main.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ target_include_directories(
6060
${pigweed_dir}/pw_rpc/nanopb/public
6161

6262
${chip_dir_output}/gen/include
63+
${chip_dir}/third_party/nlassert/repo/include/
6364
)
6465

6566
target_link_libraries(${chip_main} PUBLIC

examples/placeholder/linux/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ executable("chip-${chip_tests_zap_config}") {
4646
"${chip_root}/src/lib",
4747
"${chip_root}/src/lib/support:testing", # For sleepMillis. TODO: this is
4848
# odd and should be fixed
49+
"${chip_root}/src/platform/logging:headers",
4950
"${chip_root}/third_party/jsoncpp",
5051
]
5152

src/credentials/BUILD.gn

+1-10
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,7 @@ source_set("test_paa_store") {
134134
"attestation_verifier/TestPAAStore.h",
135135
]
136136

137-
public_deps = [
138-
"${chip_root}/src/lib/core:chip_config_header", # for lib/support/Span.h
139-
"${nlassert_root}:nlassert", # for lib/support/Span.h
140-
]
141-
if (chip_pw_tokenizer_logging) {
142-
import("//build_overrides/pigweed.gni")
143-
public_deps += [
144-
"${dir_pw_tokenizer}", # for /lib/support/Span.h
145-
]
146-
}
137+
public_deps = [ "${chip_root}/src/lib/support:span" ]
147138
}
148139

149140
static_library("default_attestation_verifier") {

src/lib/support/BUILD.gn

+46-4
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,49 @@ source_set("memory") {
107107
]
108108
}
109109

110+
source_set("text_only_logging") {
111+
sources = [
112+
"logging/TextOnlyLogging.cpp",
113+
"logging/TextOnlyLogging.h",
114+
]
115+
116+
public_deps = [
117+
":attributes",
118+
":logging_constants",
119+
":verifymacros_no_logging",
120+
"${chip_root}/src/lib/core:chip_config_header",
121+
]
122+
123+
if (chip_pw_tokenizer_logging) {
124+
public_deps += [ "${dir_pw_tokenizer}" ]
125+
}
126+
127+
deps = [
128+
":memory",
129+
"${chip_root}/src/lib/core:chip_config_header",
130+
"${chip_root}/src/platform/logging:headers",
131+
]
132+
}
133+
134+
source_set("verifymacros") {
135+
sources = [ "CodeUtils.h" ]
136+
137+
public_deps = [
138+
":attributes",
139+
":text_only_logging",
140+
":verifymacros_no_logging",
141+
"${chip_root}/src/lib/core:chip_config_header",
142+
"${chip_root}/src/lib/core:error",
143+
"${nlassert_root}:nlassert",
144+
]
145+
}
146+
147+
source_set("span") {
148+
sources = [ "Span.h" ]
149+
150+
public_deps = [ ":verifymacros" ]
151+
}
152+
110153
source_set("chip_version_header") {
111154
sources = get_target_outputs(":gen_chip_version")
112155

@@ -132,7 +175,6 @@ static_library("support") {
132175
"CHIPArgParser.cpp",
133176
"CHIPCounter.h",
134177
"CHIPMemString.h",
135-
"CodeUtils.h",
136178
"DLLUtil.h",
137179
"DefaultStorageKeyAllocator.h",
138180
"Defer.h",
@@ -172,8 +214,6 @@ static_library("support") {
172214
"logging/BinaryLogging.cpp",
173215
"logging/BinaryLogging.h",
174216
"logging/CHIPLogging.h",
175-
"logging/TextOnlyLogging.cpp",
176-
"logging/TextOnlyLogging.h",
177217
"verhoeff/Verhoeff.cpp",
178218
"verhoeff/Verhoeff.h",
179219
"verhoeff/Verhoeff10.cpp",
@@ -203,11 +243,13 @@ static_library("support") {
203243
":logging_constants",
204244
":memory",
205245
":safeint",
246+
":span",
247+
":text_only_logging",
248+
":verifymacros",
206249
":verifymacros_no_logging",
207250
"${chip_root}/src/lib/core:chip_config_header",
208251
"${chip_root}/src/lib/core:error",
209252
"${chip_root}/src/platform:platform_buildconfig",
210-
"${chip_root}/src/platform/logging:headers",
211253
"${nlassert_root}:nlassert",
212254
"${nlio_root}:nlio",
213255
]

src/lib/support/CodeUtils.h

-17
Original file line numberDiff line numberDiff line change
@@ -154,23 +154,6 @@ constexpr inline const _T & max(const _T & a, const _T & b)
154154

155155
} // namespace chip
156156

157-
/**
158-
* @def IgnoreUnusedVariable(aVariable)
159-
*
160-
* @brief
161-
* This casts the specified @a aVariable to void to quell any
162-
* compiler-issued unused variable warnings or errors.
163-
*
164-
* @code
165-
* void foo (int err)
166-
* {
167-
* IgnoreUnusedVariable(err)
168-
* }
169-
* @endcode
170-
*
171-
*/
172-
#define IgnoreUnusedVariable(aVariable) ((void) (aVariable))
173-
174157
/**
175158
* @def ReturnErrorOnFailure(expr)
176159
*

src/lib/support/VerificationMacrosNoLogging.h

+17
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,20 @@
2525
#include <nlassert.h>
2626

2727
#define VerifyOrDieWithoutLogging(aCondition) nlABORT(aCondition)
28+
29+
/**
30+
* @def IgnoreUnusedVariable(aVariable)
31+
*
32+
* @brief
33+
* This casts the specified @a aVariable to void to quell any
34+
* compiler-issued unused variable warnings or errors.
35+
*
36+
* @code
37+
* void foo (int err)
38+
* {
39+
* IgnoreUnusedVariable(err)
40+
* }
41+
* @endcode
42+
*
43+
*/
44+
#define IgnoreUnusedVariable(aVariable) ((void) (aVariable))

src/lib/support/logging/TextOnlyLogging.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424

2525
#include "TextOnlyLogging.h"
2626

27-
#include <lib/core/CHIPCore.h>
27+
#include <lib/core/CHIPConfig.h>
2828
#include <lib/support/CHIPMem.h>
29-
#include <lib/support/CodeUtils.h>
3029

3130
#include <platform/logging/LogV.h>
3231

src/lib/support/logging/TextOnlyLogging.h

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
#include <lib/support/DLLUtil.h>
4040
#include <lib/support/EnforceFormat.h>
41+
#include <lib/support/VerificationMacrosNoLogging.h>
4142
#include <lib/support/logging/Constants.h>
4243

4344
#include <inttypes.h>

src/platform/ASR/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ static_library("ASR") {
7272

7373
deps = [
7474
"${chip_root}/src/lib/dnssd:platform_header",
75+
"${chip_root}/src/platform/logging:headers",
7576
"${chip_root}/src/setup_payload",
7677
]
7778

src/platform/Ameba/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ static_library("Ameba") {
5454

5555
deps = [
5656
"${chip_root}/src/lib/dnssd:platform_header",
57+
"${chip_root}/src/platform/logging:headers",
5758
"${chip_root}/src/setup_payload",
5859
]
5960

src/platform/Beken/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static_library("Beken") {
5252

5353
deps = [
5454
"${chip_root}/src/lib/dnssd:platform_header",
55+
"${chip_root}/src/platform/logging:headers",
5556
"${chip_root}/src/setup_payload",
5657
]
5758

src/platform/Darwin/BUILD.gn

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ static_library("Darwin") {
9898
deps = [
9999
":logging",
100100
"${chip_root}/src/lib/dnssd:platform_header",
101+
"${chip_root}/src/platform/logging:headers",
101102
"${chip_root}/src/setup_payload",
102103
]
103104

@@ -137,10 +138,9 @@ static_library("logging") {
137138
]
138139

139140
deps = [
140-
"${chip_root}/src/lib/core:chip_config_header", # for lib/support/Span.h
141141
"${chip_root}/src/lib/support:attributes",
142142
"${chip_root}/src/lib/support:logging_constants",
143-
"${nlassert_root}:nlassert", # for lib/support/Span.h
143+
"${chip_root}/src/lib/support:span",
144144
]
145145

146146
configs += [ "${chip_root}/src:includes" ]

src/platform/ESP32/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ static_library("ESP32") {
6565

6666
deps = [
6767
"${chip_root}/src/lib/dnssd:platform_header",
68+
"${chip_root}/src/platform/logging:headers",
6869
"${chip_root}/src/setup_payload",
6970
]
7071

src/platform/Infineon/CYW30739/BUILD.gn

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ static_library("CYW30739") {
6363
]
6464
}
6565

66-
deps = [ "${chip_root}/src/crypto" ]
66+
deps = [
67+
"${chip_root}/src/crypto",
68+
"${chip_root}/src/platform/logging:headers",
69+
]
6770

6871
public = [
6972
"${chip_root}/src/credentials/DeviceAttestationCredsProvider.h",

src/platform/Infineon/PSOC6/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ static_library("PSOC6") {
6969

7070
deps = [
7171
"${chip_root}/src/lib/dnssd:platform_header",
72+
"${chip_root}/src/platform/logging:headers",
7273
"${chip_root}/src/setup_payload",
7374
]
7475

src/platform/Linux/BUILD.gn

+3-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,11 @@ static_library("Linux") {
7373
"SystemTimeSupport.cpp",
7474
]
7575

76+
deps = [ "${chip_root}/src/setup_payload" ]
77+
7678
if (!chip_use_external_logging) {
7779
sources += [ "Logging.cpp" ]
80+
deps += [ "${chip_root}/src/platform/logging:headers" ]
7881
}
7982

8083
if (chip_enable_openthread) {
@@ -96,8 +99,6 @@ static_library("Linux") {
9699
]
97100
}
98101

99-
deps = [ "${chip_root}/src/setup_payload" ]
100-
101102
public_deps = [
102103
"${chip_root}/src/app/common:cluster-objects",
103104
"${chip_root}/src/platform:platform_base",

src/platform/Tizen/BUILD.gn

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ static_library("Tizen") {
6363
"SystemTimeSupport.cpp",
6464
]
6565

66-
deps = [ "${chip_root}/src/setup_payload" ]
66+
deps = [
67+
"${chip_root}/src/platform/logging:headers",
68+
"${chip_root}/src/setup_payload",
69+
]
6770

6871
public_deps = [
6972
"${chip_root}/src/platform:platform_base",

src/platform/Zephyr/BUILD.gn

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static_library("Zephyr") {
5252
]
5353

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

5657
if (chip_enable_openthread) {
5758
sources += [
@@ -66,7 +67,7 @@ static_library("Zephyr") {
6667
"../OpenThread/OpenThreadDnssdImpl.cpp",
6768
"../OpenThread/OpenThreadDnssdImpl.h",
6869
]
69-
deps = [ "${chip_root}/src/lib/dnssd:platform_header" ]
70+
deps += [ "${chip_root}/src/lib/dnssd:platform_header" ]
7071
}
7172
}
7273

src/platform/bouffalolab/BL602/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ static_library("BL602") {
6969
deps = [
7070
"${chip_root}/src/credentials:credentials_header",
7171
"${chip_root}/src/lib/dnssd:platform_header",
72+
"${chip_root}/src/platform/logging:headers",
7273
]
7374
public_deps = [ "${chip_root}/src/platform:platform_base" ]
7475
}

src/platform/bouffalolab/BL702/BUILD.gn

+5-3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ static_library("BL702") {
5959
]
6060
}
6161

62+
deps = [ "${chip_root}/src/platform/logging:headers" ]
63+
6264
defines =
6365
[ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ]
6466
if (chip_enable_factory_data || chip_enable_factory_data_test) {
@@ -76,15 +78,15 @@ static_library("BL702") {
7678
"wifi_mgmr_portable.c",
7779
]
7880

79-
deps = [ "${chip_root}/src/lib/dnssd:platform_header" ]
81+
deps += [ "${chip_root}/src/lib/dnssd:platform_header" ]
8082
}
8183

8284
if (chip_enable_openthread) {
8385
# needed for MTD/FTD
8486

8587
import("//build_overrides/bouffalolab_iot_sdk.gni")
8688
import("${bouffalolab_iot_sdk_build_root}/bl702/bl_iot_sdk.gni")
87-
deps = [ "${bouffalolab_iot_sdk_build_root}/bl702:bl_iot_sdk" ]
89+
deps += [ "${bouffalolab_iot_sdk_build_root}/bl702:bl_iot_sdk" ]
8890

8991
sources += [
9092
"../../OpenThread/OpenThreadUtils.cpp",
@@ -108,7 +110,7 @@ static_library("BL702") {
108110
"EthernetInterface.c",
109111
]
110112

111-
deps = [ "${chip_root}/src/lib/dnssd:platform_header" ]
113+
deps += [ "${chip_root}/src/lib/dnssd:platform_header" ]
112114
}
113115

114116
deps += [ "${chip_root}/src/credentials:credentials_header" ]

src/platform/bouffalolab/BL702L/BUILD.gn

+3-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ static_library("BL702L") {
5757
]
5858
}
5959

60+
deps = [ "${chip_root}/src/platform/logging:headers" ]
61+
6062
defines =
6163
[ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ]
6264
if (chip_enable_factory_data || chip_enable_factory_data_test) {
@@ -71,7 +73,7 @@ static_library("BL702L") {
7173

7274
import("//build_overrides/bouffalolab_iot_sdk.gni")
7375
import("${bouffalolab_iot_sdk_build_root}/bl702l/bl_iot_sdk.gni")
74-
deps = [ "${bouffalolab_iot_sdk_build_root}/bl702l:bl_iot_sdk" ]
76+
deps += [ "${bouffalolab_iot_sdk_build_root}/bl702l:bl_iot_sdk" ]
7577

7678
sources += [
7779
"../../OpenThread/OpenThreadUtils.cpp",

src/platform/cc13xx_26xx/cc13x2_26x2/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static_library("cc13x2_26x2") {
4646
"SystemPlatformConfig.h",
4747
]
4848

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

5151
public_deps = [
5252
"${chip_root}/src/crypto",

src/platform/cc13xx_26xx/cc13x4_26x4/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static_library("cc13x4_26x4") {
4646
"SystemPlatformConfig.h",
4747
]
4848

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

5151
public_deps = [
5252
"${chip_root}/src/crypto",

0 commit comments

Comments
 (0)