Remove `prune_outputs` support from code generation build scripts (#32322)
* Remove output prunning - files are now separated enough for this to not be needed
* Restyle
* Remove more references of prune outputs
diff --git a/build/chip/chip_codegen.gni b/build/chip/chip_codegen.gni
index 02acd08..08d9f17 100644
--- a/build/chip/chip_codegen.gni
+++ b/build/chip/chip_codegen.gni
@@ -152,7 +152,7 @@
_output_subdir = "zap-generated"
}
- pw_python_action("${_name}_zap_pregen") {
+ pw_python_action("${_name}_zap") {
script = "${chip_root}/scripts/tools/zap/generate.py"
# TODO: this seems to touch internals. Is this ok? speeds up builds!
@@ -165,7 +165,7 @@
"--templates",
_template_path,
"--output-dir",
- rebase_path(target_gen_dir) + "/zap_pregen/" + _output_subdir,
+ rebase_path(target_gen_dir) + "/zapgen/" + _output_subdir,
# TODO: lock file support should be removed as this serializes zap
# (slower), however this is currently done because on Darwin zap startup
@@ -190,52 +190,8 @@
outputs = []
foreach(name, invoker.outputs) {
- outputs += [ "${target_gen_dir}/zap_pregen/${name}" ]
- }
-
- forward_variables_from(invoker, [ "prune_outputs" ])
- if (defined(prune_outputs)) {
- foreach(name, prune_outputs) {
- outputs += [ "${target_gen_dir}/zap_pregen/${name}" ]
- }
- }
- }
-
- # This action ensures that any "extra" files generated by zap codegen
- # are actually deleted.
- #
- # This is to avoid double-codegen of configurations like endpoint config
- # or access credentials being generated for both "controller client" and
- # application-specific
- pw_python_action("${_name}_files") {
- # TODO: this seems to touch internals. Is this ok? speeds up builds!
- _pw_internal_run_in_venv = false
-
- script = "${chip_root}/scripts/tools/zap/prune_outputs.py"
-
- _keep_file = rebase_path("${target_gen_dir}/${_name}.keep.outputs")
- write_file(_keep_file, invoker.outputs, "list lines")
-
- args = [
- "--keep",
- _keep_file,
- "--input-dir",
- rebase_path("${target_gen_dir}/zap_pregen/"),
- "--output-dir",
- rebase_path("${target_gen_dir}/zapgen/"),
- ]
-
- inputs = []
- foreach(name, invoker.outputs) {
- inputs += [ "${target_gen_dir}/zap_pregen/${name}" ]
- }
-
- outputs = []
- foreach(name, invoker.outputs) {
outputs += [ "${target_gen_dir}/zapgen/${name}" ]
}
-
- deps = [ ":${_name}_zap_pregen" ]
}
source_set(_name) {
@@ -255,10 +211,7 @@
if (!defined(public_deps)) {
public_deps = []
}
- public_deps += [
- ":${_name}_files",
- ":${_name}_zap_pregen",
- ]
+ public_deps += [ ":${_name}_zap" ]
}
}
@@ -420,7 +373,6 @@
"input",
"outputs",
"public_configs",
- "prune_outputs",
])
}
} else {
@@ -482,7 +434,6 @@
[
"deps",
"public_configs",
- "prune_outputs",
])
if (!defined(public_configs)) {
public_configs = []
diff --git a/scripts/tools/zap/prune_outputs.py b/scripts/tools/zap/prune_outputs.py
deleted file mode 100644
index 09f92a9..0000000
--- a/scripts/tools/zap/prune_outputs.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2022 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 argparse
-import os
-import shutil
-
-
-def main():
- parser = argparse.ArgumentParser(
- description='Delete files based on an input file listing files to be removed')
-
- parser.add_argument('--keep', required=True, help="File containing names to keep (copy over)")
- parser.add_argument('--output-dir', required=True, help="Output directory to copy files into")
- parser.add_argument('--input-dir', required=True, help="Input directory to get the files from")
-
- args = parser.parse_args()
-
- with open(args.keep, "rt") as f:
- for source in f.readlines():
- source = source.strip()
- if not source:
- continue
- target = os.path.join(args.output_dir, source)
- os.makedirs(os.path.dirname(target), exist_ok=True)
- shutil.copyfile(os.path.join(args.input_dir, source), target)
-
-
-if __name__ == '__main__':
- main()
diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni
index 42bc2f9..a065d83 100644
--- a/src/app/chip_data_model.gni
+++ b/src/app/chip_data_model.gni
@@ -56,20 +56,8 @@
"zap-generated/endpoint_config.h",
]
- # NOTE: these are ALSO auto-generated but handled below:
- # "zap-generated/IMClusterCommandHandler.cpp"
- # -> contains one large DispatchSingleClusterCommand and DispatchServerCommand
-
- if (chip_code_pre_generated_directory == "") {
- prune_outputs = []
- }
-
if (!chip_build_controller_dynamic_server) {
outputs += [ "zap-generated/IMClusterCommandHandler.cpp" ]
- } else {
- if (defined(prune_outputs)) {
- prune_outputs += [ "zap-generated/IMClusterCommandHandler.cpp" ]
- }
}
if (!defined(deps)) {