From d10d10df7cc73ada7d8039e5e939473d09aca818 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Wed, 30 Mar 2022 09:41:34 +0200 Subject: [PATCH] Allow interactive mode to be disabled for some build variants --- .github/workflows/examples-linux-arm.yaml | 2 +- examples/chip-tool/BUILD.gn | 17 +++++++++++++---- .../chip-tool/commands/interactive/Commands.h | 2 ++ scripts/build/build/targets.py | 2 ++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index 670e583372032d..a5233e5008c463 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -69,7 +69,7 @@ jobs: ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ --target linux-arm64-all-clusters \ - --target linux-arm64-chip-tool-ipv6only \ + --target linux-arm64-chip-tool-ipv6only-no-interactive \ --target linux-arm64-door-lock \ --target linux-arm64-minmdns \ --target linux-arm64-thermostat-no-ble \ diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index c0ef845420ece2..a91278467de736 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -23,6 +23,7 @@ assert(chip_build_tools) declare_args() { # Use a separate eventloop for CHIP tasks config_use_separate_eventloop = true + config_use_interactive_mode = true } config("config") { @@ -32,10 +33,16 @@ config("config") { "${chip_root}/src/lib", ] - defines = [ "CONFIG_USE_SEPARATE_EVENTLOOP=${config_use_separate_eventloop}" ] + defines = [ + "CONFIG_USE_SEPARATE_EVENTLOOP=${config_use_separate_eventloop}", + "CONFIG_USE_INTERACTIVE_MODE=${config_use_interactive_mode}", + ] cflags = [ "-Wconversion" ] - libs = [ "readline" ] + + if (config_use_interactive_mode) { + libs = [ "readline" ] + } } static_library("chip-tool-utils") { @@ -54,8 +61,6 @@ static_library("chip-tool-utils") { "commands/discover/DiscoverCommand.cpp", "commands/discover/DiscoverCommissionablesCommand.cpp", "commands/discover/DiscoverCommissionersCommand.cpp", - "commands/interactive/InteractiveCommands.cpp", - # TODO - enable CommissionedListCommand once DNS Cache is implemented # "commands/pairing/CommissionedListCommand.cpp", # "commands/pairing/CommissionedListCommand.h", @@ -69,6 +74,10 @@ static_library("chip-tool-utils") { "config/PersistentStorage.cpp", ] + if (config_use_interactive_mode) { + source += [ "commands/interactive/InteractiveCommands.cpp" ] + } + public_deps = [ "${chip_root}/src/app/server", "${chip_root}/src/app/tests/suites/commands/commissioner", diff --git a/examples/chip-tool/commands/interactive/Commands.h b/examples/chip-tool/commands/interactive/Commands.h index 2bb7343aee10fa..19feb20f163999 100644 --- a/examples/chip-tool/commands/interactive/Commands.h +++ b/examples/chip-tool/commands/interactive/Commands.h @@ -28,7 +28,9 @@ void registerCommandsInteractive(Commands & commands, CredentialIssuerCommands * const char * clusterName = "interactive"; commands_list clusterCommands = { +#if CONFIG_USE_INTERACTIVE_MODE make_unique(&commands, credsIssuerConfig), +#endif // CONFIG_USE_INTERACTIVE_MODE }; commands.Register(clusterName, clusterCommands); diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index fdfcc8a8a071b6..d1e8f96dcb4a94 100644 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -250,6 +250,8 @@ def HostTargets(): ['-all-clusters', '-chip-tool']), test_group=True), builder.AppendVariant(name="same-event-loop", validator=AcceptNameWithSubstrings( ['-chip-tool']), separate_event_loop=False), + builder.AppendVariant(name="no-interactive", validator=AcceptNameWithSubstrings( + ['-chip-tool']), interactive_mode=False), builder.AppendVariant(name="ipv6only", enable_ipv4=False), builder.AppendVariant(name="no-ble", enable_ble=False), builder.AppendVariant(name="no-wifi", enable_wifi=False),