1# Copyright (C) 2023 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("//build/ohos.gni") 15import("//build/test.gni") 16 17rust_cxx("database_rs_cxx_gen") { 18 sources = [ "src/wrapper.rs" ] 19} 20 21ohos_static_library("database_rs_cxx") { 22 sanitize = { 23 integer_overflow = true 24 ubsan = true 25 boundary_sanitize = true 26 cfi = true 27 cfi_cross_dso = true 28 debug = false 29 } 30 31 include_dirs = [ 32 "include", 33 "${target_gen_dir}/src", 34 ] 35 36 sources = [ "src/cxx/wrapper.cpp" ] 37 sources += get_target_outputs(":database_rs_cxx_gen") 38 39 external_deps = [ 40 "hilog:libhilog", 41 "relational_store:native_rdb", 42 ] 43 44 deps = [ 45 ":database_rs_cxx_gen", 46 "//third_party/rust/crates/cxx:cxx_cppdeps", 47 ] 48 49 subsystem_name = "request" 50 part_name = "request" 51} 52 53ohos_rust_static_library("database_rs") { 54 crate_name = "rdb" 55 sanitize = { 56 integer_overflow = true 57 ubsan = true 58 boundary_sanitize = true 59 cfi = true 60 cfi_cross_dso = true 61 debug = false 62 } 63 64 sources = [ "src/lib.rs" ] 65 deps = [ 66 ":database_rs_cxx", 67 "//third_party/rust/crates/cxx:lib", 68 ] 69 70 subsystem_name = "request" 71 part_name = "request" 72} 73 74ohos_rust_unittest("rust_database_rs_ut_test") { 75 module_out_path = "request/common" 76 77 sources = [ "src/lib.rs" ] 78 79 deps = [ 80 ":database_rs_cxx", 81 "//third_party/rust/crates/cxx:lib", 82 ] 83 84 subsystem_name = "request" 85 part_name = "request" 86} 87 88group("unittest") { 89 testonly = true 90 deps = [ ":rust_database_rs_ut_test" ] 91} 92