Skip to content

Commit

Permalink
Tidy up dependencies of //examples/platform/linux:app-main (#26408)
Browse files Browse the repository at this point in the history
* Remove CommonRpc.h (identical copy of Rpc.h)

* Remove some unused GN imports

* Run zap_cluster_list.py directly instead of through gn_run_binary.py

* Tidy up dependencies of //examples/platform/linux:app-main

- Use deps instead of public_deps where possible
- Only build shell commands if chip_build_libshell is true
- Remove explicit //src/lib/shell dependencies, it's already pulled in by //src/lib

* Fix tv-app / tv-casting-app deps and don't import args.gni directly
  • Loading branch information
ksperling-apple authored and pull[bot] committed Oct 17, 2023
1 parent a718fd0 commit 2180994
Show file tree
Hide file tree
Showing 20 changed files with 54 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@

#include "binding-handler.h"

#include "app-common/zap-generated/ids/Clusters.h"
#include "app-common/zap-generated/ids/Commands.h"
#include "app/CommandSender.h"
#include "app/clusters/bindings/BindingManager.h"
#include "app/server/Server.h"
#include "controller/InvokeInteraction.h"
#include "lib/core/CHIPError.h"
#include "platform/CHIPDeviceLayer.h"
#include <app-common/zap-generated/ids/Clusters.h>
#include <app-common/zap-generated/ids/Commands.h>
#include <app/CommandSender.h>
#include <app/clusters/bindings/BindingManager.h>
#include <app/server/Server.h>
#include <controller/InvokeInteraction.h>
#include <lib/core/CHIPError.h>
#include <platform/CHIPDeviceLayer.h>

#if defined(ENABLE_CHIP_SHELL)
#include "lib/shell/Engine.h"
#include <lib/shell/Engine.h> // nogncheck

using chip::Shell::Engine;
using chip::Shell::shell_command_t;
Expand Down
1 change: 0 additions & 1 deletion examples/contact-sensor-app/contact-sensor-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import("//build_overrides/chip.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/app/chip_data_model.gni")

chip_data_model("contact-sensor-common") {
Expand Down
1 change: 0 additions & 1 deletion examples/light-switch-app/light-switch-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import("//build_overrides/chip.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/app/chip_data_model.gni")

chip_data_model("light-switch-common") {
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/lighting-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import("//build_overrides/chip.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/app/chip_data_model.gni")

config("config") {
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/qpg/zap/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import("//build_overrides/chip.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/app/chip_data_model.gni")

chip_data_model("zap") {
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/lock-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import("//build_overrides/chip.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/app/chip_data_model.gni")

chip_data_model("lock-common") {
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/nxp/zap/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import("//build_overrides/chip.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/app/chip_data_model.gni")

chip_data_model("zap") {
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/qpg/zap/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import("//build_overrides/chip.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/app/chip_data_model.gni")

chip_data_model("zap") {
Expand Down
5 changes: 2 additions & 3 deletions examples/platform/linux/AppMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <platform/CHIPDeviceLayer.h>
#include <platform/PlatformManager.h>

#include <app/clusters/network-commissioning/network-commissioning.h>
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <crypto/CHIPCryptoPAL.h>
Expand Down Expand Up @@ -53,12 +52,12 @@

#if defined(ENABLE_CHIP_SHELL)
#include <CommissioneeShellCommands.h>
#include <lib/shell/Engine.h>
#include <lib/shell/Engine.h> // nogncheck
#include <thread>
#endif

#if defined(PW_RPC_ENABLED)
#include <CommonRpc.h>
#include <Rpc.h>
#endif

#if CHIP_CONFIG_TRANSPORT_TRACE_ENABLED
Expand Down
51 changes: 20 additions & 31 deletions examples/platform/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@ source_set("app-main") {
"AppMain.h",
"CommissionableInit.cpp",
"CommissionableInit.h",
"CommissioneeShellCommands.cpp",
"CommissioneeShellCommands.h",
"CommissionerMain.cpp",
"CommissionerMain.h",
"ControllerShellCommands.cpp",
"ControllerShellCommands.h",
"LinuxCommissionableDataProvider.cpp",
"LinuxCommissionableDataProvider.h",
"NamedPipeCommands.cpp",
Expand All @@ -53,29 +49,32 @@ source_set("app-main") {
"testing/CustomCSRResponseOperationalKeyStore.h",
]

defines = []
public_deps = [
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:force_stdio",
]
deps = [
":ota-test-event-trigger",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/app/server",
]

if (chip_enable_pw_rpc) {
defines += [ "PW_RPC_ENABLED" ]
}

if (chip_build_libshell) {
defines += [ "ENABLE_CHIP_SHELL" ]
sources += [
"CommissioneeShellCommands.cpp",
"CommissioneeShellCommands.h",
"ControllerShellCommands.cpp",
"ControllerShellCommands.h",
]
}

public_deps = [
":ota-test-event-trigger",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/app/server",
"${chip_root}/src/credentials:default_attestation_verifier",
"${chip_root}/src/lib",
"${chip_root}/src/lib/shell",
"${chip_root}/src/lib/shell:shell_core",
"${chip_root}/src/platform/logging:force_stdio",
]

if (chip_enable_transport_trace) {
public_deps +=
[ "${chip_root}/examples/common/tracing:trace_handlers_decoder" ]
deps += [ "${chip_root}/examples/common/tracing:trace_handlers_decoder" ]
}

public_configs = [ ":app-main-config" ]
Expand All @@ -88,25 +87,15 @@ source_set("commissioner-main") {
"CommissionerMain.h",
]

defines = []

if (chip_enable_pw_rpc) {
defines += [ "PW_RPC_ENABLED" ]
}
if (chip_build_libshell) {
defines += [ "ENABLE_CHIP_SHELL" ]
}

public_deps = [
"${chip_root}/src/app/server",
"${chip_root}/src/credentials:default_attestation_verifier",
"${chip_root}/src/lib",
"${chip_root}/src/lib/shell",
"${chip_root}/src/lib/shell:shell_core",
]
public_deps = [ "${chip_root}/src/lib" ]
deps = [ "${chip_root}/src/app/server" ]

if (chip_enable_transport_trace) {
public_deps += [ "${chip_root}/examples/common/tracing:trace_handlers" ]
deps += [ "${chip_root}/examples/common/tracing:trace_handlers" ]
}

public_configs = [ ":app-main-config" ]
Expand Down
4 changes: 0 additions & 4 deletions examples/platform/linux/CommissionerMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@
#include <lib/core/CHIPPersistentStorageDelegate.h>
#include <platform/KeyValueStoreManager.h>

#if defined(PW_RPC_ENABLED)
#include <CommonRpc.h>
#endif

#if CHIP_CONFIG_TRANSPORT_TRACE_ENABLED
#include "TraceHandlers.h"
#endif // CHIP_CONFIG_TRANSPORT_TRACE_ENABLED
Expand Down
27 changes: 0 additions & 27 deletions examples/platform/linux/CommonRpc.h

This file was deleted.

2 changes: 1 addition & 1 deletion examples/platform/nxp/se05x/linux/AppMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#endif

#if defined(PW_RPC_ENABLED)
#include <CommonRpc.h>
#include <Rpc.h>
#endif

#if CHIP_CONFIG_TRANSPORT_TRACE_ENABLED
Expand Down
2 changes: 0 additions & 2 deletions examples/platform/nxp/se05x/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ source_set("commissioner-main") {
"${chip_root}/src/app/server",
"${chip_root}/src/credentials:default_attestation_verifier",
"${chip_root}/src/lib",
"${chip_root}/src/lib/shell",
"${chip_root}/src/lib/shell:shell_core",
]

if (chip_enable_transport_trace) {
Expand Down
3 changes: 0 additions & 3 deletions examples/tv-app/linux/AppImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
#include <inttypes.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/DataModelTypes.h>
#include <lib/shell/Commands.h>
#include <lib/shell/Engine.h>
#include <lib/shell/commands/Help.h>
#include <lib/support/CHIPArgParser.hpp>
#include <lib/support/CHIPMem.h>
#include <lib/support/CodeUtils.h>
Expand Down
25 changes: 9 additions & 16 deletions examples/tv-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,16 @@

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("args.gni")

import("${chip_root}/build/chip/tools.gni")
import("${chip_root}/src/lib/lib.gni")

assert(chip_build_tools)

config("config") {
include_dirs = [
".",
"${chip_root}/zzz_generated/chip-tv-app",
"${chip_root}/src/lib",
]

cflags = [ "-Wconversion" ]
}

executable("chip-tv-app") {
sources = [
"${chip_root}/examples/tv-app/tv-common/include/CHIPProjectAppConfig.h",
"AppImpl.cpp",
"AppImpl.h",
"AppPlatformShellCommands.cpp",
"ZclCallbacks.cpp",
"include/account-login/AccountLoginManager.cpp",
"include/account-login/AccountLoginManager.h",
Expand Down Expand Up @@ -74,11 +62,16 @@ executable("chip-tv-app") {
]

cflags = [ "-Wconversion" ]

public_configs = [ ":config" ]
defines = []
include_dirs = [
".",
"${chip_root}/zzz_generated/chip-tv-app",
"${chip_root}/src/lib",
]

if (chip_build_libshell) {
cflags += [ "-DENABLE_CHIP_SHELL" ]
defines += [ "ENABLE_CHIP_SHELL" ]
sources += [ "AppPlatformShellCommands.cpp" ]
}

output_dir = root_out_dir
Expand Down
2 changes: 1 addition & 1 deletion examples/tv-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "include/wake-on-lan/WakeOnLanManager.h"

#if defined(ENABLE_CHIP_SHELL)
#include <lib/shell/Engine.h>
#include <lib/shell/Engine.h> // nogncheck
#endif

using namespace chip;
Expand Down
12 changes: 7 additions & 5 deletions examples/tv-casting-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("args.gni")

import("${chip_root}/build/chip/tools.gni")
import("${chip_root}/src/lib/lib.gni")

assert(chip_build_tools)

executable("chip-tv-casting-app") {
sources = [
"${chip_root}/examples/tv-casting-app/tv-casting-common/include/CHIPProjectAppConfig.h",
"CastingShellCommands.cpp",
"CastingShellCommands.h",
"CastingUtils.cpp",
"CastingUtils.h",
"main.cpp",
Expand All @@ -39,13 +36,18 @@ executable("chip-tv-casting-app") {
"${chip_root}/third_party/jsoncpp",
]

defines = []
include_dirs =
[ "${chip_root}/examples/tv-casting-app/tv-casting-common/include" ]

cflags = [ "-Wconversion" ]

if (chip_build_libshell) {
cflags += [ "-DENABLE_CHIP_SHELL" ]
defines += [ "ENABLE_CHIP_SHELL" ]
sources += [
"CastingShellCommands.cpp",
"CastingShellCommands.h",
]
}

output_dir = root_out_dir
Expand Down
2 changes: 1 addition & 1 deletion examples/tv-casting-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "CastingUtils.h"
#if defined(ENABLE_CHIP_SHELL)
#include "CastingShellCommands.h"
#include <lib/shell/Engine.h>
#include <lib/shell/Engine.h> // nogncheck
#include <thread>
#endif

Expand Down
Loading

0 comments on commit 2180994

Please sign in to comment.