Skip to content

Commit

Permalink
Add "orphaned" header files from src/lib/support into gn (#31807)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
andy31415 authored Feb 1, 2024
1 parent 38d5e18 commit f9ffe55
Show file tree
Hide file tree
Showing 25 changed files with 64 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/placeholder/templates/tests-commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "TestCommand.h"

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "ConversionUtils.h"
#include "JNIDACProvider.h"

#include <app/data-model/ListLargeSystemExtensions.h>
#include <app/server/Server.h>
#include <app/server/java/AndroidAppServerWrapper.h>
#include <credentials/DeviceAttestationCredsProvider.h>
Expand All @@ -32,7 +33,6 @@
#include <lib/core/Optional.h>
#include <lib/dnssd/Resolver.h>
#include <lib/support/CHIPJNIError.h>
#include <lib/support/CHIPListUtils.h>
#include <lib/support/JniReferences.h>
#include <lib/support/JniTypeWrappers.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
#import "MatterCallbacks.h"
#import "OnboardingPayload.h"

#include <app/data-model/ListLargeSystemExtensions.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <credentials/attestation_verifier/DefaultDeviceAttestationVerifier.h>
#include <credentials/attestation_verifier/DeviceAttestationVerifier.h>
#include <lib/support/CHIPListUtils.h>
#include <lib/support/CHIPMem.h>
#include <platform/PlatformManager.h>

Expand Down
4 changes: 2 additions & 2 deletions scripts/tools/check_includes_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
'vector',

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

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

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

# Only uses <chrono> for zero-cost types.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2024 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,10 +15,12 @@
* limitations under the License.
*/

#ifndef CHIP_LISTUTILS_INTERNAL_H
#define CHIP_LISTUTILS_INTERNAL_H
#pragma once

// NOTE: Functionality in this class uses HEAP and std::set. It is generally
// intended for large systems only
#include <app/data-model/List.h>

#include <set>
#include <type_traits>

Expand All @@ -27,6 +29,7 @@ template <typename T>
struct ListMemberTypeGetter
{
};

template <typename T>
struct ListMemberTypeGetter<chip::app::DataModel::List<T>>
{
Expand Down Expand Up @@ -63,5 +66,3 @@ struct ListFreer

std::set<ListHolderBase *> mListHolders;
};

#endif /* CHIP_LISTUTILS_INTERNAL_H */
5 changes: 5 additions & 0 deletions src/app/server/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ static_library("server") {
"${chip_root}/src/transport",
]

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

if (chip_enable_icd_server) {
public_deps += [ "${chip_root}/src/app/icd/server:notifier" ]
}
Expand Down
1 change: 1 addition & 0 deletions src/app/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ chip_test_suite_using_nltest("tests") {
"${chip_root}/src/app/util/mock:mock_ember",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support:test_utils",
"${chip_root}/src/lib/support:testing",
"${chip_root}/src/lib/support:testing_nlunit",
"${nlunit_test_root}:nlunit-test",
]
Expand Down
5 changes: 5 additions & 0 deletions src/controller/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,10 @@ static_library("controller") {

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

if (chip_controller && chip_build_controller) {
# ExampleOperationalCredentialsIssuer uses TestGroupData
deps += [ "${chip_root}/src/lib/support:testing" ]
}

defines = []
}
1 change: 1 addition & 0 deletions src/controller/python/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ shared_library("ChipDeviceCtrl") {
public_deps += [
"${chip_root}/src/controller/data_model",
"${chip_root}/src/credentials:file_attestation_trust_store",
"${chip_root}/src/lib/support:testing",
"${chip_root}/src/tracing/json",
"${chip_root}/src/tracing/perfetto",
"${chip_root}/src/tracing/perfetto:file_output",
Expand Down
1 change: 1 addition & 0 deletions src/credentials/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ chip_test_suite_using_nltest("tests") {
"${chip_root}/src/credentials",
"${chip_root}/src/credentials:default_attestation_verifier",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support:testing",
"${chip_root}/src/lib/support:testing_nlunit",
"${nlunit_test_root}:nlunit-test",
]
Expand Down
1 change: 1 addition & 0 deletions src/crypto/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ chip_test_suite_using_nltest("tests") {
"${chip_root}/src/credentials/tests:cert_test_vectors",
"${chip_root}/src/crypto",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support:testing",
"${chip_root}/src/lib/support:testing_nlunit",
"${chip_root}/src/platform",
"${nlunit_test_root}:nlunit-test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <app-common/zap-generated/cluster-objects.h>
#include <app/util/im-client-callbacks.h>
#include <controller/CHIPCluster.h>
#include <lib/support/CHIPListUtils.h>
#include <app/data-model/ListLargeSystemExtensions.h>
#include <platform/CHIPDeviceLayer.h>

#include <type_traits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <app/data-model/Decode.h>
#include <lib/core/TLV.h>
#include <lib/support/CHIPListUtils.h>
#include <app/data-model/ListLargeSystemExtensions.h>
#include <lib/support/CodeUtils.h>
#include <system/TLVPacketBufferBackingStore.h>

Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/lib/core/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ source_set("error") {
public_deps = [
":chip_config_header",
"${chip_root}/src/lib/support:attributes",
"${chip_root}/src/lib/support:type-traits",
]
}

Expand Down
25 changes: 25 additions & 0 deletions src/lib/support/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@ source_set("chip_version_header") {
deps = [ ":gen_chip_version" ]
}

source_set("testing") {
sources = [
"TestGroupData.h",
"TestPersistentStorageDelegate.h",
]
}

source_set("type-traits") {
sources = [ "TypeTraits.h" ]
}

static_library("support") {
output_name = "libSupportLayer"

Expand All @@ -179,28 +190,40 @@ static_library("support") {
"CHIPArgParser.cpp",
"CHIPCounter.h",
"CHIPMemString.h",
"CommonIterator.h",
"CommonPersistentData.h",
"DLLUtil.h",
"DefaultStorageKeyAllocator.h",
"Defer.h",
"FibonacciUtils.cpp",
"FibonacciUtils.h",
"FixedBufferAllocator.cpp",
"FixedBufferAllocator.h",
"Fold.h",
"FunctionTraits.h",
"IniEscaping.cpp",
"IniEscaping.h",
"IntrusiveList.h",
"Iterators.h",
"LambdaBridge.h",
"LifetimePersistedCounter.h",
"ObjectLifeCycle.h",
"OwnerOf.h",
"PersistedCounter.h",
"PersistentData.h",
"PersistentStorageAudit.cpp",
"PersistentStorageAudit.h",
"PersistentStorageMacros.h",
"Pool.cpp",
"Pool.h",
"PoolWrapper.h",
"PrivateHeap.cpp",
"PrivateHeap.h",
"ReferenceCountedHandle.h",
"SafePointerCast.h",
"SafeString.h",
"Scoped.h",
"ScopedBuffer.h",
"SerializableIntegerSet.cpp",
"SerializableIntegerSet.h",
"SetupDiscriminator.h",
Expand Down Expand Up @@ -252,6 +275,7 @@ static_library("support") {
":safeint",
":span",
":text_only_logging",
":type-traits",
":verifymacros",
":verifymacros_no_logging",
"${chip_root}/src/lib/core:chip_config_header",
Expand Down Expand Up @@ -335,6 +359,7 @@ static_library("testing_nlunit") {
output_dir = "${root_out_dir}/lib"

sources = [
"UnitTestContext.h",
"UnitTestExtendedAssertions.h",
"UnitTestRegistration.cpp",
"UnitTestRegistration.h",
Expand Down
1 change: 1 addition & 0 deletions src/lib/support/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ chip_test_suite_using_nltest("tests") {
public_deps = [
"${chip_root}/src/credentials",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support:testing",
"${chip_root}/src/lib/support:testing_nlunit",
"${chip_root}/src/lib/support/jsontlv",
"${chip_root}/src/platform",
Expand Down
1 change: 1 addition & 0 deletions src/messaging/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ static_library("helpers") {

deps = [
"${chip_root}/src/credentials/tests:cert_test_vectors",
"${chip_root}/src/lib/support:testing",
"${chip_root}/src/messaging",
"${chip_root}/src/protocols",
"${chip_root}/src/transport",
Expand Down
2 changes: 2 additions & 0 deletions src/protocols/secure_channel/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ static_library("type_definitions") {
cflags = [ "-Wconversion" ]

public_deps = [
"${chip_root}/src/lib/support:type-traits",
"${chip_root}/src/protocols:type_definitions",
"${chip_root}/src/system",
]
Expand Down Expand Up @@ -55,6 +56,7 @@ static_library("secure_channel") {
"${chip_root}/src/crypto",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/lib/support:type-traits",
"${chip_root}/src/messaging",
"${chip_root}/src/system",
"${chip_root}/src/tracing",
Expand Down
1 change: 1 addition & 0 deletions src/protocols/secure_channel/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ chip_test_suite_using_nltest("tests") {
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/lib/support:test_utils",
"${chip_root}/src/lib/support:testing",
"${chip_root}/src/lib/support:testing_nlunit",
"${chip_root}/src/messaging/tests:helpers",
"${chip_root}/src/protocols",
Expand Down
1 change: 1 addition & 0 deletions src/transport/raw/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static_library("raw") {
"${chip_root}/src/inet",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/lib/support:type-traits",
"${chip_root}/src/platform",
]
}
1 change: 1 addition & 0 deletions src/transport/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ chip_test_suite_using_nltest("tests") {
"${chip_root}/src/inet/tests:helpers",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/lib/support:testing",
"${chip_root}/src/lib/support:testing_nlunit",
"${chip_root}/src/protocols",
"${chip_root}/src/transport",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f9ffe55

Please sign in to comment.