Skip to content

Commit aa67fba

Browse files
authoredFeb 1, 2024
mark files in src/app/data-model as their own source_set (#31801)
* 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
1 parent 1527849 commit aa67fba

File tree

10 files changed

+83
-27
lines changed

10 files changed

+83
-27
lines changed
 

‎src/BUILD.gn

-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ config("includes") {
4343
include_dirs += [ "${chip_external_platform_include_dir}" ]
4444
}
4545

46-
# TODO: generated file dependency should be a lib NOT an include
47-
include_dirs += [ "${chip_root}/zzz_generated/app-common" ]
48-
4946
defines = [ "CHIP_HAVE_CONFIG_H=1" ]
5047

5148
# Make __FILE__ and related macros relative to chip_root

‎src/app/BUILD.gn

+1-15
Original file line numberDiff line numberDiff line change
@@ -104,20 +104,6 @@ source_set("global-attributes") {
104104
]
105105
}
106106

107-
source_set("pre-encoded-value") {
108-
sources = [
109-
"data-model/FabricScopedPreEncodedValue.cpp",
110-
"data-model/FabricScopedPreEncodedValue.h",
111-
"data-model/PreEncodedValue.cpp",
112-
"data-model/PreEncodedValue.h",
113-
]
114-
115-
deps = [
116-
"${chip_root}/src/lib/core",
117-
"${chip_root}/src/lib/support",
118-
]
119-
}
120-
121107
source_set("subscription-manager") {
122108
sources = [ "SubscriptionsInfoProvider.h" ]
123109

@@ -335,8 +321,8 @@ static_library("app") {
335321
":app_config",
336322
":global-attributes",
337323
":interaction-model",
338-
":pre-encoded-value",
339324
":revision_info",
325+
"${chip_root}/src/app/data-model",
340326
"${chip_root}/src/app/icd/server:icd-server-config",
341327
"${chip_root}/src/lib/address_resolve",
342328
"${chip_root}/src/lib/support",

‎src/app/chip_data_model.gni

+1
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ template("chip_data_model") {
376376
":${_data_model_name}_zapgen",
377377
"${chip_root}/src/app",
378378
"${chip_root}/src/app/common:cluster-objects",
379+
"${chip_root}/src/app/common:enums",
379380
"${chip_root}/src/controller",
380381
"${chip_root}/src/lib/core",
381382
"${chip_root}/src/lib/support",

‎src/app/common/BUILD.gn

+23-3
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,41 @@
1414

1515
import("//build_overrides/chip.gni")
1616

17+
config("includes") {
18+
include_dirs = [ "${chip_root}/zzz_generated/app-common" ]
19+
}
20+
1721
static_library("cluster-objects") {
1822
output_name = "libClusterObjects"
1923

2024
sources = [
21-
"${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h",
22-
"${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h",
2325
"${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp",
2426
"${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h",
2527
]
2628

2729
public_deps = [
30+
"${chip_root}/src/app/data-model",
2831
"${chip_root}/src/lib/core",
2932
"${chip_root}/src/lib/support",
3033
"${chip_root}/src/protocols/interaction_model",
3134
]
3235

33-
defines = []
36+
public_configs = [ ":includes" ]
37+
}
38+
39+
source_set("enums") {
40+
sources = [
41+
"${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h",
42+
"${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h",
43+
]
44+
45+
public_configs = [ ":includes" ]
46+
}
47+
48+
source_set("simulated") {
49+
sources = [ "${chip_root}/zzz_generated/app-common/app-common/zap-generated/tests/simulated-cluster-objects.h" ]
50+
51+
public_deps = [ ":enums" ]
52+
53+
public_configs = [ ":includes" ]
3454
}

‎src/app/data-model/BUILD.gn

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright (c) 2024 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
import("//build_overrides/chip.gni")
15+
16+
source_set("data-model") {
17+
sources = [
18+
"BasicTypes.h",
19+
"DecodableList.h",
20+
"Decode.h",
21+
"Encode.h",
22+
"FabricScoped.h",
23+
"FabricScopedPreEncodedValue.cpp",
24+
"FabricScopedPreEncodedValue.h",
25+
"List.h",
26+
"NullObject.h",
27+
"Nullable.h",
28+
"PreEncodedValue.cpp",
29+
"PreEncodedValue.h",
30+
"TagBoundEncoder.h",
31+
"WrappedStructEncoder.h",
32+
]
33+
34+
deps = [
35+
# TODO: dependencies NOT declared because they are not part of
36+
# any GN dependency. Overall src/app seems to suffer greatly
37+
# of this, in part due to zap-generated code dependency.
38+
#
39+
# - app/util/attribute-storage-null-handling.h
40+
# - app/ConcreteAttributePath.h
41+
#
42+
"${chip_root}/src/app/common:enums",
43+
"${chip_root}/src/lib/core",
44+
"${chip_root}/src/lib/support",
45+
"${chip_root}/src/protocols/interaction_model",
46+
]
47+
}

‎src/app/tests/suites/commands/delay/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ static_library("delay") {
2626
cflags = [ "-Wconversion" ]
2727

2828
public_deps = [
29+
"${chip_root}/src/app/common:simulated",
2930
"${chip_root}/src/lib/support",
3031
"${chip_root}/src/platform",
3132
"${chip_root}/src/system",

‎src/app/tests/suites/commands/discovery/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ static_library("discovery") {
2929

3030
public_deps = [
3131
"${chip_root}/src/app",
32+
"${chip_root}/src/app/common:simulated",
3233
"${chip_root}/src/lib/address_resolve",
3334
"${chip_root}/src/lib/support",
3435
]

‎src/app/tests/suites/commands/log/BUILD.gn

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ static_library("log") {
2525

2626
cflags = [ "-Wconversion" ]
2727

28-
public_deps = [ "${chip_root}/src/lib/support" ]
28+
public_deps = [
29+
"${chip_root}/src/app/common:simulated",
30+
"${chip_root}/src/lib/support",
31+
]
2932
}

‎src/app/tests/suites/commands/system/BUILD.gn

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ static_library("system") {
2525

2626
cflags = [ "-Wconversion" ]
2727

28-
public_deps = [ "${chip_root}/src/lib/support" ]
28+
public_deps = [
29+
"${chip_root}/src/app/common:simulated",
30+
"${chip_root}/src/lib/support",
31+
]
2932
}

‎src/lib/core/BUILD.gn

+1-4
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ static_library("core") {
125125
output_name = "libChipCore"
126126

127127
sources = [
128-
# For now cluster enum/bitmap definitions are in zzz-generated.
129-
# We should consider putting them directly in this directory
130-
# instead.
131-
"${chip_root}/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h",
132128
"CASEAuthTag.h",
133129
"CHIPCallback.h",
134130
"CHIPCore.h",
@@ -171,6 +167,7 @@ static_library("core") {
171167
public_deps = [
172168
":chip_config_header",
173169
":error",
170+
"${chip_root}/src/app/common:enums",
174171
"${chip_root}/src/ble",
175172
"${chip_root}/src/inet",
176173
"${chip_root}/src/lib/support",

0 commit comments

Comments
 (0)