# 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/config/components/ets_frontend/es2abc_config.gni")
import("//build/ohos.gni")
import("//build/templates/abc/ohos_abc.gni")
import("//foundation/arkui/ace_engine/ace_config.gni")

action("run_rollup") {
  script = "run_rollup.py"

  inputs = [
    rebase_path("image_generator_dialog_project/general/components/Main.js"),
  ]

  outputs = [
    target_out_dir + "/imagegeneratordialog.js"
  ]

  args = [
    rebase_path("//prebuilts/build-tools/common/js-framework/node_modules/rollup/dist/bin"),
    rebase_path("image_generator_dialog_project/general/components/Main.js"),
    rebase_path(target_out_dir + "/imagegeneratordialog.js")
  ]
}

ohos_abc("imageGeneratorDialog") {
  sources = [ rebase_path(target_out_dir + "/imagegeneratordialog.js") ]
  output_name = "imagegeneratordialog"
  install_images = [ "system" ]
  module_install_dir = "etc/abc/arkui"
  subsystem_name = ace_engine_subsystem
  part_name = ace_engine_part
  deps = [":run_rollup"]
}