15f9996aaSopenharmony_ci# 25f9996aaSopenharmony_ci# Copyright (c) 2020 Huawei Device Co., Ltd. 35f9996aaSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 45f9996aaSopenharmony_ci# you may not use this file except in compliance with the License. 55f9996aaSopenharmony_ci# You may obtain a copy of the License at 65f9996aaSopenharmony_ci# 75f9996aaSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 85f9996aaSopenharmony_ci# 95f9996aaSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 105f9996aaSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 115f9996aaSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 125f9996aaSopenharmony_ci# See the License for the specific language governing permissions and 135f9996aaSopenharmony_ci# limitations under the License. 145f9996aaSopenharmony_ci# 155f9996aaSopenharmony_ci 165f9996aaSopenharmony_ci# Defines a subsystem 175f9996aaSopenharmony_ci# 185f9996aaSopenharmony_ci# The lite_subsystem template defines all the modules contained in a subsystem 195f9996aaSopenharmony_ci# 205f9996aaSopenharmony_ci# Parameters 215f9996aaSopenharmony_ci# 225f9996aaSopenharmony_ci# subsystem_components (required) 235f9996aaSopenharmony_ci# [list of scopes] Defines all modules in the subsystem. 245f9996aaSopenharmony_ci# 255f9996aaSopenharmony_citemplate("lite_subsystem") { 265f9996aaSopenharmony_ci assert(defined(invoker.subsystem_components), 275f9996aaSopenharmony_ci "subsystem_components in required.") 285f9996aaSopenharmony_ci 295f9996aaSopenharmony_ci lite_subsystem_components = invoker.subsystem_components 305f9996aaSopenharmony_ci 315f9996aaSopenharmony_ci group(target_name) { 325f9996aaSopenharmony_ci deps = [] 335f9996aaSopenharmony_ci if (defined(invoker.deps)) { 345f9996aaSopenharmony_ci deps += invoker.deps 355f9996aaSopenharmony_ci } 365f9996aaSopenharmony_ci 375f9996aaSopenharmony_ci # add subsystem packages 385f9996aaSopenharmony_ci foreach(pkg_label, lite_subsystem_components) { 395f9996aaSopenharmony_ci deps += [ pkg_label ] 405f9996aaSopenharmony_ci } 415f9996aaSopenharmony_ci } 425f9996aaSopenharmony_ci} 435f9996aaSopenharmony_ci 445f9996aaSopenharmony_citemplate("lite_subsystem_test") { 455f9996aaSopenharmony_ci assert(defined(invoker.subsystem_components), 465f9996aaSopenharmony_ci "subsystem_components in required.") 475f9996aaSopenharmony_ci 485f9996aaSopenharmony_ci lite_subsystem_components = invoker.subsystem_components 495f9996aaSopenharmony_ci 505f9996aaSopenharmony_ci group(target_name) { 515f9996aaSopenharmony_ci deps = [] 525f9996aaSopenharmony_ci if (defined(invoker.deps)) { 535f9996aaSopenharmony_ci deps += invoker.deps 545f9996aaSopenharmony_ci } 555f9996aaSopenharmony_ci 565f9996aaSopenharmony_ci # add subsystem packages 575f9996aaSopenharmony_ci foreach(pkg_label, lite_subsystem_components) { 585f9996aaSopenharmony_ci deps += [ pkg_label ] 595f9996aaSopenharmony_ci } 605f9996aaSopenharmony_ci } 615f9996aaSopenharmony_ci} 625f9996aaSopenharmony_ci 635f9996aaSopenharmony_citemplate("lite_subsystem_sdk") { 645f9996aaSopenharmony_ci assert(defined(invoker.interface_header), "interface_header in required.") 655f9996aaSopenharmony_ci assert(defined(invoker.sdk_libs_path), "sdk_libs_path in required.") 665f9996aaSopenharmony_ci assert(defined(invoker.subsystem_name), "subsystem_name in required.") 675f9996aaSopenharmony_ci 685f9996aaSopenharmony_ci interface_header = invoker.interface_header 695f9996aaSopenharmony_ci sdk_libs_path = invoker.sdk_libs_path 705f9996aaSopenharmony_ci subsystem_name = invoker.subsystem_name 715f9996aaSopenharmony_ci deps = [ ":${subsystem_name}" ] 725f9996aaSopenharmony_ci 735f9996aaSopenharmony_ci outdir = rebase_path("$root_out_dir/${subsystem_name}") 745f9996aaSopenharmony_ci prebuilts = "mkdir -p $outdir/interface $outdir/sdk_libs" 755f9996aaSopenharmony_ci command = "cp -r $interface_header $outdir/interface && cp -r $sdk_libs_path $outdir/sdk_libs" 765f9996aaSopenharmony_ci exec_path = rebase_path(".", root_build_dir) 775f9996aaSopenharmony_ci action(target_name) { 785f9996aaSopenharmony_ci args = [ 795f9996aaSopenharmony_ci "--path=$exec_path", 805f9996aaSopenharmony_ci "--prebuilts=$prebuilts", 815f9996aaSopenharmony_ci "--command=$command", 825f9996aaSopenharmony_ci "--enable=$LOSCFG_SDK_BUILD", 835f9996aaSopenharmony_ci ] 845f9996aaSopenharmony_ci script = "//build/lite/build_ext_components.py" 855f9996aaSopenharmony_ci outputs = [ "$target_out_dir/sdk_build_file_log.txt" ] 865f9996aaSopenharmony_ci } 875f9996aaSopenharmony_ci} 885f9996aaSopenharmony_ci 895f9996aaSopenharmony_citemplate("lite_vendor_sdk") { 905f9996aaSopenharmony_ci prebuilts = invoker.prebuilts 915f9996aaSopenharmony_ci command = invoker.command 925f9996aaSopenharmony_ci exec_path = rebase_path(".", root_build_dir) 935f9996aaSopenharmony_ci action(target_name) { 945f9996aaSopenharmony_ci args = [ 955f9996aaSopenharmony_ci "--path=$exec_path", 965f9996aaSopenharmony_ci "--prebuilts=$prebuilts", 975f9996aaSopenharmony_ci "--command=$command", 985f9996aaSopenharmony_ci "--enable=$LOSCFG_SDK_BUILD", 995f9996aaSopenharmony_ci ] 1005f9996aaSopenharmony_ci script = "//build/lite/build_ext_components.py" 1015f9996aaSopenharmony_ci outputs = [ "$target_out_dir/sdk_build_file_log.txt" ] 1025f9996aaSopenharmony_ci } 1035f9996aaSopenharmony_ci} 104