From 2bbfd51b924da8fe2204f99d55ff6340dfd1b61c Mon Sep 17 00:00:00 2001 From: Ilya Tihobaev Date: Thu, 30 May 2024 15:13:54 +0300 Subject: [PATCH] Fixed arkui-x build due to missed adapters Signed-off-by: Ilya Tihobaev Change-Id: Ic83d408ec93ce2a393686c1294fd1ab2e51227a2 --- ace_platforms.gni | 9 +++---- copy_arkui_adapters.py | 55 ++++++++++++++++++++++++++++++++++++++++++ graphic_config.gni | 10 ++++++++ 3 files changed, 68 insertions(+), 6 deletions(-) create mode 100755 copy_arkui_adapters.py diff --git a/ace_platforms.gni b/ace_platforms.gni index 9b8acaf9e9..bd679d5bc7 100644 --- a/ace_platforms.gni +++ b/ace_platforms.gni @@ -11,17 +11,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("graphic_config.gni") + enable_glfw_window = false use_mingw_win = "${current_os}_${current_cpu}" == "mingw_x86_64" -ace_root = "//foundation/arkui/ace_engine" graphic_2d_root = "//foundation/graphic/graphic_2d" ace_platforms = [] -_adapters = [ - "preview", - "ohos", -] -foreach(item, _adapters) { +foreach(item, adapters) { import_var = { } import_var = { diff --git a/copy_arkui_adapters.py b/copy_arkui_adapters.py new file mode 100755 index 0000000000..93e1e4f0c9 --- /dev/null +++ b/copy_arkui_adapters.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright (c) 2024 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 os +import sys +import shutil +import errno + + +def main(): + + if (len(sys.argv) != 3): + sys.stderr.write("MUST have 1 parameter for the source path and 1 parameter for the destination") + sys.stderr.write(os.linesep) + exit(errno.EINVAL) + + source_dir = os.path.realpath(sys.argv[1]) + if (not os.path.isdir(source_dir)): + print(source_dir) + sys.stderr.write("Source path MUST be a directory") + sys.stderr.write(os.linesep) + exit(errno.EINVAL) + + dest_dir = os.path.realpath(sys.argv[2]) + if (not os.path.isdir(dest_dir)): + sys.stderr.write("Destination path MUST be a directory") + sys.stderr.write(os.linesep) + exit(errno.EINVAL) + + for item in os.listdir(source_dir): + if not os.path.isdir(os.path.join(source_dir, item)): + continue + + file_path = os.path.join(source_dir, item, "build", "platform.gni") + if not os.path.isfile(file_path): + continue + + if not os.path.exists(os.path.join(dest_dir, item, "build")): + shutil.copytree(os.path.join(source_dir, item, "build"), os.path.join(dest_dir, item, "build")) + +if __name__ == "__main__": + main() diff --git a/graphic_config.gni b/graphic_config.gni index 75a3a5d86a..f675504cd1 100644 --- a/graphic_config.gni +++ b/graphic_config.gni @@ -309,6 +309,7 @@ memmgr_plugin_root = "//foundation/resourceschedule/memmgr_override" fuzz_test_output_path = "graphic_2d/graphic_2d" video_processing_engine_root = "//foundation/multimedia/video_processing_engine" arkui_root = "//foundation/arkui" +ace_root = "//foundation/arkui/ace_engine" accessibility_enable = false if (defined(global_parts_info) && @@ -340,3 +341,12 @@ use_memmgr = false if (defined(global_parts_info.resourceschedule_memmgr)) { use_memmgr = true } + +_ace_adapter_dir = rebase_path("$ace_root/adapter", root_build_dir) +_graphic_2d_adapter_dir = rebase_path("$graphic_2d_root/adapter", root_build_dir) + +if (defined(is_arkui_x) && is_arkui_x) { + # In case of arkui-x compilation, copy android and ios adapters from ace_engine + exec_script("$graphic_2d_root/copy_arkui_adapters.py", [_ace_adapter_dir, _graphic_2d_adapter_dir]) +} +adapters = exec_script("$ace_root/build/search.py", [ _graphic_2d_adapter_dir ], "list lines")