1# Copyright (c) 2024-2025 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//arkcompiler/runtime_core/ark_config.gni") 15import("//arkcompiler/runtime_core/libabckit/abckit_config.gni") 16 17config("abckit_config") { 18 cflags_cc = [ "-std=c++17" ] 19 cflags_c = [ "-std=c99" ] 20 21 cflags = [ 22 "-pedantic", 23 "-pedantic-errors", 24 "-Wall", 25 "-Wextra", 26 "-Werror", 27 ] 28 29 ldflags = [] 30 31 if (!is_debug) { 32 defines = [ "NDEBUG" ] 33 } 34 35 if (abckit_with_coverage) { 36 cflags += [ 37 "-fprofile-instr-generate", 38 "-fcoverage-mapping", 39 "-mllvm", 40 "-runtime-counter-relocation", 41 ] 42 43 ldflags += [ 44 "-fprofile-instr-generate", 45 "-fcoverage-mapping", 46 ] 47 } 48 49 if (abckit_with_sanitizers) { 50 cflags += [ 51 "-fsanitize=address", 52 "-fsanitize-address-use-after-scope", 53 "-fsanitize=undefined", 54 "-fno-omit-frame-pointer", 55 ] 56 57 ldflags += [ 58 "-lasan", 59 "-lubsan", 60 ] 61 } 62 63 configs = [ sdk_libc_secshared_config ] 64 configs += [ "$ark_root:ark_config" ] 65} 66 67config("abckit_mock_config") { 68 defines = [ "ABCKIT_ENABLE_MOCK_IMPLEMENTATION" ] 69 70 configs = [ ":abckit_config" ] 71} 72 73group("abckit_packages") { 74 if (abckit_enable) { 75 deps = [ 76 "abckit:abckit(${host_toolchain})", 77 "src:libabckit", 78 ] 79 } 80} 81 82group("abckit_tests") { 83 testonly = true 84 if (abckit_enable) { 85 deps = [ 86 ":abckit_documentation", 87 88 # Issue 24654 89 # ":abckit_status", 90 "tests:abckit_gtests_action", 91 "tests:abckit_mock_gtests_action", 92 "tests:abckit_stress_tests_apps", 93 "tests:arklink_strip_unused_code_gtests_action", 94 "tests/canary:abckit_canary", 95 ] 96 } 97} 98 99group("abckit_clean_scenario_tests") { 100 testonly = true 101 if (abckit_enable) { 102 deps = [ "tests:abckit_clean_scenarios_action" ] 103 } 104} 105 106group("abckit_tests_full") { 107 testonly = true 108 if (abckit_enable) { 109 deps = [ 110 ":abckit_check_clang_format", 111 ":abckit_check_clang_tidy", 112 ":abckit_tests", 113 "tests/stress:abckit_stress_tests", 114 ] 115 } 116} 117 118action("abckit_status") { 119 script = "scripts/abckit_status.py" 120 args = [ 121 "--cppapi", 122 "--capi", 123 ] 124 outputs = [ "$target_gen_dir/abckit_status.csv" ] 125} 126 127action("abckit_documentation") { 128 script = "$abckit_root/scripts/run_script.sh" 129 130 args = [ 131 "--script=doxygen", 132 "--ret-code=0", 133 "--env=ABCKIT_DOXYGEN_OUT_DIR=" + rebase_path("$target_gen_dir") + 134 "/doxygen/", 135 "--env=ABCKIT_PROJECT_ROOT=" + rebase_path("$abckit_root"), 136 "--script-args=" + rebase_path("$abckit_root") + "/.doxygen", 137 ] 138 139 outputs = [ "$target_gen_dir/abckit_documentation_status.txt" ] 140} 141 142action("abckit_force_clang_format") { 143 script = "$ark_root_static/scripts/code_style/code_style_check.py" 144 args = [ 145 rebase_path("$abckit_root"), 146 "--reformat", 147 ] 148 outputs = [ "$target_gen_dir/generated/tmp/force_clang_format_status.txt" ] 149} 150 151action("abckit_check_clang_format") { 152 script = "$ark_root_static/scripts/code_style/code_style_check.py" 153 args = [ rebase_path("$abckit_root") ] 154 outputs = [ "$target_gen_dir/generated/tmp/check_clang_format_status.txt" ] 155} 156 157action("abckit_check_clang_tidy") { 158 script = "$ark_root_static/scripts/clang-tidy/clang_tidy_check.py" 159 args = [ 160 rebase_path("$ark_root_dynamic"), 161 rebase_path("$root_out_dir"), 162 "--check-libabckit", 163 "--filename-filter=libabckit/*", 164 "--header-filter=.*/libabckit/.*", 165 ] 166 outputs = [ "$target_gen_dir/generated/tmp/check_clang_tidy_status.txt" ] 167 168 deps = [ 169 "$ark_root_dynamic/assembler:arkassembler_header_deps", 170 "$ark_root_dynamic/compiler:arkcompiler_header_deps", 171 "$ark_root_dynamic/libpandabase:arkbase_header_deps", 172 "$ark_root_dynamic/libpandafile:arkfile_header_deps", 173 "$ark_root_static/assembler:arktsassembler_header_deps", 174 "$ark_root_static/compiler:arktscompiler_header_deps", 175 "$ark_root_static/libpandabase:arktsbase_header_deps", 176 "$ark_root_static/libpandafile:arktsfile_header_deps", 177 "src:libabckit_header_deps", 178 "src/adapter_dynamic:abckit_adapter_dynamic_header_deps", 179 "src/adapter_static:abckit_adapter_static_header_deps", 180 "src/codegen:abckit_codegen_dynamic_source_set_header_deps", 181 "src/codegen:abckit_codegen_static_source_set_header_deps", 182 "src/irbuilder_dynamic:abckit_ir_builder_dynamic_source_set_header_deps", 183 "src/wrappers:abckit_pandasm_wrapper_source_set_header_deps", 184 ] 185} 186