1# Copyright (c) 2024 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} 65 66config("abckit_mock_config") { 67 defines = [ "ABCKIT_ENABLE_MOCK_IMPLEMENTATION" ] 68 69 configs = [ ":abckit_config" ] 70} 71 72group("abckit_packages") { 73 if (abckit_enable) { 74 deps = [ 75 "abckit:abckit(${host_toolchain})", 76 "src:libabckit", 77 ] 78 } 79} 80 81group("abckit_tests") { 82 testonly = true 83 if (abckit_enable) { 84 deps = [ 85 ":abckit_documentation", 86 ":abckit_status", 87 "tests:abckit_gtests_action", 88 "tests:abckit_mock_gtests_action", 89 "tests:abckit_stress_tests_apps", 90 "tests/canary:abckit_canary", 91 ] 92 } 93} 94 95group("abckit_clean_scenario_tests") { 96 testonly = true 97 if (abckit_enable) { 98 deps = [ "tests:abckit_clean_scenarios_action" ] 99 } 100} 101 102group("abckit_tests_full") { 103 testonly = true 104 if (abckit_enable) { 105 deps = [ 106 ":abckit_check_clang_format", 107 ":abckit_check_clang_tidy", 108 ":abckit_tests", 109 "tests/stress:abckit_stress_tests", 110 ] 111 } 112} 113 114action("abckit_status") { 115 script = "scripts/abckit_status.py" 116 args = [ 117 "--cppapi", 118 "--capi", 119 ] 120 outputs = [ "$target_gen_dir/abckit_status.csv" ] 121} 122 123action("abckit_documentation") { 124 script = "$abckit_root/scripts/run_script.sh" 125 126 args = [ 127 "--script=doxygen", 128 "--ret-code=0", 129 "--env=ABCKIT_DOXYGEN_OUT_DIR=" + rebase_path("$target_gen_dir") + 130 "/doxygen/", 131 "--env=ABCKIT_PROJECT_ROOT=" + rebase_path("$abckit_root"), 132 "--script-args=" + rebase_path("$abckit_root") + "/.doxygen", 133 ] 134 135 outputs = [ "$target_gen_dir/abckit_documentation_status.txt" ] 136} 137 138action("abckit_force_clang_format") { 139 script = "$ark_root_static/scripts/code_style/code_style_check.py" 140 args = [ 141 rebase_path("$abckit_root"), 142 "--reformat", 143 ] 144 outputs = [ "$target_gen_dir/generated/tmp/force_clang_format_status.txt" ] 145} 146 147action("abckit_check_clang_format") { 148 script = "$ark_root_static/scripts/code_style/code_style_check.py" 149 args = [ rebase_path("$abckit_root") ] 150 outputs = [ "$target_gen_dir/generated/tmp/check_clang_format_status.txt" ] 151} 152 153action("abckit_check_clang_tidy") { 154 script = "$ark_root_static/scripts/clang-tidy/clang_tidy_check.py" 155 args = [ 156 rebase_path("$ark_root_dynamic"), 157 rebase_path("$root_out_dir"), 158 "--check-libabckit", 159 "--filename-filter=libabckit/*", 160 "--header-filter=.*/libabckit/.*", 161 ] 162 outputs = [ "$target_gen_dir/generated/tmp/check_clang_tidy_status.txt" ] 163 164 deps = [ 165 "$ark_root_dynamic/assembler:arkassembler_header_deps", 166 "$ark_root_dynamic/compiler:arkcompiler_header_deps", 167 "$ark_root_dynamic/libpandabase:arkbase_header_deps", 168 "$ark_root_dynamic/libpandafile:arkfile_header_deps", 169 "$ark_root_static/assembler:arktsassembler_header_deps", 170 "$ark_root_static/compiler:arktscompiler_header_deps", 171 "$ark_root_static/libpandabase:arktsbase_header_deps", 172 "$ark_root_static/libpandafile:arktsfile_header_deps", 173 "src:libabckit_header_deps", 174 "src/adapter_dynamic:abckit_adapter_dynamic_header_deps", 175 "src/adapter_static:abckit_adapter_static_header_deps", 176 "src/codegen:abckit_codegen_dynamic_source_set_header_deps", 177 "src/codegen:abckit_codegen_static_source_set_header_deps", 178 "src/irbuilder_dynamic:abckit_ir_builder_dynamic_source_set_header_deps", 179 "src/wrappers:abckit_pandasm_wrapper_source_set_header_deps", 180 ] 181} 182