diff --git a/src/BUILD.gn b/src/BUILD.gn index ee3fd4d9c7a2ba..0588e897685fdd 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -43,9 +43,6 @@ config("includes") { include_dirs += [ "${chip_external_platform_include_dir}" ] } - # TODO: generated file dependency should be a lib NOT an include - include_dirs += [ "${chip_root}/zzz_generated/app-common" ] - defines = [ "CHIP_HAVE_CONFIG_H=1" ] # Make __FILE__ and related macros relative to chip_root diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 12be70af10e867..52f14d9f308f7f 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -104,20 +104,6 @@ source_set("global-attributes") { ] } -source_set("pre-encoded-value") { - sources = [ - "data-model/FabricScopedPreEncodedValue.cpp", - "data-model/FabricScopedPreEncodedValue.h", - "data-model/PreEncodedValue.cpp", - "data-model/PreEncodedValue.h", - ] - - deps = [ - "${chip_root}/src/lib/core", - "${chip_root}/src/lib/support", - ] -} - source_set("subscription-manager") { sources = [ "SubscriptionsInfoProvider.h" ] @@ -335,8 +321,8 @@ static_library("app") { ":app_config", ":global-attributes", ":interaction-model", - ":pre-encoded-value", ":revision_info", + "${chip_root}/src/app/data-model", "${chip_root}/src/app/icd/server:icd-server-config", "${chip_root}/src/lib/address_resolve", "${chip_root}/src/lib/support", diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index aede00f0e12115..bc6c48df53d742 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -376,6 +376,7 @@ template("chip_data_model") { ":${_data_model_name}_zapgen", "${chip_root}/src/app", "${chip_root}/src/app/common:cluster-objects", + "${chip_root}/src/app/common:enums", "${chip_root}/src/controller", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", diff --git a/src/app/common/BUILD.gn b/src/app/common/BUILD.gn index c6c350e547fd86..f2eb7b479f42a2 100644 --- a/src/app/common/BUILD.gn +++ b/src/app/common/BUILD.gn @@ -14,21 +14,41 @@ import("//build_overrides/chip.gni") +config("includes") { + include_dirs = [ "${chip_root}/zzz_generated/app-common" ] +} + static_library("cluster-objects") { output_name = "libClusterObjects" sources = [ - "${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h", - "${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h", "${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp", "${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h", ] public_deps = [ + "${chip_root}/src/app/data-model", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/protocols/interaction_model", ] - defines = [] + public_configs = [ ":includes" ] +} + +source_set("enums") { + sources = [ + "${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h", + "${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h", + ] + + public_configs = [ ":includes" ] +} + +source_set("simulated") { + sources = [ "${chip_root}/zzz_generated/app-common/app-common/zap-generated/tests/simulated-cluster-objects.h" ] + + public_deps = [ ":enums" ] + + public_configs = [ ":includes" ] } diff --git a/src/app/data-model/BUILD.gn b/src/app/data-model/BUILD.gn new file mode 100644 index 00000000000000..49a49033f0e9f2 --- /dev/null +++ b/src/app/data-model/BUILD.gn @@ -0,0 +1,47 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//build_overrides/chip.gni") + +source_set("data-model") { + sources = [ + "BasicTypes.h", + "DecodableList.h", + "Decode.h", + "Encode.h", + "FabricScoped.h", + "FabricScopedPreEncodedValue.cpp", + "FabricScopedPreEncodedValue.h", + "List.h", + "NullObject.h", + "Nullable.h", + "PreEncodedValue.cpp", + "PreEncodedValue.h", + "TagBoundEncoder.h", + "WrappedStructEncoder.h", + ] + + deps = [ + # TODO: dependencies NOT declared because they are not part of + # any GN dependency. Overall src/app seems to suffer greatly + # of this, in part due to zap-generated code dependency. + # + # - app/util/attribute-storage-null-handling.h + # - app/ConcreteAttributePath.h + # + "${chip_root}/src/app/common:enums", + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/support", + "${chip_root}/src/protocols/interaction_model", + ] +} diff --git a/src/app/tests/suites/commands/delay/BUILD.gn b/src/app/tests/suites/commands/delay/BUILD.gn index b744edcf7a8cbb..de0babc859026f 100644 --- a/src/app/tests/suites/commands/delay/BUILD.gn +++ b/src/app/tests/suites/commands/delay/BUILD.gn @@ -26,6 +26,7 @@ static_library("delay") { cflags = [ "-Wconversion" ] public_deps = [ + "${chip_root}/src/app/common:simulated", "${chip_root}/src/lib/support", "${chip_root}/src/platform", "${chip_root}/src/system", diff --git a/src/app/tests/suites/commands/discovery/BUILD.gn b/src/app/tests/suites/commands/discovery/BUILD.gn index da1196f9db395e..169e9a91609183 100644 --- a/src/app/tests/suites/commands/discovery/BUILD.gn +++ b/src/app/tests/suites/commands/discovery/BUILD.gn @@ -29,6 +29,7 @@ static_library("discovery") { public_deps = [ "${chip_root}/src/app", + "${chip_root}/src/app/common:simulated", "${chip_root}/src/lib/address_resolve", "${chip_root}/src/lib/support", ] diff --git a/src/app/tests/suites/commands/log/BUILD.gn b/src/app/tests/suites/commands/log/BUILD.gn index c0f2ffa3eb6b55..b873bf1c38d96d 100644 --- a/src/app/tests/suites/commands/log/BUILD.gn +++ b/src/app/tests/suites/commands/log/BUILD.gn @@ -25,5 +25,8 @@ static_library("log") { cflags = [ "-Wconversion" ] - public_deps = [ "${chip_root}/src/lib/support" ] + public_deps = [ + "${chip_root}/src/app/common:simulated", + "${chip_root}/src/lib/support", + ] } diff --git a/src/app/tests/suites/commands/system/BUILD.gn b/src/app/tests/suites/commands/system/BUILD.gn index 4843944f3a8b1e..df9972388b1f33 100644 --- a/src/app/tests/suites/commands/system/BUILD.gn +++ b/src/app/tests/suites/commands/system/BUILD.gn @@ -25,5 +25,8 @@ static_library("system") { cflags = [ "-Wconversion" ] - public_deps = [ "${chip_root}/src/lib/support" ] + public_deps = [ + "${chip_root}/src/app/common:simulated", + "${chip_root}/src/lib/support", + ] } diff --git a/src/lib/core/BUILD.gn b/src/lib/core/BUILD.gn index 40ba50224d195d..e4bf67e65b04c9 100644 --- a/src/lib/core/BUILD.gn +++ b/src/lib/core/BUILD.gn @@ -125,10 +125,6 @@ static_library("core") { output_name = "libChipCore" sources = [ - # For now cluster enum/bitmap definitions are in zzz-generated. - # We should consider putting them directly in this directory - # instead. - "${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h", "CASEAuthTag.h", "CHIPCallback.h", "CHIPCore.h", @@ -171,6 +167,7 @@ static_library("core") { public_deps = [ ":chip_config_header", ":error", + "${chip_root}/src/app/common:enums", "${chip_root}/src/ble", "${chip_root}/src/inet", "${chip_root}/src/lib/support",