Skip to content

Commit f9ffe55

Browse files
authored
Add "orphaned" header files from src/lib/support into gn (#31807)
* Restyle * A few comment updates * Move testing library into nlunittest location * Restyle * Remove dependency from support into data-model: place CHIPListUtils into data-model and adjust the name to not use UTILS as a name * Restyle * Zap regen to force reformat * zap regen again
1 parent 38d5e18 commit f9ffe55

File tree

25 files changed

+64
-16
lines changed

25 files changed

+64
-16
lines changed

examples/placeholder/templates/tests-commands.zapt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include "TestCommand.h"
66

7-
#include <lib/support/CHIPListUtils.h>
7+
#include <app/data-model/ListLargeSystemExtensions.h>
88

99
{{>test_cluster tests="../linux/apps/app1/ciTests.json" credsIssuerConfigArg=false needsWaitDuration=false}}
1010

examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "ConversionUtils.h"
2323
#include "JNIDACProvider.h"
2424

25+
#include <app/data-model/ListLargeSystemExtensions.h>
2526
#include <app/server/Server.h>
2627
#include <app/server/java/AndroidAppServerWrapper.h>
2728
#include <credentials/DeviceAttestationCredsProvider.h>
@@ -32,7 +33,6 @@
3233
#include <lib/core/Optional.h>
3334
#include <lib/dnssd/Resolver.h>
3435
#include <lib/support/CHIPJNIError.h>
35-
#include <lib/support/CHIPListUtils.h>
3636
#include <lib/support/JniReferences.h>
3737
#include <lib/support/JniTypeWrappers.h>
3838

examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
#import "MatterCallbacks.h"
2626
#import "OnboardingPayload.h"
2727

28+
#include <app/data-model/ListLargeSystemExtensions.h>
2829
#include <credentials/DeviceAttestationCredsProvider.h>
2930
#include <credentials/attestation_verifier/DefaultDeviceAttestationVerifier.h>
3031
#include <credentials/attestation_verifier/DeviceAttestationVerifier.h>
31-
#include <lib/support/CHIPListUtils.h>
3232
#include <lib/support/CHIPMem.h>
3333
#include <platform/PlatformManager.h>
3434

scripts/tools/check_includes_config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
'vector',
9494

9595
# CHIP headers using STL containers.
96-
'lib/support/CHIPListUtils.h', # uses std::set
96+
'app/data-model/ListLargeSystemExtensions.h', # uses std::set
9797
'src/platform/DeviceSafeQueue.h', # uses std::deque
9898
}
9999

@@ -113,7 +113,7 @@
113113
'src/lib/support/IniEscaping.h': {'string'},
114114

115115
# Itself in DENY.
116-
'src/lib/support/CHIPListUtils.h': {'set'},
116+
'src/app/data-model/ListLargeSystemExtensions.h': {'set'},
117117
'src/platform/DeviceSafeQueue.h': {'queue'},
118118

119119
# Only uses <chrono> for zero-cost types.

src/lib/support/CHIPListUtils.h src/app/data-model/ListLargeSystemExtensions.h

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (c) 2021 Project CHIP Authors
3+
* Copyright (c) 2024 Project CHIP Authors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -15,10 +15,12 @@
1515
* limitations under the License.
1616
*/
1717

18-
#ifndef CHIP_LISTUTILS_INTERNAL_H
19-
#define CHIP_LISTUTILS_INTERNAL_H
18+
#pragma once
2019

20+
// NOTE: Functionality in this class uses HEAP and std::set. It is generally
21+
// intended for large systems only
2122
#include <app/data-model/List.h>
23+
2224
#include <set>
2325
#include <type_traits>
2426

@@ -27,6 +29,7 @@ template <typename T>
2729
struct ListMemberTypeGetter
2830
{
2931
};
32+
3033
template <typename T>
3134
struct ListMemberTypeGetter<chip::app::DataModel::List<T>>
3235
{
@@ -63,5 +66,3 @@ struct ListFreer
6366

6467
std::set<ListHolderBase *> mListHolders;
6568
};
66-
67-
#endif /* CHIP_LISTUTILS_INTERNAL_H */

src/app/server/BUILD.gn

+5
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ static_library("server") {
6262
"${chip_root}/src/transport",
6363
]
6464

65+
# TODO: Server.cpp uses TestGroupData.h. Unsure why test code would be in such a central place
66+
# This dependency is split since it should probably be removed (or naming should
67+
# be updated if this is not really "testing" even though headers are Test*.h)
68+
public_deps += [ "${chip_root}/src/lib/support:testing" ]
69+
6570
if (chip_enable_icd_server) {
6671
public_deps += [ "${chip_root}/src/app/icd/server:notifier" ]
6772
}

src/app/tests/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ chip_test_suite_using_nltest("tests") {
213213
"${chip_root}/src/app/util/mock:mock_ember",
214214
"${chip_root}/src/lib/core",
215215
"${chip_root}/src/lib/support:test_utils",
216+
"${chip_root}/src/lib/support:testing",
216217
"${chip_root}/src/lib/support:testing_nlunit",
217218
"${nlunit_test_root}:nlunit-test",
218219
]

src/controller/BUILD.gn

+5
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,10 @@ static_library("controller") {
8181

8282
deps = [ "${chip_root}/src/lib/address_resolve" ]
8383

84+
if (chip_controller && chip_build_controller) {
85+
# ExampleOperationalCredentialsIssuer uses TestGroupData
86+
deps += [ "${chip_root}/src/lib/support:testing" ]
87+
}
88+
8489
defines = []
8590
}

src/controller/python/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ shared_library("ChipDeviceCtrl") {
130130
public_deps += [
131131
"${chip_root}/src/controller/data_model",
132132
"${chip_root}/src/credentials:file_attestation_trust_store",
133+
"${chip_root}/src/lib/support:testing",
133134
"${chip_root}/src/tracing/json",
134135
"${chip_root}/src/tracing/perfetto",
135136
"${chip_root}/src/tracing/perfetto:file_output",

src/credentials/tests/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ chip_test_suite_using_nltest("tests") {
7070
"${chip_root}/src/credentials",
7171
"${chip_root}/src/credentials:default_attestation_verifier",
7272
"${chip_root}/src/lib/core",
73+
"${chip_root}/src/lib/support:testing",
7374
"${chip_root}/src/lib/support:testing_nlunit",
7475
"${nlunit_test_root}:nlunit-test",
7576
]

src/crypto/tests/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ chip_test_suite_using_nltest("tests") {
6969
"${chip_root}/src/credentials/tests:cert_test_vectors",
7070
"${chip_root}/src/crypto",
7171
"${chip_root}/src/lib/core",
72+
"${chip_root}/src/lib/support:testing",
7273
"${chip_root}/src/lib/support:testing_nlunit",
7374
"${chip_root}/src/platform",
7475
"${nlunit_test_root}:nlunit-test",

src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <app-common/zap-generated/cluster-objects.h>
1818
#include <app/util/im-client-callbacks.h>
1919
#include <controller/CHIPCluster.h>
20-
#include <lib/support/CHIPListUtils.h>
20+
#include <app/data-model/ListLargeSystemExtensions.h>
2121
#include <platform/CHIPDeviceLayer.h>
2222

2323
#include <type_traits>

src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <app/data-model/Decode.h>
1414
#include <lib/core/TLV.h>
15-
#include <lib/support/CHIPListUtils.h>
15+
#include <app/data-model/ListLargeSystemExtensions.h>
1616
#include <lib/support/CodeUtils.h>
1717
#include <system/TLVPacketBufferBackingStore.h>
1818

src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/core/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ source_set("error") {
101101
public_deps = [
102102
":chip_config_header",
103103
"${chip_root}/src/lib/support:attributes",
104+
"${chip_root}/src/lib/support:type-traits",
104105
]
105106
}
106107

src/lib/support/BUILD.gn

+25
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,17 @@ source_set("chip_version_header") {
160160
deps = [ ":gen_chip_version" ]
161161
}
162162

163+
source_set("testing") {
164+
sources = [
165+
"TestGroupData.h",
166+
"TestPersistentStorageDelegate.h",
167+
]
168+
}
169+
170+
source_set("type-traits") {
171+
sources = [ "TypeTraits.h" ]
172+
}
173+
163174
static_library("support") {
164175
output_name = "libSupportLayer"
165176

@@ -179,28 +190,40 @@ static_library("support") {
179190
"CHIPArgParser.cpp",
180191
"CHIPCounter.h",
181192
"CHIPMemString.h",
193+
"CommonIterator.h",
194+
"CommonPersistentData.h",
182195
"DLLUtil.h",
183196
"DefaultStorageKeyAllocator.h",
184197
"Defer.h",
185198
"FibonacciUtils.cpp",
186199
"FibonacciUtils.h",
187200
"FixedBufferAllocator.cpp",
188201
"FixedBufferAllocator.h",
202+
"Fold.h",
203+
"FunctionTraits.h",
189204
"IniEscaping.cpp",
190205
"IniEscaping.h",
206+
"IntrusiveList.h",
191207
"Iterators.h",
208+
"LambdaBridge.h",
192209
"LifetimePersistedCounter.h",
193210
"ObjectLifeCycle.h",
211+
"OwnerOf.h",
194212
"PersistedCounter.h",
213+
"PersistentData.h",
195214
"PersistentStorageAudit.cpp",
196215
"PersistentStorageAudit.h",
197216
"PersistentStorageMacros.h",
198217
"Pool.cpp",
199218
"Pool.h",
219+
"PoolWrapper.h",
200220
"PrivateHeap.cpp",
201221
"PrivateHeap.h",
202222
"ReferenceCountedHandle.h",
223+
"SafePointerCast.h",
224+
"SafeString.h",
203225
"Scoped.h",
226+
"ScopedBuffer.h",
204227
"SerializableIntegerSet.cpp",
205228
"SerializableIntegerSet.h",
206229
"SetupDiscriminator.h",
@@ -252,6 +275,7 @@ static_library("support") {
252275
":safeint",
253276
":span",
254277
":text_only_logging",
278+
":type-traits",
255279
":verifymacros",
256280
":verifymacros_no_logging",
257281
"${chip_root}/src/lib/core:chip_config_header",
@@ -335,6 +359,7 @@ static_library("testing_nlunit") {
335359
output_dir = "${root_out_dir}/lib"
336360

337361
sources = [
362+
"UnitTestContext.h",
338363
"UnitTestExtendedAssertions.h",
339364
"UnitTestRegistration.cpp",
340365
"UnitTestRegistration.h",

src/lib/support/tests/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ chip_test_suite_using_nltest("tests") {
7979
public_deps = [
8080
"${chip_root}/src/credentials",
8181
"${chip_root}/src/lib/core",
82+
"${chip_root}/src/lib/support:testing",
8283
"${chip_root}/src/lib/support:testing_nlunit",
8384
"${chip_root}/src/lib/support/jsontlv",
8485
"${chip_root}/src/platform",

src/messaging/tests/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static_library("helpers") {
3232

3333
deps = [
3434
"${chip_root}/src/credentials/tests:cert_test_vectors",
35+
"${chip_root}/src/lib/support:testing",
3536
"${chip_root}/src/messaging",
3637
"${chip_root}/src/protocols",
3738
"${chip_root}/src/transport",

src/protocols/secure_channel/BUILD.gn

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ static_library("type_definitions") {
1212
cflags = [ "-Wconversion" ]
1313

1414
public_deps = [
15+
"${chip_root}/src/lib/support:type-traits",
1516
"${chip_root}/src/protocols:type_definitions",
1617
"${chip_root}/src/system",
1718
]
@@ -55,6 +56,7 @@ static_library("secure_channel") {
5556
"${chip_root}/src/crypto",
5657
"${chip_root}/src/lib/core",
5758
"${chip_root}/src/lib/support",
59+
"${chip_root}/src/lib/support:type-traits",
5860
"${chip_root}/src/messaging",
5961
"${chip_root}/src/system",
6062
"${chip_root}/src/tracing",

src/protocols/secure_channel/tests/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ chip_test_suite_using_nltest("tests") {
2929
"${chip_root}/src/lib/core",
3030
"${chip_root}/src/lib/support",
3131
"${chip_root}/src/lib/support:test_utils",
32+
"${chip_root}/src/lib/support:testing",
3233
"${chip_root}/src/lib/support:testing_nlunit",
3334
"${chip_root}/src/messaging/tests:helpers",
3435
"${chip_root}/src/protocols",

src/transport/raw/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ static_library("raw") {
4444
"${chip_root}/src/inet",
4545
"${chip_root}/src/lib/core",
4646
"${chip_root}/src/lib/support",
47+
"${chip_root}/src/lib/support:type-traits",
4748
"${chip_root}/src/platform",
4849
]
4950
}

src/transport/tests/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ chip_test_suite_using_nltest("tests") {
5454
"${chip_root}/src/inet/tests:helpers",
5555
"${chip_root}/src/lib/core",
5656
"${chip_root}/src/lib/support",
57+
"${chip_root}/src/lib/support:testing",
5758
"${chip_root}/src/lib/support:testing_nlunit",
5859
"${chip_root}/src/protocols",
5960
"${chip_root}/src/transport",

zzz_generated/placeholder/app1/zap-generated/test/Commands.h

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zzz_generated/placeholder/app2/zap-generated/test/Commands.h

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)