Skip to content

Commit

Permalink
Clean up inclusion of private BuildConfig headers (#30531)
Browse files Browse the repository at this point in the history
Certain configuration headers come in pairs

CHIPConfig.h & CHIPBuildConfig.h
InetConfig.h & InetBuildConfig.h
CHIPDeviceConfig.h & CHIPDeviceBuildConfig.h
AppConfig.h & AppBuildConfig.h
BleConfig.h & BleBuildConfig.h

In these cases, the second header is only the portion of the
configuration that is generated by the build system and was intended to
be private; including it directly may not have expected results.

Furthermore, other build systems may not generate the BuildConfig.h
headers at all, which was supported through the CHIP_HAVE_CONFIG_H
define. Including them directly breaks that capability.

Standardize includes on the public headers and tell GN to enforce this.
  • Loading branch information
mspang authored and pull[bot] committed Feb 6, 2024
1 parent dec271f commit 5f210ba
Show file tree
Hide file tree
Showing 86 changed files with 119 additions and 100 deletions.
2 changes: 1 addition & 1 deletion examples/air-quality-sensor-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <air-quality-sensor-manager.h>

#include <app/util/af.h>
#include <platform/CHIPDeviceBuildConfig.h>
#include <platform/CHIPDeviceConfig.h>

#if defined(CHIP_IMGUI_ENABLED) && CHIP_IMGUI_ENABLED
#include <imgui_ui/ui.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/common/CHIPCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include "CHIPCommand.h"

#include <controller/CHIPDeviceControllerFactory.h>
#include <core/CHIPBuildConfig.h>
#include <credentials/attestation_verifier/FileAttestationTrustStore.h>
#include <lib/core/CHIPConfig.h>
#include <lib/core/CHIPVendorIdentifiers.hpp>
#include <lib/support/CodeUtils.h>
#include <lib/support/ScopedBuffer.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/common/DeviceScanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#pragma once

#include <platform/CHIPDeviceBuildConfig.h>
#include <platform/CHIPDeviceConfig.h>

#if CHIP_DEVICE_LAYER_TARGET_DARWIN

Expand Down
2 changes: 1 addition & 1 deletion examples/contact-sensor-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <AppMain.h>
#include <app/util/af.h>
#include <platform/CHIPDeviceBuildConfig.h>
#include <platform/CHIPDeviceConfig.h>

#if defined(CHIP_IMGUI_ENABLED) && CHIP_IMGUI_ENABLED
#include <imgui_ui/ui.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#import "CHIPToolKeypair.h"
#import <Matter/Matter.h>

#include <core/CHIPBuildConfig.h>
#include <lib/core/CHIPConfig.h>
#include <lib/core/CHIPVendorIdentifiers.hpp>

#include "MTRError_Utils.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <stdbool.h>
#include <stdint.h>

#include <platform/CHIPDeviceBuildConfig.h>
#include <platform/CHIPDeviceConfig.h>

#include <FreeRTOS.h>

Expand Down
4 changes: 2 additions & 2 deletions examples/platform/tizen/OptionsProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

#include <app_control.h>

#include <core/CHIPBuildConfig.h>
#include <platform/CHIPDeviceBuildConfig.h>
#include <lib/core/CHIPConfig.h>
#include <platform/CHIPDeviceConfig.h>

namespace {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <commands/common/CHIPCommand.h>

#include <core/CHIPBuildConfig.h>
#include <lib/core/CHIPConfig.h>
#include <lib/core/CHIPVendorIdentifiers.hpp>
#include <lib/support/CodeUtils.h>
#include <lib/support/ScopedBuffer.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/AttributePathParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#pragma once

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/ConcreteAttributePath.h>
#include <app/DataVersionFilter.h>
#include <app/util/basic-types.h>
Expand Down
4 changes: 3 additions & 1 deletion src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ buildconfig_header("app_buildconfig") {
"ICD_REPORT_ON_ENTER_ACTIVE_MODE=${chip_report_on_active_mode}",
"ICD_MAX_NOTIFICATION_SUBSCRIBERS=${icd_max_notification_subscribers}",
]

visibility = [ ":app_config" ]
}

source_set("revision_info") {
Expand All @@ -75,7 +77,7 @@ source_set("revision_info") {
source_set("app_config") {
sources = [ "AppConfig.h" ]

public_deps = [ ":app_buildconfig" ]
deps = [ ":app_buildconfig" ]
}

static_library("app") {
Expand Down
2 changes: 1 addition & 1 deletion src/app/BufferedReadCallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "lib/core/TLV.h"
#include "system/SystemPacketBuffer.h"
#include "system/TLVPacketBufferBackingStore.h"
#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/AttributePathParams.h>
#include <app/ReadClient.h>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion src/app/ClusterStateCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "lib/core/CHIPError.h"
#include "system/SystemPacketBuffer.h"
#include "system/TLVPacketBufferBackingStore.h"
#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/AttributePathParams.h>
#include <app/BufferedReadCallback.h>
#include <app/ReadClient.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/InteractionModelEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include "access/RequestPath.h"
#include "access/SubjectDescriptor.h"
#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/RequiredPrivilege.h>
#include <app/util/af-types.h>
#include <app/util/endpoint-config-api.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/InteractionModelEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#pragma once

#include <access/AccessControl.h>
#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/MessageDef/AttributeReportIBs.h>
#include <app/MessageDef/ReportDataMessage.h>
#include <lib/core/CHIPCore.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/AttributeDataIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "StructBuilder.h"
#include "StructParser.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/AttributeDataIBs.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "ArrayParser.h"
#include "AttributeDataIB.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/AttributePathIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "ListBuilder.h"
#include "ListParser.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/AttributePathParams.h>
#include <app/ConcreteAttributePath.h>
#include <app/data-model/Nullable.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/AttributePathIBs.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "ArrayParser.h"
#include "AttributePathIB.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/AttributeReportIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "StructBuilder.h"
#include "StructParser.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/AttributeReportIBs.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "ArrayParser.h"
#include "AttributeReportIB.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/ConcreteAttributePath.h>
#include <app/MessageDef/StatusIB.h>
#include <app/util/basic-types.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/AttributeStatusIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "StructBuilder.h"
#include "StructParser.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/AttributeStatusIBs.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "ArrayParser.h"
#include "AttributeStatusIB.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/ClusterPathIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "ListBuilder.h"
#include "ListParser.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/NodeId.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/CommandDataIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "StructBuilder.h"
#include "StructParser.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/CommandPathIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "ListBuilder.h"
#include "ListParser.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/CommandPathParams.h>
#include <app/ConcreteCommandPath.h>
#include <app/util/basic-types.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/CommandStatusIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "StatusIB.h"
#include "StructParser.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/DataVersionFilterIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "ClusterPathIB.h"
#include "StructBuilder.h"
#include "StructParser.h"
#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/DataVersionFilterIBs.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#pragma once

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/EventDataIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "EventPathIB.h"
#include "StructBuilder.h"
#include "StructParser.h"
#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/EventHeader.h>
#include <app/EventLoggingTypes.h>
#include <app/util/basic-types.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/EventFilterIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "StructBuilder.h"
#include "StructParser.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/NodeId.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/EventFilterIBs.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#pragma once

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/EventPathIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "ListBuilder.h"
#include "ListParser.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/ConcreteEventPath.h>
#include <app/EventPathParams.h>
#include <app/util/basic-types.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/EventPathIBs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "EventPathIB.h"
#include "EventPathIBs.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/EventReportIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "StructBuilder.h"
#include "StructParser.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/EventReportIBs.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "ArrayParser.h"
#include "EventReportIB.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/EventStatusIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "StructBuilder.h"
#include "StructParser.h"

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/InvokeRequestMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#pragma once

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/InvokeRequests.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#pragma once

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/InvokeResponseIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#pragma once

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/InvokeResponseIBs.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#pragma once

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/InvokeResponseMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#pragma once

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/TLV.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/MessageDefHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <stdarg.h>
#include <stdio.h>

#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>

// We need CHIPLogging.h to get the right value for CHIP_DETAIL_LOGGING here.
#include <lib/support/logging/CHIPLogging.h>
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/MessageParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "StructParser.h"
#include <app/AppBuildConfig.h>
#include <app/AppConfig.h>
#include <app/InteractionModelRevision.h>
#include <app/util/basic-types.h>

Expand Down
Loading

0 comments on commit 5f210ba

Please sign in to comment.