| # Copyright (c) 2021 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/build.gni") |
| import("//build_overrides/chip.gni") |
| import("//build_overrides/pigweed.gni") |
| |
| import("$dir_pw_build/python.gni") |
| import("${chip_root}/src/app/chip_data_model.gni") |
| |
| chip_data_model("data_model") { |
| zap_file = "controller-clusters.zap" |
| |
| zap_pregenerated_dir = |
| "${chip_root}/zzz_generated/controller-clusters/zap-generated" |
| |
| allow_circular_includes_from = [ "${chip_root}/src/controller" ] |
| } |
| |
| if (current_os == "android") { |
| pw_python_action("java-jni-generate") { |
| script = "${chip_root}/scripts/codegen.py" |
| |
| _idl_file = "controller-clusters.matter" |
| _output_files = |
| exec_script("${chip_root}/scripts/codegen.py", |
| [ |
| "--generator", |
| "java", |
| "--log-level", |
| "fatal", |
| "--name-only", |
| rebase_path("controller-clusters.matter", root_build_dir), |
| ], |
| "list lines", |
| [ "controller-clusters.matter" ]) |
| |
| args = [ |
| "--generator", |
| "java", |
| "--output-dir", |
| rebase_path(target_gen_dir, root_build_dir), |
| rebase_path(_idl_file, root_build_dir), |
| ] |
| |
| deps = [ "${chip_root}/scripts/idl" ] |
| |
| inputs = [ _idl_file ] |
| sources = [ _idl_file ] |
| outputs = [] |
| |
| foreach(name, _output_files) { |
| outputs += [ "$target_gen_dir/${name}" ] |
| } |
| } |
| |
| source_set("java-jni-sources") { |
| sources = get_target_outputs(":java-jni-generate") |
| public_configs = [ "${chip_root}/src:includes" ] |
| |
| deps = [ |
| ":data_model", |
| ":java-jni-generate", |
| "${chip_root}/src/inet", |
| "${chip_root}/src/lib", |
| "${chip_root}/src/platform", |
| "${chip_root}/src/platform/android", |
| ] |
| } |
| } |