Skip to content

Commit 8fcd2c1

Browse files
[app] Remove external_clusters flag
`external_clusters` flag is redundant as if an external cluster is created without correct implementation, build will fail anyway. Without the flag, clusters not provided in `zap_cluster_list.json` can be skipped without requiring to always provide full list of custom clusters. Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
1 parent 50aa1d3 commit 8fcd2c1

File tree

3 files changed

+7
-29
lines changed

3 files changed

+7
-29
lines changed

src/app/chip_data_model.cmake

+3-10
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,10 @@ endfunction()
3939
#
4040
# Configure ${APP_TARGET} with source files associated with clusters enabled in the ${ZAP_FILE}
4141
#
42-
function(chip_configure_zap_file APP_TARGET ZAP_FILE EXTERNAL_CLUSTERS)
42+
function(chip_configure_zap_file APP_TARGET ZAP_FILE)
4343
find_package(Python3 REQUIRED)
4444
set(args --zap_file ${ZAP_FILE})
4545

46-
if(EXTERNAL_CLUSTERS)
47-
list(APPEND args --external-clusters ${EXTERNAL_CLUSTERS})
48-
endif()
49-
5046
execute_process(
5147
COMMAND ${Python3_EXECUTABLE} ${CHIP_APP_BASE_DIR}/zap_cluster_list.py ${args}
5248
OUTPUT_VARIABLE CLUSTER_LIST
@@ -74,13 +70,10 @@ endfunction()
7470
# supported by the application.
7571
# IDL .matter IDL file to use for codegen. Inferred from ZAP_FILE
7672
# if not provided
77-
# EXTERNAL_CLUSTERS Clusters with external implementations. The default implementations
78-
# will not be used nor required for these clusters.
79-
# Format: MY_CUSTOM_CLUSTER'.
8073
#
8174
function(chip_configure_data_model APP_TARGET)
8275
set(SCOPE PRIVATE)
83-
cmake_parse_arguments(ARG "" "SCOPE;ZAP_FILE;IDL" "EXTERNAL_CLUSTERS" ${ARGN})
76+
cmake_parse_arguments(ARG "" "SCOPE;ZAP_FILE;IDL" ${ARGN})
8477

8578
if(ARG_SCOPE)
8679
set(SCOPE ${ARG_SCOPE})
@@ -104,7 +97,7 @@ function(chip_configure_data_model APP_TARGET)
10497
)
10598

10699
if(ARG_ZAP_FILE)
107-
chip_configure_zap_file(${APP_TARGET} ${ARG_ZAP_FILE} "${ARG_EXTERNAL_CLUSTERS}")
100+
chip_configure_zap_file(${APP_TARGET} ${ARG_ZAP_FILE})
108101

109102
if(NOT ARG_IDL)
110103
string(REPLACE ".zap" ".matter" ARG_IDL ${ARG_ZAP_FILE})

src/app/chip_data_model.gni

+1-5
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ template("chip_data_model") {
171171
[
172172
"zap_file",
173173
"is_server",
174-
"external_clusters",
175174
])
176175

177176
if (!defined(sources)) {
@@ -221,10 +220,7 @@ template("chip_data_model") {
221220
"--zap_file",
222221
_zap_file,
223222
]
224-
if (defined(invoker.external_clusters)) {
225-
_script_args += [ "--external-clusters" ]
226-
_script_args += invoker.external_clusters
227-
}
223+
228224
_cluster_sources = exec_script("${_app_root}/zap_cluster_list.py",
229225
_script_args,
230226
"list lines",

src/app/zap_cluster_list.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,15 @@ def get_cluster_sources(clusters: typing.Set[str],
2222

2323
for cluster in clusters:
2424
if cluster not in source_map:
25-
raise ValueError("Unhandled %s cluster: %s"
26-
" (hint: add to src/app/zap_cluster_list.json)" % (side, cluster))
25+
continue
2726

2827
cluster_sources.update(source_map[cluster])
2928

3029
return cluster_sources
3130

3231

3332
def dump_zapfile_clusters(zap_file_path: pathlib.Path,
34-
implementation_data_path: pathlib.Path,
35-
external_clusters: typing.List[str]):
33+
implementation_data_path: pathlib.Path):
3634
"""Prints all of the source directories to build for a given ZAP file.
3735
3836
Arguments:
@@ -58,8 +56,6 @@ def dump_zapfile_clusters(zap_file_path: pathlib.Path,
5856

5957
for endpoint_type in zap_json.get('endpointTypes'):
6058
for cluster in endpoint_type.get('clusters'):
61-
if cluster.get('define') in external_clusters:
62-
continue
6359
side: str = cluster.get('side')
6460
if side == 'client':
6561
clusters_set = client_clusters
@@ -94,17 +90,10 @@ def main():
9490
required=False,
9591
type=pathlib.Path,
9692
default=os.path.join(os.path.dirname(__file__), "zap_cluster_list.json"))
97-
parser.add_argument('--external-clusters',
98-
help='Clusters with external implementations. ' +
99-
'The default implementations will not be used nor required for these clusters. ' +
100-
'Format: MY_CUSTOM_CLUSTER',
101-
nargs='+',
102-
metavar='EXTERNAL_CLUSTER',
103-
default=[])
10493

10594
args = parser.parse_args()
10695

107-
dump_zapfile_clusters(args.zap_file, args.cluster_implementation_data, args.external_clusters)
96+
dump_zapfile_clusters(args.zap_file, args.cluster_implementation_data)
10897

10998
sys.exit(0)
11099

0 commit comments

Comments
 (0)