Skip to content

Commit

Permalink
mark files in src/app/data-model as their own source_set (#31801)
Browse files Browse the repository at this point in the history
* Start placing data-model files into a stand-alone source set and fix dependencies

* Restyle

* Make app common set its own includes config

* Remove global includes into app-common

* Fix another odd dependency

* Fix up simulated app compile ... another orphan header

* Restyle

* More proper dependencies on simulated generated files

* Restyle

* Fix System command dependencies on simulated cluster objects as well

* Removed one seemingly unneeded dependency

* Remove separation of pre-encoded-value

* Restyle
  • Loading branch information
andy31415 authored and pull[bot] committed Feb 28, 2024
1 parent 05e659d commit 3985930
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 27 deletions.
3 changes: 0 additions & 3 deletions src/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 1 addition & 15 deletions src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]

Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 23 additions & 3 deletions src/app/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}
47 changes: 47 additions & 0 deletions src/app/data-model/BUILD.gn
Original file line number Diff line number Diff line change
@@ -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",
]
}
1 change: 1 addition & 0 deletions src/app/tests/suites/commands/delay/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/app/tests/suites/commands/discovery/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down
5 changes: 4 additions & 1 deletion src/app/tests/suites/commands/log/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
}
5 changes: 4 additions & 1 deletion src/app/tests/suites/commands/system/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
}
5 changes: 1 addition & 4 deletions src/lib/core/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 3985930

Please sign in to comment.