加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test.gni 24.10 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
# Copyright (c) 2021 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/clang/clang.gni")
import("//build/config/python.gni")
import("//build/ohos.gni")
import("//build/ohos_var.gni")
import("//build/templates/cxx/cxx.gni")
if (!is_arkui_x) {
import("//build/rust/rustc_toolchain.gni")
}
template("_testcase_resources") {
assert(defined(invoker.testcase_target_name))
assert(defined(invoker.test_output_dir))
assert(defined(invoker.module_out_path))
_deps = []
if (defined(invoker.deps)) {
_deps += invoker.deps
}
action_with_pydeps(target_name) {
if (defined(invoker.testonly)) {
testonly = invoker.testonly
}
deps = _deps
inputs = []
script = "//build/ohos/testfwk/testcase_resource_copy.py"
output_file = "$target_out_dir/$target_name.json"
outputs = [ output_file ]
depfile = "$target_gen_dir/$target_name.d"
args = []
if (defined(invoker.resource_config_file)) {
args += [
"--resource-config-file",
rebase_path(invoker.resource_config_file, root_build_dir),
]
inputs += [ invoker.resource_config_file ]
}
args += [
"--depfile",
rebase_path(depfile, root_build_dir),
"--testcase-target-name",
invoker.testcase_target_name,
"--part-build-out-path",
rebase_path(root_out_dir, root_build_dir),
"--resource-output-path",
rebase_path(invoker.test_output_dir + "/resource", root_build_dir),
"--module-out-path",
invoker.module_out_path,
"--output-file",
rebase_path(output_file, root_build_dir),
]
}
}
# ohos test template
template("_ohos_test") {
assert(defined(invoker.test_type), "test_type is required.")
assert(defined(invoker.module_out_path))
_deps = []
if (defined(invoker.deps)) {
_deps += invoker.deps
}
if (defined(invoker.crate_type)) {
_deps += [ "//build/rust:libstd.dylib.so" ]
}
test_output_dir =
"$root_out_dir/tests/${invoker.test_type}/${invoker.module_out_path}"
# generate module list file in gn stage
if (!skip_generate_module_list_file) {
_gen_module_list_script = "//build/ohos/testfwk/gen_module_list_files.py"
_arguments = [
"--target",
target_name,
"--target_label",
get_label_info(":$target_name", "label_with_toolchain"),
"--source_dir",
rebase_path(get_label_info(":$target_name", "dir"), root_build_dir),
"--test_type",
invoker.test_type,
]
_module_list_file = "$root_out_dir/module_list_files/${invoker.module_out_path}/$target_name.mlf"
_arguments += [
"--output_dir",
rebase_path(test_output_dir, root_build_dir),
"--module_list_file",
rebase_path(_module_list_file, root_build_dir),
]
exec_script(_gen_module_list_script, _arguments)
}
# copy testcase resource
testcase_target_name = target_name
_testcase_resources("${testcase_target_name}_resource_copy") {
if (defined(invoker.resource_config_file)) {
resource_config_file = invoker.resource_config_file
}
module_out_path = invoker.module_out_path
deps = _deps
testonly = true
}
# copy fuzz config file
if (defined(invoker.fuzz_config_file)) {
fuzz_config_file = invoker.fuzz_config_file
action("${target_name}_copy_fuzz_config_file") {
script = "//build/ohos/testfwk/fuzz_config_file_copy.py"
inputs = [ fuzz_config_file ]
args = []
args += [
"--fuzz-config-file-path",
rebase_path(fuzz_config_file, root_build_dir),
"--fuzz-config-file-output-path",
rebase_path(root_out_dir + "/tests/res", root_build_dir),
]
outputs = [ "$target_out_dir/${target_name}_result.txt" ]
}
}
_has_sources = defined(invoker.sources) && invoker.sources != []
if (_has_sources) {
_c_sources_file = "$target_gen_dir/$target_name.sources"
write_file(_c_sources_file, rebase_path(invoker.sources, root_build_dir))
}
write_file("$test_output_dir/${target_name}_path.txt",
get_label_info(":$target_name", "dir"),
"string")
ohos_executable(target_name) {
forward_variables_from(invoker,
"*",
[
"test_type",
"module_out_path",
"visibility",
])
forward_variables_from(invoker, [ "visibility" ])
if (!defined(deps)) {
deps = []
}
deps += [ ":${testcase_target_name}_resource_copy" ]
if (defined(invoker.fuzz_config_file)) {
deps += [ ":${target_name}_copy_fuzz_config_file" ]
}
subsystem_name = "tests"
part_name = invoker.test_type
ohos_test = true
testonly = true
output_name = "$target_name"
}
}
template("ohos_unittest") {
_ohos_test(target_name) {
testonly = true
forward_variables_from(invoker, "*")
test_type = "unittest"
deps = []
external_deps = []
if (defined(invoker.deps)) {
deps += invoker.deps
}
if (defined(invoker.external_deps)) {
external_deps += invoker.external_deps
}
# Add static link library judgment logic below
if (defined(invoker.rtti_compile_flag) && invoker.rtti_compile_flag) {
external_deps += [ "googletest:gtest_rtti_main" ]
} else {
external_deps += [ "googletest:gtest_main" ]
}
}
}
template("ohos_moduletest") {
_ohos_test(target_name) {
testonly = true
forward_variables_from(invoker, "*")
test_type = "moduletest"
deps = []
external_deps = []
if (defined(invoker.deps)) {
deps += invoker.deps
}
if (defined(invoker.external_deps)) {
external_deps += invoker.external_deps
}
external_deps += [ "googletest:gtest_main" ]
}
}
template("ohos_systemtest") {
_ohos_test(target_name) {
forward_variables_from(invoker, "*")
test_type = "systemtest"
}
}
template("ohos_performancetest") {
_ohos_test(target_name) {
testonly = true
forward_variables_from(invoker, "*")
test_type = "performance"
deps = []
external_deps = []
if (defined(invoker.deps)) {
deps += invoker.deps
}
deps +=
[ "//test/testfwk/developer_test/aw/cxx/hwext:performance_test_static" ]
if (defined(invoker.external_deps)) {
external_deps += invoker.external_deps
}
external_deps += [ "googletest:gtest_main" ]
}
}
template("ohos_securitytest") {
_ohos_test(target_name) {
forward_variables_from(invoker, "*")
test_type = "security"
}
}
template("ohos_reliabilitytest") {
_ohos_test(target_name) {
forward_variables_from(invoker, "*")
test_type = "reliability"
}
}
template("ohos_distributedtest") {
_ohos_test(target_name) {
forward_variables_from(invoker, "*")
test_type = "distributedtest"
deps = []
if (defined(invoker.deps)) {
deps += invoker.deps
}
deps += [
"//test/testfwk/developer_test/aw/cxx/distributed:distributedtest_lib",
]
}
}
template("ohos_fuzztest") {
# Judge the compliation library.
# Do the FUZZ compliation if the compliation library is the musl.
if (use_musl) {
_ohos_test(target_name) {
forward_variables_from(invoker,
"*",
[
"deps",
"cflags",
])
test_type = "fuzztest"
deps = []
if (defined(invoker.deps)) {
deps += invoker.deps
}
cflags = []
if (defined(invoker.cflags)) {
cflags += invoker.cflags
}
cflags += [
"-fno-sanitize-coverage=trace-pc-guard,edge,trace-cmp,indirect-calls,8bit-counters",
"-fsanitize=fuzzer",
]
if (target_cpu == "arm64") {
libs =
[ "$clang_lib_base_path/aarch64-linux-ohos/libclang_rt.fuzzer.a" ]
} else if (target_cpu == "x86_64") {
libs = [ "$clang_lib_base_path/x86_64-linux-ohos/libclang_rt.fuzzer.a" ]
} else {
libs = [ "$clang_lib_base_path/arm-linux-ohos/libclang_rt.fuzzer.a" ]
}
}
} else {
group(target_name) {
not_needed(invoker, "*")
}
}
}
template("ohos_benchmarktest") {
_ohos_test(target_name) {
testonly = true
forward_variables_from(invoker, "*", [ "deps" ])
test_type = "benchmark"
deps = []
external_deps = []
if (defined(invoker.deps)) {
deps += invoker.deps
}
if (defined(invoker.external_deps)) {
external_deps += invoker.external_deps
}
external_deps += [ "benchmark:benchmark" ]
}
}
template("_test_py_file_copy") {
assert(defined(invoker.sources), "sources is required.")
assert(defined(invoker.target_base_dir))
assert(defined(invoker.copy_output_dir))
action_with_pydeps(target_name) {
forward_variables_from(invoker,
[
"sources",
"testonly",
"visibility",
])
script = "//build/ohos/testfwk/test_py_file_copy.py"
deps = []
if (defined(invoker.deps)) {
deps += invoker.deps
}
depfile = "$target_gen_dir/$target_name.d"
outfile = "$target_out_dir/$target_name.out"
outputs = [ outfile ]
args = [
"--target-base-dir",
rebase_path(invoker.target_base_dir, root_build_dir),
"--copy-output-dir",
rebase_path(invoker.copy_output_dir, root_build_dir),
"--outfile",
rebase_path(outfile, root_build_dir),
"--depfile",
rebase_path(depfile, root_build_dir),
"--source-files",
]
args += rebase_path(sources, root_build_dir)
}
}
# python test template
template("_ohos_test_py") {
assert(defined(invoker.test_type), "test_type is required.")
assert(defined(invoker.sources), "sources is required.")
_gen_module_list_script = "//build/ohos/testfwk/gen_module_list_files.py"
_arguments = [
"--target",
target_name,
"--target_label",
get_label_info(":$target_name", "label_with_toolchain"),
"--source_dir",
rebase_path(get_label_info(":$target_name", "dir"), root_build_dir),
"--test_type",
invoker.test_type,
]
if (defined(invoker.module_out_path)) {
test_output_dir =
"$root_out_dir/tests/${invoker.test_type}/${invoker.module_out_path}"
_module_list_file = "$root_out_dir/module_list_files/${invoker.module_out_path}/$target_name.mlf"
} else {
test_output_dir = "$root_out_dir/tests/${invoker.test_type}"
_module_list_file = "$root_out_dir/module_list_files/$target_name.mlf"
}
_arguments += [
"--output_dir",
rebase_path(test_output_dir, root_build_dir),
"--module_list_file",
rebase_path(_module_list_file, root_build_dir),
]
exec_script(_gen_module_list_script, _arguments)
_test_py_file_copy(target_name) {
testonly = true
target_base_dir = get_label_info(":$target_name", "dir")
copy_output_dir = test_output_dir
sources = get_path_info(invoker.sources, "abspath")
}
}
template("ohos_unittest_py") {
_ohos_test_py(target_name) {
forward_variables_from(invoker, "*")
test_type = "unittest"
}
}
template("ohos_moduletest_py") {
_ohos_test_py(target_name) {
forward_variables_from(invoker, "*")
test_type = "moduletest"
}
}
template("ohos_systemtest_py") {
_ohos_test_py(target_name) {
forward_variables_from(invoker, "*")
test_type = "systemtest"
}
}
template("ohos_performancetest_py") {
_ohos_test_py(target_name) {
forward_variables_from(invoker, "*")
test_type = "performance"
}
}
template("ohos_securitytest_py") {
_ohos_test_py(target_name) {
forward_variables_from(invoker, "*")
test_type = "security"
}
}
template("ohos_reliabilitytest_py") {
_ohos_test_py(target_name) {
forward_variables_from(invoker, "*")
test_type = "reliability"
}
}
template("ohos_distributedtest_py") {
_ohos_test_py(target_name) {
forward_variables_from(invoker, "*")
test_type = "distributedtest"
}
}
template("ohos_fuzztest_py") {
_ohos_test_py(target_name) {
forward_variables_from(invoker, "*")
test_type = "fuzztest"
}
}
#js api test template
template("ohos_js_test") {
assert(defined(invoker.test_type), "test_type must be defined.")
assert(defined(invoker.hap_profile), "hap_profile must be defined.")
assert(defined(invoker.module_out_path), "module_out_path must be defined.")
# generate module list file in gn stage
_gen_module_list_script = "//build/ohos/testfwk/gen_module_list_files.py"
_arguments = [
"--target",
target_name,
"--target_label",
get_label_info(":$target_name", "label_with_toolchain"),
"--source_dir",
rebase_path(get_label_info(":$target_name", "dir"), root_build_dir),
"--test_type",
invoker.test_type,
]
_test_output_dir =
"$root_out_dir/tests/${invoker.test_type}/${invoker.module_out_path}"
_module_list_file = "$root_out_dir/module_list_files/${invoker.module_out_path}/$target_name.mlf"
write_file("$_test_output_dir/${target_name}_path.txt",
get_label_info(":$target_name", "dir"),
"string")
_arguments += [
"--output_dir",
rebase_path(_test_output_dir, root_build_dir),
"--module_list_file",
rebase_path(_module_list_file, root_build_dir),
]
exec_script(_gen_module_list_script, _arguments)
# copy testcase resource
testcase_target_name = target_name
_testcase_resources("${testcase_target_name}_resource_copy") {
if (defined(invoker.resource_config_file)) {
resource_config_file = invoker.resource_config_file
}
module_out_path = invoker.module_out_path
test_output_dir = _test_output_dir
}
_suite_path = get_label_info(":$target_name", "dir")
_template_path = "//test/testfwk/developer_test/libs/js_template"
_target_path = "${_template_path}/$target_name"
_target_js_copy = "${target_name}__js_copy"
action_with_pydeps(_target_js_copy) {
script = "//build/ohos/testfwk/test_js_file_copy.py"
outputs = [ "$target_out_dir/$target_name.out" ]
args = [
"--suite_path",
rebase_path(_suite_path, root_build_dir),
"--template_path",
rebase_path(_template_path, root_build_dir),
"--target_path",
rebase_path(_target_path, root_build_dir),
"--test_output_dir",
rebase_path(_test_output_dir, root_build_dir),
"--target_name",
testcase_target_name,
]
deps = [ ":${testcase_target_name}_resource_copy" ]
}
_target_js_assets = "${target_name}__intl_js_assets"
ohos_js_assets(_target_js_assets) {
source_dir = "${_target_path}/src/main/js/default"
deps = [ ":$_target_js_copy" ]
}
_target_resources = "${target_name}__resources"
ohos_resources(_target_resources) {
sources = [ "${_target_path}/src/main/resources" ]
deps = [ ":$_target_js_assets" ]
hap_profile = invoker.hap_profile
}
ohos_hap(target_name) {
forward_variables_from(invoker,
"*",
[
"test_type",
"module_out_path",
"visibility",
])
forward_variables_from(invoker, [ "visibility" ])
deps = [
":$_target_js_assets",
":$_target_resources",
]
final_hap_path = "$_test_output_dir/$target_name.hap"
js_build_mode = "debug"
testonly = true
}
}
template("ohos_js_unittest") {
ohos_js_test(target_name) {
forward_variables_from(invoker, "*")
test_type = "unittest"
}
}
template("ohos_js_stage_test") {
if (defined(invoker.part_name)) {
_part_name = invoker.part_name
}
if (defined(invoker.subsystem_name)) {
_subsystem_name = invoker.subsystem_name
}
if (defined(invoker.test_type)) {
_test_type = invoker.test_type
}
_build_part_boolean = true
if (defined(invoker.module_out_path)) {
_test_output_dir =
"$root_out_dir/tests/${invoker.test_type}/${invoker.module_out_path}"
} else {
_test_output_dir = "$root_out_dir/tests/${invoker.test_type}"
}
write_file("$_test_output_dir/${target_name}_path.txt",
get_label_info(":$target_name", "dir"),
"string")
# generate module list file in gn stage
if (!skip_generate_module_list_file) {
_gen_module_list_script = "//build/ohos/testfwk/gen_module_list_files.py"
_arguments = [
"--target",
target_name,
"--target_label",
get_label_info(":$target_name", "label_with_toolchain"),
"--source_dir",
rebase_path(get_label_info(":$target_name", "dir"), root_build_dir),
"--test_type",
_test_type,
]
_module_list_file = "$root_out_dir/module_list_files/${invoker.module_out_path}/$target_name.mlf"
_arguments += [
"--output_dir",
rebase_path(_test_output_dir, root_build_dir),
"--module_list_file",
rebase_path(_module_list_file, root_build_dir),
]
exec_script(_gen_module_list_script, _arguments)
}
assert(defined(invoker.hap_name),
"hap_name is required in target ${target_name}")
assert(!defined(invoker.final_hap_path),
"please use hap_name instead of final_hap_path")
_hap_name = invoker.hap_name
_final_hap_path = ""
_target_name = ""
_final_hap_path =
"$root_out_dir/tests/haps/${invoker.module_out_path}/${_hap_name}.hap"
_target_name = "module_${target_name}"
_archive_filename = "${_hap_name}.hap"
if (_build_part_boolean == true) {
target("ohos_hap", _target_name) {
forward_variables_from(invoker, "*")
final_hap_path = _final_hap_path
testonly = true
}
} else {
print(tmp_subsystem_part + " is not build")
print(_target_name)
if (defined(invoker.certificate_profile)) {
print(invoker.certificate_profile)
}
if (defined(invoker.ets2abc)) {
print(invoker.ets2abc)
}
if (defined(invoker.deps)) {
print(invoker.deps)
}
if (defined(invoker.hap_profile)) {
print(invoker.hap_profile)
}
if (defined(invoker.testonly)) {
print(invoker.testonly)
}
}
_deps = [ ":module_${target_name}" ]
_archive_testfile = "$root_out_dir/tests/$_test_type/${invoker.module_out_path}/${_archive_filename}"
_arguments = []
_arguments = [
"--build_target_name",
target_name,
"--project_path",
rebase_path("."),
"--archive_testfile",
rebase_path("${_archive_testfile}"),
"--final_hap_path",
rebase_path("${_final_hap_path}"),
"--test_type",
_test_type,
"--module_out_path",
invoker.module_out_path,
]
if (_subsystem_name != "") {
_arguments += [
"--subsystem_name",
_subsystem_name,
]
}
if (_part_name != "") {
_arguments += [
"--part_name",
_part_name,
]
}
action(target_name) {
deps = _deps
script = rebase_path("//build/ohos/testfwk/test_js_stage_file_copy.py")
args = _arguments
outputs = [ _archive_testfile ]
testonly = true
}
}
template("ohos_js_stage_unittest") {
ohos_js_stage_test(target_name) {
forward_variables_from(invoker, "*")
test_type = "unittest"
}
}
template("ohos_rust_unittest") {
_target_name = target_name
_rustflags = []
_public_deps = [ "//build/rust/tests:original_libstd.so" ]
ohos_unittest("$_target_name") {
forward_variables_from(invoker, "*")
public_deps = _public_deps
if (!defined(invoker.crate_name)) {
crate_name = _target_name
}
crate_type = "bin"
if (defined(invoker.crate_type)) {
assert(invoker.crate_type == crate_type,
"crate_type should be $crate_type or use default value.")
}
if (defined(invoker.rustc_lints)) {
rustc_lints = invoker.rustc_lints
}
if (defined(invoker.clippy_lints)) {
clippy_lints = invoker.clippy_lints
}
if (!defined(rustc_lints) && !defined(clippy_lints)) {
file_path =
get_path_info(get_path_info(invoker.sources, "dir"), "abspath")
file_path_split = string_split(file_path[0], "/")
source_dir_begin = file_path_split[2]
if (source_dir_begin == "openharmony") {
_rustflags += allowAllLints
} else if (source_dir_begin == "prebuilts") {
_rustflags += allowAllLints
} else if (source_dir_begin == "vendor") {
_rustflags += rustcVendorLints
_rustflags += clippyVendorLints
} else if (source_dir_begin == "device") {
_rustflags += rustcVendorLints
_rustflags += clippyVendorLints
} else {
_rustflags += rustcOhosLints
_rustflags += clippyOhosLints
}
}
if (defined(rustc_lints)) {
if (invoker.rustc_lints == "openharmony") {
_rustflags += rustcOhosLints
} else if (rustc_lints == "vendor") {
_rustflags += rustcVendorLints
} else if (rustc_lints == "none") {
_rustflags += allowAllLints
}
}
if (defined(clippy_lints)) {
if (invoker.clippy_lints == "openharmony") {
_rustflags += clippyOhosLints
} else if (clippy_lints == "vendor") {
_rustflags += clippyVendorLints
} else if (clippy_lints == "none") {
_rustflags += allowAllLints
}
}
if (!defined(rustflags)) {
rustflags = _rustflags
} else {
rustflags += _rustflags
}
edition = rust_default_edition
if (defined(invoker.edition)) {
edition = invoker.edition
}
rustflags += [
"--cfg",
"feature=\"test\"",
"--test",
"-Csymbol-mangling-version=v0",
"--edition=${edition}",
]
}
}
template("ohos_rust_systemtest") {
_target_name = target_name
_rustflags = []
_public_deps = [ "//build/rust/tests:original_libstd.so" ]
ohos_systemtest("$_target_name") {
forward_variables_from(invoker, "*")
public_deps = _public_deps
if (!defined(invoker.crate_name)) {
crate_name = _target_name
}
crate_type = "bin"
if (defined(invoker.crate_type)) {
assert(invoker.crate_type == crate_type,
"crate_type should be $crate_type or use default value.")
}
if (defined(invoker.rustc_lints)) {
rustc_lints = invoker.rustc_lints
}
if (defined(invoker.clippy_lints)) {
clippy_lints = invoker.clippy_lints
}
if (!defined(rustc_lints) && !defined(clippy_lints)) {
file_path =
get_path_info(get_path_info(invoker.sources, "dir"), "abspath")
file_path_split = string_split(file_path[0], "/")
source_dir_begin = file_path_split[2]
if (source_dir_begin == "openharmony") {
_rustflags += allowAllLints
} else if (source_dir_begin == "prebuilts") {
_rustflags += allowAllLints
} else if (source_dir_begin == "vendor") {
_rustflags += rustcVendorLints
_rustflags += clippyVendorLints
} else if (source_dir_begin == "device") {
_rustflags += rustcVendorLints
_rustflags += clippyVendorLints
} else {
_rustflags += rustcOhosLints
_rustflags += clippyOhosLints
}
}
if (defined(rustc_lints)) {
if (invoker.rustc_lints == "openharmony") {
_rustflags += rustcOhosLints
} else if (rustc_lints == "vendor") {
_rustflags += rustcVendorLints
} else if (rustc_lints == "none") {
_rustflags += allowAllLints
}
}
if (defined(clippy_lints)) {
if (invoker.clippy_lints == "openharmony") {
_rustflags += clippyOhosLints
} else if (clippy_lints == "vendor") {
_rustflags += clippyVendorLints
} else if (clippy_lints == "none") {
_rustflags += allowAllLints
}
}
if (!defined(rustflags)) {
rustflags = _rustflags
} else {
rustflags += _rustflags
}
edition = rust_default_edition
if (defined(invoker.edition)) {
edition = invoker.edition
}
rustflags += [
"--cfg",
"feature=\"test\"",
"--test",
"-Csymbol-mangling-version=v0",
"--edition=${edition}",
]
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化