# Copyright (c) 2025 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/templates/abc/ohos_abc.gni")
name_mapping = [
{
js_file = "$target_out_dir/engine/WindowSizeEnv.js"
ts_file = "src/WindowSizeEnv.ts"
abc_name = "windowsizeenv"
},
{
js_file = "$target_out_dir/engine/WindowAvoidAreaEnv.js"
ts_file = "src/WindowAvoidAreaEnv.ts"
abc_name = "windowavoidareaenv"
},
{
js_file = "$target_out_dir/engine/WindowFocusEnv.js"
ts_file = "src/WindowFocusEnv.ts"
abc_name = "windowfocusenv"
},
{
js_file = "$target_out_dir/engine/SystemDensityEnv.js"
ts_file = "src/SystemDensityEnv.ts"
abc_name = "systemdensityenv"
},
{
js_file = "$target_out_dir/engine/DisplayIdEnv.js"
ts_file = "src/DisplayIdEnv.ts"
abc_name = "displayidenv"
}
]
ts_inputs = [ "src/common.d.ts" ]
js_outputs = []
foreach(mapping, name_mapping) {
js_outputs += [ mapping.js_file ]
ts_inputs += [ mapping.ts_file ]
}
action("run_window_env_build") {
script = "build.py"
inputs = ts_inputs
outputs = js_outputs
args = [
rebase_path("//foundation/window/window_manager/interfaces/kits/napi/environmental"),
rebase_path("//foundation/window/window_manager/interfaces/kits/napi/environmental/node_modules"),
rebase_path("$target_out_dir/engine")
]
}
abc_targets = []
foreach(mapping, name_mapping) {
abc_targets += [ ":${mapping.abc_name}" ]
ohos_abc(mapping.abc_name) {
sources = [ mapping.js_file ]
output_name = "${mapping.abc_name}"
install_images = [ "system" ]
module_install_dir = "etc/abc/window"
part_name = "window_manager"
subsystem_name = "window"
deps = [ ":run_window_env_build" ]
}
}
group("windowenv_packages") {
deps = abc_targets
}