diff --git a/bundle.json b/bundle.json index 4a14d8771ba96c09ea527312d2dabdc6fb28b8bd..981a72c59d18213c982067feeb728f04a69fa4a1 100644 --- a/bundle.json +++ b/bundle.json @@ -33,6 +33,7 @@ "build": { "sub_component": [ "//commonlibrary/rust/ylong_runtime/ylong_io:ylong_io", + "//commonlibrary/rust/ylong_runtime/ylong_ffrt:ylong_ffrt", "//commonlibrary/rust/ylong_runtime/ylong_signal:ylong_signal" ], "inner_kits": [ diff --git a/test/BUILD.gn b/test/BUILD.gn index 1d96d52b985164c21afe245e66cfb8dadb3676f1..534f50c2bc395b14c8c0f24dfb6c76a1d150d5b4 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -26,6 +26,10 @@ ohos_rust_unittest("rust_ylong_runtime_test_ut") { "--cfg=feature=\"time\"", ] + if (is_linux) { + rustflags += [ "--cfg=feature=\"ffrt\"" ] + } + sources = [ "../ylong_runtime/src/lib.rs" ] deps = [ "../ylong_io:ylong_io", @@ -33,6 +37,10 @@ ohos_rust_unittest("rust_ylong_runtime_test_ut") { "../ylong_signal:ylong_signal", "//third_party/rust/crates/libc:lib", ] + + if (is_linux) { + deps += [ "../ylong_ffrt:ylong_ffrt" ] + } } ohos_rust_systemtest("rust_ylong_runtime_test_sdv") { @@ -49,11 +57,19 @@ ohos_rust_systemtest("rust_ylong_runtime_test_sdv") { "--cfg=feature=\"time\"", ] + if (is_linux) { + rustflags += [ "--cfg=feature=\"ffrt\"" ] + } + sources = [ "../ylong_runtime/tests/entry.rs" ] deps = [ "../ylong_runtime:ylong_runtime", "//third_party/rust/crates/libc:lib", ] + + if (is_linux) { + deps += [ "../ylong_ffrt:ylong_ffrt" ] + } } ohos_rust_systemtest("rust_ylong_signal_test_sdv") { diff --git a/ylong_ffrt/BUILD.gn b/ylong_ffrt/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8d3f00cd11cf3ee07e3d57160d20a8139437b977 --- /dev/null +++ b/ylong_ffrt/BUILD.gn @@ -0,0 +1,27 @@ +# 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_rust_static_library("ylong_ffrt") { + part_name = "ylong_runtime" + subsystem_name = "commonlibrary" + + crate_name = "ylong_ffrt" + edition = "2021" + + sources = [ "src/lib.rs" ] + deps = [ "//third_party/rust/crates/libc:lib" ] + + external_deps = [ "ffrt:libffrt" ] +} diff --git a/ylong_runtime/BUILD.gn b/ylong_runtime/BUILD.gn index 448e6f53b6cb2e482adac856e74db0f52e06e209..0fe32f63a83530f71357275255918cd87c8b6c27 100644 --- a/ylong_runtime/BUILD.gn +++ b/ylong_runtime/BUILD.gn @@ -30,11 +30,22 @@ ohos_rust_shared_library("ylong_runtime") { "time", ] + if (is_linux) { + features += [ "ffrt" ] + } + sources = [ "src/lib.rs" ] deps = [ + "../ylong_ffrt:ylong_ffrt", "../ylong_io:ylong_io", "../ylong_runtime_macros:ylong_runtime_macros(${host_toolchain})", "../ylong_signal:ylong_signal", "//third_party/rust/crates/libc:lib", ] + + if (is_linux) { + deps += [ "../ylong_ffrt:ylong_ffrt" ] + } + + external_deps = [ "ffrt:libffrt" ] }