Skip to content

Commit

Permalink
Allow interactive mode to be disabled for some build variants
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple committed Mar 30, 2022
1 parent c31bab8 commit b8e8465
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/examples-linux-arm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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-no-interactive-ipv6only \
--target linux-arm64-door-lock \
--target linux-arm64-minmdns \
--target linux-arm64-thermostat-no-ble \
Expand All @@ -79,8 +79,8 @@ jobs:
timeout-minutes: 5
run: |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
linux arm64 chip-tool-ipv6only \
out/linux-arm64-chip-tool-ipv6only/chip-tool \
linux arm64 chip-tool-no-interactive-ipv6only \
out/linux-arm64-chip-tool-no-interactive-ipv6only/chip-tool \
/tmp/bloat_reports/
- name: Bloat report - thermostat
timeout-minutes: 5
Expand Down
16 changes: 13 additions & 3 deletions examples/chip-tool/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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") {
Expand All @@ -54,7 +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",
Expand All @@ -69,6 +75,10 @@ static_library("chip-tool-utils") {
"config/PersistentStorage.cpp",
]

if (config_use_interactive_mode) {
sources += [ "commands/interactive/InteractiveCommands.cpp" ]
}

public_deps = [
"${chip_root}/src/app/server",
"${chip_root}/src/app/tests/suites/commands/commissioner",
Expand Down
2 changes: 2 additions & 0 deletions examples/chip-tool/commands/interactive/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ void registerCommandsInteractive(Commands & commands, CredentialIssuerCommands *
const char * clusterName = "interactive";

commands_list clusterCommands = {
#if CONFIG_USE_INTERACTIVE_MODE
make_unique<InteractiveStartCommand>(&commands, credsIssuerConfig),
#endif // CONFIG_USE_INTERACTIVE_MODE
};

commands.Register(clusterName, clusterCommands);
Expand Down
2 changes: 2 additions & 0 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
5 changes: 4 additions & 1 deletion scripts/build/builders/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class HostBuilder(GnBuilder):

def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ipv4=True,
enable_ble=True, enable_wifi=True, use_tsan=False, use_asan=False, separate_event_loop=True,
test_group=False, use_libfuzzer=False, use_clang=False,
test_group=False, use_libfuzzer=False, use_clang=False, interactive_mode=True,
use_platform_mdns=False):
super(HostBuilder, self).__init__(
root=os.path.join(root, 'examples', app.ExamplePath()),
Expand Down Expand Up @@ -183,6 +183,9 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ip
if not separate_event_loop:
self.extra_gn_options.append('config_use_separate_eventloop=false')

if not interactive_mode:
self.extra_gn_options.append('config_use_interactive_mode=false')

if test_group:
self.extra_gn_options.append(
'chip_enable_group_messaging_tests=true')
Expand Down

0 comments on commit b8e8465

Please sign in to comment.