Skip to content

Commit

Permalink
Fix dynamic cluster dispatcher in controller (project-chip#29575)
Browse files Browse the repository at this point in the history
  • Loading branch information
yunhanw-google authored Oct 25, 2023
1 parent 3aac08f commit f473579
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 15 deletions.
1 change: 1 addition & 0 deletions examples/kotlin-matter-controller/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ chip_project_config_include_dirs =
[ "${chip_root}/examples/kotlin-matter-controller/include" ]
chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]
chip_stack_lock_tracking = "fatal"
chip_build_controller_dynamic_server = true
2 changes: 2 additions & 0 deletions scripts/build/builders/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def AppGnArgs(self):
gn_args["chip_config_network_layer_ble"] = False
elif self == AndroidApp.VIRTUAL_DEVICE_APP:
gn_args["chip_config_network_layer_ble"] = True
elif self == AndroidApp.CHIP_TOOL:
gn_args["chip_build_controller_dynamic_server"] = True
return gn_args

def ExampleName(self):
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/testdata/dry_run_android-arm64-chip-tool.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ python3 third_party/android_deps/set_up_android_deps.py
third_party/java_deps/set_up_java_deps.sh

# Generating android-arm64-chip-tool
gn gen --check --fail-on-unused-args {out}/android-arm64-chip-tool '--args=target_os="android" target_cpu="arm64" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME" '
gn gen --check --fail-on-unused-args {out}/android-arm64-chip-tool '--args=target_os="android" target_cpu="arm64" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME" chip_build_controller_dynamic_server=true '

# Accepting NDK licenses @ tools
bash -c 'yes | TEST_ANDROID_HOME/tools/bin/sdkmanager --licenses >/dev/null'
Expand Down
1 change: 1 addition & 0 deletions src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import("//build_overrides/chip.gni")
import("//build_overrides/nlio.gni")
import("${chip_root}/build/chip/buildconfig_header.gni")
import("${chip_root}/src/lib/core/core.gni")
import("${chip_root}/src/platform/device.gni")
import("common_flags.gni")
import("icd/icd.gni")
Expand Down
22 changes: 14 additions & 8 deletions src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("${chip_root}/build/chip/chip_codegen.gni")
import("${chip_root}/src/lib/core/core.gni")
import("${chip_root}/src/app/common_flags.gni")
import("${chip_root}/src/platform/python.gni")

_app_root = get_path_info(".", "abspath")
Expand Down Expand Up @@ -94,7 +94,8 @@ template("chip_data_model") {
# is this during app compile but not others? I am unclear what
# zap_pregenerated_dir is supposed to convey. Existence of a directory
# does not obviously map to "need command handler cpp compiled in").
if (defined(invoker.zap_pregenerated_dir)) {
if (defined(invoker.zap_pregenerated_dir) &&
!chip_build_controller_dynamic_server) {
outputs += [ "zap-generated/IMClusterCommandHandler.cpp" ]
} else {
if (defined(prune_outputs)) {
Expand Down Expand Up @@ -165,20 +166,25 @@ template("chip_data_model") {
"${_app_root}/clusters/scenes-server/SceneTable.h",
"${_app_root}/clusters/scenes-server/SceneTableImpl.h",
"${_app_root}/clusters/scenes-server/scenes-server.h",
"${_app_root}/util/DataModelHandler.cpp",
"${_app_root}/util/attribute-size-util.cpp",
"${_app_root}/util/attribute-storage.cpp",
"${_app_root}/util/attribute-table.cpp",
"${_app_root}/util/binding-table.cpp",
"${_app_root}/util/binding-table.h",
"${_app_root}/util/ember-compatibility-functions.cpp",
"${_app_root}/util/generic-callback-stubs.cpp",
"${_app_root}/util/message.cpp",
"${_app_root}/util/privilege-storage.cpp",
"${_app_root}/util/util.cpp",
"${chip_root}/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp",
]

if (!chip_build_controller_dynamic_server) {
sources += [
"${_app_root}/util/DataModelHandler.cpp",
"${_app_root}/util/attribute-size-util.cpp",
"${_app_root}/util/attribute-storage.cpp",
"${_app_root}/util/attribute-table.cpp",
"${_app_root}/util/ember-compatibility-functions.cpp",
"${_app_root}/util/util.cpp",
]
}

if (defined(invoker.zap_file)) {
_zap_file = rebase_path(invoker.zap_file, root_build_dir)
_script_args = [
Expand Down
15 changes: 11 additions & 4 deletions src/app/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ chip_test_suite_using_nltest("tests") {
"TestEventLoggingNoUTCTime.cpp",
"TestEventOverflow.cpp",
"TestEventPathParams.cpp",
"TestExtensionFieldSets.cpp",
"TestFabricScopedEventLogging.cpp",
"TestICDManager.cpp",
"TestICDMonitoringTable.cpp",
Expand All @@ -148,7 +147,6 @@ chip_test_suite_using_nltest("tests") {
"TestPowerSourceCluster.cpp",
"TestReadInteraction.cpp",
"TestReportingEngine.cpp",
"TestSceneTable.cpp",
"TestStatusIB.cpp",
"TestStatusResponseMessage.cpp",
"TestTimeSyncDataProvider.cpp",
Expand Down Expand Up @@ -196,8 +194,6 @@ chip_test_suite_using_nltest("tests") {
":binding-test-srcs",
":operational-state-test-srcs",
":ota-requestor-test-srcs",
":power-cluster-test-srcs",
":scenes-table-test-srcs",
":time-sync-data-provider-test-srcs",
"${chip_root}/src/app",
"${chip_root}/src/app/common:cluster-objects",
Expand All @@ -209,6 +205,17 @@ chip_test_suite_using_nltest("tests") {
"${nlunit_test_root}:nlunit-test",
]

if (chip_device_platform != "android") {
test_sources += [
"TestExtensionFieldSets.cpp",
"TestSceneTable.cpp",
]
public_deps += [
":power-cluster-test-srcs",
":scenes-table-test-srcs",
]
}

# Do not run TestCommissionManager when running ICD specific unit tests.
# ICDManager has a dependency on the Accessors.h file which causes a link error
# when building the TestCommissionManager
Expand Down
1 change: 1 addition & 0 deletions src/app/util/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
# limitations under the License.

import("//build_overrides/chip.gni")
import("${chip_root}/src/app/common_flags.gni")
7 changes: 5 additions & 2 deletions src/controller/java/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ shared_library("jni") {
]

deps = [
"${chip_root}/src/controller/data_model",
"${chip_root}/src/credentials:default_attestation_verifier",
"${chip_root}/src/inet",
"${chip_root}/src/lib",
Expand Down Expand Up @@ -91,11 +90,15 @@ shared_library("jni") {
"zap-generated/CHIPReadCallbacks.cpp",
]

deps += [ "${chip_root}/src/controller/data_model:java-jni-sources" ]
deps += [
"${chip_root}/src/controller/data_model",
"${chip_root}/src/controller/data_model:java-jni-sources",
]
}

if (chip_build_controller_dynamic_server) {
defines += [ "CHIP_DEVICE_CONFIG_DYNAMIC_SERVER" ]
deps += [ "${chip_root}/src/controller:nodatamodel" ]
}

if (matter_enable_java_compilation) {
Expand Down

0 comments on commit f473579

Please sign in to comment.