From 88d6a6111ebf6b7583a126612754ba22fdc63231 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 1 Feb 2024 00:25:59 -0500 Subject: [PATCH] Add "orphaned" header files from src/lib/core into gn (#31810) * Unorphan several files from core ... lets see how things compile * Pull out some separate headers into a new group as core references support * Add a lot of types dependencies * Add some missing headers because of bad include paths * One more sytem clock reference * Remove nonsense file commend from Unchecked ... copy and paste of these keeps getting us * Remove one more copy & pasted comment in a header * Add utility header to Optional * Fix boufallolab include --- examples/chip-tool/BUILD.gn | 1 + examples/common/tracing/BUILD.gn | 6 +++- examples/common/websocket-server/BUILD.gn | 1 + src/access/BUILD.gn | 1 + src/app/BUILD.gn | 1 + .../DeferredAttributePersistenceProvider.h | 1 + src/credentials/BUILD.gn | 1 + src/credentials/CHIPCert.h | 1 + src/crypto/BUILD.gn | 1 + src/inet/BUILD.gn | 1 + src/lib/core/BUILD.gn | 28 +++++++++++++++++++ src/lib/core/InPlace.h | 7 ----- src/lib/core/Optional.h | 3 +- src/lib/core/Unchecked.h | 7 ----- src/lib/support/BUILD.gn | 6 +++- .../common/CHIPDevicePlatformEvent.h | 1 + src/protocols/bdx/BdxTransferSession.h | 1 + 17 files changed, 51 insertions(+), 17 deletions(-) diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index c6f5edc819ba95..a27c3cd65716bd 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -110,6 +110,7 @@ static_library("chip-tool-utils") { "${chip_root}/src/controller/data_model", "${chip_root}/src/credentials:file_attestation_trust_store", "${chip_root}/src/lib", + "${chip_root}/src/lib/core:types", "${chip_root}/src/lib/support/jsontlv", "${chip_root}/src/platform", "${chip_root}/third_party/inipp", diff --git a/examples/common/tracing/BUILD.gn b/examples/common/tracing/BUILD.gn index 266c3fc0f31581..cf6fdc2da525b4 100644 --- a/examples/common/tracing/BUILD.gn +++ b/examples/common/tracing/BUILD.gn @@ -93,7 +93,10 @@ source_set("trace_handlers_decoder") { public_configs = [ ":default_config" ] - deps = [ "${chip_root}/src/lib" ] + deps = [ + "${chip_root}/src/lib", + "${chip_root}/src/lib/core:types", + ] public_deps = [ "${chip_root}/third_party/jsoncpp" ] cflags = [ "-Wconversion" ] @@ -121,6 +124,7 @@ executable("chip-trace-decoder") { public_deps = [ "${chip_root}/src/lib", + "${chip_root}/src/lib/core:types", "${chip_root}/third_party/jsoncpp", ] diff --git a/examples/common/websocket-server/BUILD.gn b/examples/common/websocket-server/BUILD.gn index 1ea2687ce6afda..7eee9e2a40c967 100644 --- a/examples/common/websocket-server/BUILD.gn +++ b/examples/common/websocket-server/BUILD.gn @@ -34,6 +34,7 @@ static_library("websocket-server") { ] public_deps = [ + "${chip_root}/src/lib/core:types", "${chip_root}/src/lib/support", "${chip_root}/third_party/libwebsockets", ] diff --git a/src/access/BUILD.gn b/src/access/BUILD.gn index 476c261bfde5e0..f1cc73c8f7262c 100644 --- a/src/access/BUILD.gn +++ b/src/access/BUILD.gn @@ -34,6 +34,7 @@ static_library("access") { public_deps = [ "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:types", "${chip_root}/src/lib/support", "${chip_root}/src/platform", ] diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 3ea0e2af0a5731..73e9d643abf81e 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -90,6 +90,7 @@ source_set("paths") { public_deps = [ ":app_config", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:types", ] } diff --git a/src/app/DeferredAttributePersistenceProvider.h b/src/app/DeferredAttributePersistenceProvider.h index c1023e9b8b8582..6c641dc17d4400 100644 --- a/src/app/DeferredAttributePersistenceProvider.h +++ b/src/app/DeferredAttributePersistenceProvider.h @@ -18,6 +18,7 @@ #include #include #include +#include namespace chip { namespace app { diff --git a/src/credentials/BUILD.gn b/src/credentials/BUILD.gn index 6aa10311560fa5..cd12f485e32009 100644 --- a/src/credentials/BUILD.gn +++ b/src/credentials/BUILD.gn @@ -125,6 +125,7 @@ static_library("credentials") { "${chip_root}/src/crypto", "${chip_root}/src/lib/asn1", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:types", "${chip_root}/src/lib/support", "${chip_root}/src/platform", "${chip_root}/src/protocols:type_definitions", diff --git a/src/credentials/CHIPCert.h b/src/credentials/CHIPCert.h index f59c6c36a59a27..5c8372d34954e4 100644 --- a/src/credentials/CHIPCert.h +++ b/src/credentials/CHIPCert.h @@ -40,6 +40,7 @@ #include #include #include +#include namespace chip { namespace Credentials { diff --git a/src/crypto/BUILD.gn b/src/crypto/BUILD.gn index 8cc7ba400f0ef0..bfd633947c903d 100644 --- a/src/crypto/BUILD.gn +++ b/src/crypto/BUILD.gn @@ -68,6 +68,7 @@ source_set("public_headers") { ":crypto_buildconfig", "${chip_root}/src/lib/asn1", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:types", "${chip_root}/src/lib/support", "${nlassert_root}:nlassert", ] diff --git a/src/inet/BUILD.gn b/src/inet/BUILD.gn index 8d6c07f40e3412..37213302a74be9 100644 --- a/src/inet/BUILD.gn +++ b/src/inet/BUILD.gn @@ -100,6 +100,7 @@ static_library("inet") { public_deps = [ ":inet_config_header", + "${chip_root}/src/lib/core:types", "${chip_root}/src/lib/support", "${chip_root}/src/platform:platform_config_header", "${chip_root}/src/system", diff --git a/src/lib/core/BUILD.gn b/src/lib/core/BUILD.gn index 88e3e37e8c3736..40ba50224d195d 100644 --- a/src/lib/core/BUILD.gn +++ b/src/lib/core/BUILD.gn @@ -104,6 +104,23 @@ source_set("error") { ] } +source_set("types") { + sources = [ + "CHIPSafeCasts.h", + "Global.h", + "InPlace.h", + "Optional.h", + "ReferenceCounted.h", + "Unchecked.h", + ] + + public_deps = [ + ":chip_config_header", + "${chip_root}/src/lib/support:memory", + "${chip_root}/src/lib/support:verifymacros", + ] +} + static_library("core") { output_name = "libChipCore" @@ -112,11 +129,13 @@ static_library("core") { # We should consider putting them directly in this directory # instead. "${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h", + "CASEAuthTag.h", "CHIPCallback.h", "CHIPCore.h", "CHIPEncoding.h", "CHIPKeyIds.cpp", "CHIPKeyIds.h", + "CHIPPersistentStorageDelegate.h", "ClusterEnums.h", "DataModelTypes.h", "GroupId.h", @@ -125,17 +144,26 @@ static_library("core") { "OTAImageHeader.h", "PasscodeId.h", "PeerId.h", + "ScopedNodeId.h", "TLV.h", + "TLVBackingStore.h", "TLVCircularBuffer.cpp", "TLVCircularBuffer.h", + "TLVCommon.h", + "TLVData.h", "TLVDebug.cpp", + "TLVDebug.h", "TLVReader.cpp", + "TLVReader.h", "TLVTags.cpp", "TLVTags.h", "TLVTypes.h", "TLVUpdater.cpp", + "TLVUpdater.h", "TLVUtilities.cpp", + "TLVUtilities.h", "TLVWriter.cpp", + "TLVWriter.h", ] cflags = [ "-Wconversion" ] diff --git a/src/lib/core/InPlace.h b/src/lib/core/InPlace.h index 14ce5773101412..60c691ae27e3a0 100644 --- a/src/lib/core/InPlace.h +++ b/src/lib/core/InPlace.h @@ -14,13 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * @file - * This file defines the chip::Optional class to handle values which may - * or may not be present. - * - */ #pragma once namespace chip { diff --git a/src/lib/core/Optional.h b/src/lib/core/Optional.h index 7278484a6e6be9..3d509f544c97cd 100644 --- a/src/lib/core/Optional.h +++ b/src/lib/core/Optional.h @@ -25,9 +25,10 @@ #include #include +#include -#include #include +#include namespace chip { diff --git a/src/lib/core/Unchecked.h b/src/lib/core/Unchecked.h index d7fab990268168..29283f5f130dba 100644 --- a/src/lib/core/Unchecked.h +++ b/src/lib/core/Unchecked.h @@ -14,13 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * @file - * This file defines the chip::Optional class to handle values which may - * or may not be present. - * - */ #pragma once namespace chip { diff --git a/src/lib/support/BUILD.gn b/src/lib/support/BUILD.gn index 9f71492a5b3877..0ead05ccfc55f1 100644 --- a/src/lib/support/BUILD.gn +++ b/src/lib/support/BUILD.gn @@ -149,7 +149,10 @@ source_set("verifymacros") { source_set("span") { sources = [ "Span.h" ] - public_deps = [ ":verifymacros" ] + public_deps = [ + ":verifymacros", + "${chip_root}/src/lib/core:types", + ] } source_set("chip_version_header") { @@ -254,6 +257,7 @@ static_library("support") { ":verifymacros_no_logging", "${chip_root}/src/lib/core:chip_config_header", "${chip_root}/src/lib/core:error", + "${chip_root}/src/lib/core:types", "${chip_root}/src/platform:platform_config_header", "${chip_root}/src/system:system_config_header", "${nlassert_root}:nlassert", diff --git a/src/platform/bouffalolab/common/CHIPDevicePlatformEvent.h b/src/platform/bouffalolab/common/CHIPDevicePlatformEvent.h index a7ee3ec529f146..c41a791fec4099 100644 --- a/src/platform/bouffalolab/common/CHIPDevicePlatformEvent.h +++ b/src/platform/bouffalolab/common/CHIPDevicePlatformEvent.h @@ -18,6 +18,7 @@ #pragma once #include +#include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE #include diff --git a/src/protocols/bdx/BdxTransferSession.h b/src/protocols/bdx/BdxTransferSession.h index f5ef397ca7d9e8..ccd241e7fe508c 100644 --- a/src/protocols/bdx/BdxTransferSession.h +++ b/src/protocols/bdx/BdxTransferSession.h @@ -9,6 +9,7 @@ #include #include +#include #include #include