# Copyright (c) 2023 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/ohos.gni") ohos_cargo_crate("target") { crate_name = "test_rlib_crate" crate_root = "crate/src/lib.rs" sources = [ "crate/src/lib.rs" ] #To generate the build_script binary build_root = "crate/build.rs" build_sources = [ "crate/build.rs" ] build_script_outputs = [ "generated/generated.rs" ] features = [ "my-feature_a", "my-feature_b", "std", ] rustflags = [ "--cfg", "test_a_and_b", ] rustenv = [ "ENV_VAR_FOR_BUILD_SCRIPT=45" ] } # Exists to test the case that a single crate has both a library and a binary ohos_cargo_crate("test_rlib_crate_associated_bin") { crate_root = "crate/src/main.rs" crate_type = "bin" sources = [ "crate/src/main.rs" ] #To generate the build_script binary build_root = "crate/build.rs" build_sources = [ "crate/build.rs" ] features = [ "my-feature_a", "my-feature_b", "std", ] rustenv = [ "ENV_VAR_FOR_BUILD_SCRIPT=45" ] deps = [ ":target" ] }