# Copyright (c) 2023 Huawei Device Co., Ltd.
# 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/ohos/app/app.gni")
template("arkui_x_app") {
forward_variables_from(invoker, [ "testonly" ])
_sdk_home = "//out/sdk"
if (defined(invoker.sdk_home)) {
_sdk_home = invoker.sdk_home
}
_app_name = target_name
if (defined(invoker.app_name)) {
_app_name = invoker.app_name
}
_project_root_dir = get_path_info("./", "abspath")
_arkui_x_app_root = "${_project_root_dir}/.arkui-x"
_hap_out_dir = "//${root_build_dir}/arkui_x_app"
_build_ohos_app = "ohos_${target_name}"
ohos_app(_build_ohos_app) {
sdk_home = _sdk_home
certificate_profile = invoker.certificate_profile
sdk_type_name = [
"sdk.dir",
"arkui-x.dir",
]
hap_out_dir = "${_hap_out_dir}/ohos"
}
action(target_name) {
deps = [ ":$_build_ohos_app" ]
script = "//build_plugins/app/compile_app.py"
outputs = [ "${target_out_dir}/${target_name}.stamp" ]
args = [
"--root-dir",
rebase_path(_arkui_x_app_root, root_build_dir),
"--output-dir",
rebase_path(_hap_out_dir, root_build_dir),
"--app-name",
_app_name,
"--host-os",
host_os,
]
}
}