Skip to content

Commit

Permalink
Remove prune_outputs support from code generation build scripts (#3…
Browse files Browse the repository at this point in the history
…2322)

* Remove output prunning - files are now separated enough for this to not be needed

* Restyle

* Remove more references of prune outputs
  • Loading branch information
andy31415 authored Feb 26, 2024
1 parent 2e35d01 commit d899019
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 106 deletions.
55 changes: 3 additions & 52 deletions build/chip/chip_codegen.gni
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ template("_chip_build_time_zapgen") {
_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!
Expand All @@ -165,7 +165,7 @@ template("_chip_build_time_zapgen") {
"--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
Expand All @@ -188,54 +188,10 @@ template("_chip_build_time_zapgen") {

sources = [ _idl_file ]

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) {
Expand All @@ -255,10 +211,7 @@ template("_chip_build_time_zapgen") {
if (!defined(public_deps)) {
public_deps = []
}
public_deps += [
":${_name}_files",
":${_name}_zap_pregen",
]
public_deps += [ ":${_name}_zap" ]
}
}

Expand Down Expand Up @@ -420,7 +373,6 @@ template("chip_zapgen") {
"input",
"outputs",
"public_configs",
"prune_outputs",
])
}
} else {
Expand Down Expand Up @@ -482,7 +434,6 @@ template("chip_zapgen") {
[
"deps",
"public_configs",
"prune_outputs",
])
if (!defined(public_configs)) {
public_configs = []
Expand Down
42 changes: 0 additions & 42 deletions scripts/tools/zap/prune_outputs.py

This file was deleted.

12 changes: 0 additions & 12 deletions src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,8 @@ template("chip_data_model") {
"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)) {
Expand Down

0 comments on commit d899019

Please sign in to comment.