init package

This commit is contained in:
heppen 2023-08-03 10:51:00 +08:00
parent ec11297f57
commit c6535c066f
5 changed files with 358 additions and 0 deletions

View File

@ -0,0 +1,149 @@
From 88604ee2d4d258ec50e298987f196621e34ee85f Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Thu, 3 Aug 2023 11:22:38 +0800
Subject: [PATCH] Trim the dependencies on hitrace/libuv
---
bundle.json | 3 +--
.../innerkitsimpl/src/adaptor/distributed_object_impl.cpp | 5 -----
.../src/adaptor/distributed_object_store_impl.cpp | 7 +++----
interfaces/innerkits/BUILD.gn | 8 ++++----
4 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/bundle.json b/bundle.json
index a8ae0c9..83568ff 100644
--- a/bundle.json
+++ b/bundle.json
@@ -45,7 +45,6 @@
"deps": {
"components": [
"ability_base",
- "ability_runtime",
"hitrace_native",
"dsoftbus",
"distributeddatamgr",
@@ -62,7 +61,7 @@
},
"build": {
"sub_component": [
- "//foundation/distributeddatamgr/data_object/interfaces/jskits:build_module"
+
],
"inner_kits": [
{
diff --git a/frameworks/innerkitsimpl/src/adaptor/distributed_object_impl.cpp b/frameworks/innerkitsimpl/src/adaptor/distributed_object_impl.cpp
index 1e1722a..a61e862 100644
--- a/frameworks/innerkitsimpl/src/adaptor/distributed_object_impl.cpp
+++ b/frameworks/innerkitsimpl/src/adaptor/distributed_object_impl.cpp
@@ -15,7 +15,6 @@
#include "distributed_object_impl.h"
-#include "hitrace.h"
#include "objectstore_errors.h"
#include "string_utils.h"
@@ -55,7 +54,6 @@ uint32_t GetNum(Bytes &data, uint32_t offset, void *val, uint32_t valLen)
uint32_t DistributedObjectImpl::PutDouble(const std::string &key, double value)
{
- HiTrace trace(std::string(__FUNCTION__));
Bytes data;
Type type = Type::TYPE_DOUBLE;
PutNum(&type, 0, sizeof(type), data);
@@ -69,7 +67,6 @@ uint32_t DistributedObjectImpl::PutDouble(const std::string &key, double value)
uint32_t DistributedObjectImpl::PutBoolean(const std::string &key, bool value)
{
- HiTrace trace(std::string(__FUNCTION__));
Bytes data;
Type type = Type::TYPE_BOOLEAN;
PutNum(&type, 0, sizeof(type), data);
@@ -83,7 +80,6 @@ uint32_t DistributedObjectImpl::PutBoolean(const std::string &key, bool value)
uint32_t DistributedObjectImpl::PutString(const std::string &key, const std::string &value)
{
- HiTrace trace(std::string(__FUNCTION__));
Bytes data;
Type type = Type::TYPE_STRING;
PutNum(&type, 0, sizeof(type), data);
@@ -172,7 +168,6 @@ DistributedObjectImpl::DistributedObjectImpl(const std::string &sessionId, FlatO
uint32_t DistributedObjectImpl::PutComplex(const std::string &key, const std::vector<uint8_t> &value)
{
- HiTrace trace(std::string(__FUNCTION__));
Bytes data;
Type type = Type::TYPE_COMPLEX;
PutNum(&type, 0, sizeof(type), data);
diff --git a/frameworks/innerkitsimpl/src/adaptor/distributed_object_store_impl.cpp b/frameworks/innerkitsimpl/src/adaptor/distributed_object_store_impl.cpp
index 5c51ac0..7fb8d21 100644
--- a/frameworks/innerkitsimpl/src/adaptor/distributed_object_store_impl.cpp
+++ b/frameworks/innerkitsimpl/src/adaptor/distributed_object_store_impl.cpp
@@ -15,7 +15,6 @@
#include <thread>
-#include "hitrace.h"
#include "distributed_object_impl.h"
#include "distributed_objectstore_impl.h"
#include "objectstore_errors.h"
@@ -62,7 +61,7 @@ void DistributedObjectStoreImpl::RemoveCacheObject(const std::string &sessionId)
DistributedObject *DistributedObjectStoreImpl::CreateObject(const std::string &sessionId)
{
- HiTrace trace(std::string(__FUNCTION__));
+ //HiTrace trace(std::string(__FUNCTION__));
if (flatObjectStore_ == nullptr) {
LOG_ERROR("DistributedObjectStoreImpl::CreateObject store not opened!");
return nullptr;
@@ -83,7 +82,7 @@ DistributedObject *DistributedObjectStoreImpl::CreateObject(const std::string &s
DistributedObject *DistributedObjectStoreImpl::CreateObject(const std::string &sessionId, uint32_t &status)
{
- HiTrace trace(std::string(__FUNCTION__));
+ //HiTrace trace(std::string(__FUNCTION__));
if (flatObjectStore_ == nullptr) {
LOG_ERROR("DistributedObjectStoreImpl::CreateObject store not opened!");
status = ERR_NULL_OBJECTSTORE;
@@ -106,7 +105,7 @@ DistributedObject *DistributedObjectStoreImpl::CreateObject(const std::string &s
uint32_t DistributedObjectStoreImpl::DeleteObject(const std::string &sessionId)
{
- HiTrace trace(std::string(__FUNCTION__));
+ //HiTrace trace(std::string(__FUNCTION__));
if (flatObjectStore_ == nullptr) {
LOG_ERROR("DistributedObjectStoreImpl::Sync object err ");
return ERR_NULL_OBJECTSTORE;
diff --git a/interfaces/innerkits/BUILD.gn b/interfaces/innerkits/BUILD.gn
index de4bf4e..1f8b87d 100644
--- a/interfaces/innerkits/BUILD.gn
+++ b/interfaces/innerkits/BUILD.gn
@@ -13,7 +13,7 @@
import("//build/ohos.gni")
config("objectstore_config") {
- visibility = [ "//foundation/distributeddatamgr/data_object:*" ]
+ visibility = [ "//foundation/distributeddatamgr/data_object/interfaces/innerkits:*" ]
cflags = [ "-DHILOG_ENABLE" ]
@@ -60,13 +60,13 @@ ohos_shared_library("distributeddataobject_impl") {
"//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb",
"//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp:devicemanagersdk",
"//third_party/bounds_checking_function:libsec_shared",
- "//third_party/libuv:uv",
+ #"//third_party/libuv:uv",
]
external_deps = [
"c_utils:utils",
"dsoftbus:softbus_client",
- "hitrace_native:hitrace_meter",
- "hitrace_native:libhitracechain",
+ #"hitrace_native:hitrace_meter",
+ #"hitrace_native:libhitracechain",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"kv_store:distributeddata_inner",
--
2.33.0

81
bundle.json Normal file
View File

@ -0,0 +1,81 @@
{
"name": "@ohos/distributeddatamgr_data_object",
"version": "",
"description": "The distributed data object management framework is an object-oriented in-memory data management framework",
"homePage": "https://gitee.com/openharmony",
"license": "Apache V2",
"repository": "https://gitee.com/openharmony/distributeddatamgr_data_object ",
"domain": "os",
"language": "",
"publishAs": "code-segment",
"private": false,
"scripts": {},
"tags": [
"foundation"
],
"envs": [],
"dirs": [],
"author": {
"name": "",
"email": "",
"url": ""
},
"contributors": [
{
"name": "",
"email": "",
"url": ""
}
],
"segment": {
"destPath": "foundation/distributeddatamgr/data_object"
},
"component": {
"name": "data_object",
"subsystem": "distributeddatamgr",
"syscap": [
"SystemCapability.DistributedDataManager.DataObject.DistributedObject"
],
"features": [],
"adapted_system_type": [
"standard"
],
"rom": "",
"ram": "",
"deps": {
"components": [
"ability_base",
"hitrace_native",
"dsoftbus",
"distributeddatamgr",
"napi",
"common",
"samgr",
"ipc",
"hiviewdfx_hilog_native",
"libuv",
"utils_base",
"access_token"
],
"third_party": []
},
"build": {
"sub_component": [
],
"inner_kits": [
{
"name": "//foundation/distributeddatamgr/data_object/interfaces/innerkits:distributeddataobject_impl",
"header": {
"header_files": [
"distributed_object.h",
"distributed_objectstore.h",
"objectstore_errors.h"
],
"header_base": "//foundation/distributeddatamgr/data_object/interfaces/innerkits"
}
}
]
}
}
}

View File

@ -0,0 +1,101 @@
%define debug_package %{nil}
%global oh_version OpenHarmony-v3.2-Release
%global distributeddatamgr_dir %{_builddir}/foundation/distributeddatamgr/
%global build_opt /opt/distributed-middleware-build
%global bundle_dir %{build_opt}/openeuler/compiler_gn/foundation/distributeddatamgr/data_object
Name: distributeddatamgr_data_object
Version: 1.0.0
Release: 2
Summary: Distributed Data Object Management Framework
License: Apache-2.0
Url: https://gitee.com/openharmony/distributeddatamgr_data_object
Source0: https://gitee.com/openharmony/distributeddatamgr_data_object/repository/archive/OpenHarmony-v3.2-Release.tar.gz#/distributeddatamgr_data_object-OpenHarmony-v3.2-Release.tar.gz
Source1: distributeddataobject_impl.BUILD.gn
Source2: bundle.json
Patch0: 0001-Trim-the-dependencies-on-hitrace-libuv.patch
BuildRequires: libatomic libicu-devel libxml2-devel openssl-devel
BuildRequires: distributed-build distributed-build_lite hilog distributed-utils
BuildRequires: distributeddatamgr_kv_store
Requires: hilog distributed-utils distributeddatamgr_kv_store distributeddatamgr_datamgr_service
%description
The object-oriented memory data management framework provides application
developers with basic data object management capabilities such as creating,
querying, deleting, modifying, and subscribing to memory objects. It also
has distributed capabilities to meet the collaborative needs of data objects
between multiple devices in the same application in the super terminal scenario.
Developers can easily use distributed object interfaces for object synchronization within trusted devices.
%prep
rm -rf %{_builddir}/*
cd %{_builddir}
cp -rp %{build_opt} %{_builddir}/build
[ ! -L "%{_builddir}/build.sh" ] && ln -s %{_builddir}/build/build_scripts/build.sh %{_builddir}/build.sh
[ ! -L "%{_builddir}/.gn" ] && ln -s %{_builddir}/build/core/gn/dotfile.gn %{_builddir}/.gn
[ ! -L "%{_builddir}/build.py" ] && ln -s %{_builddir}/build/lite/build.py %{_builddir}/build.py
mv build/openeuler/vendor %{_builddir}/
%setup -q -T -a 0 -c -n %{distributeddatamgr_dir}
mv %{distributeddatamgr_dir}%{name}-%{oh_version} %{distributeddatamgr_dir}data_object
%patch0 -p1 -d %{distributeddatamgr_dir}data_object
cp -rf %{_builddir}/build/openeuler/compiler_gn/* %{_builddir}/
%build
cd %{_builddir}
rm -rf %{_builddir}/out
%ifarch x86_64
./build.sh --product-name openeuler --target-cpu x86_64
%endif
%ifarch aarch64
./build.sh --product-name openeuler --target-cpu arm64
%endif
%install
install -d -m 0755 %{buildroot}%{_includedir}/data_object
install -d -m 0755 %{buildroot}%{_libdir}
install -d -m 0755 %{buildroot}%{bundle_dir}/interfaces/innerkits
install -d -m 0755 %{buildroot}/system/lib64
cp -f %{SOURCE1} %{buildroot}/%{bundle_dir}/interfaces/innerkits/BUILD.gn
cp -f %{SOURCE2} %{buildroot}/%{bundle_dir}/
%ifarch aarch64
module_out_path="out/openeuler/linux_clang_arm64/distributeddatamgr/data_object"
header_out_path="out/openeuler/innerkits/linux-arm64/data_object"
%endif
%ifarch x86_64
module_out_path="out/openeuler/linux_clang_x86_64/distributeddatamgr/data_object"
header_out_path="out/openeuler/innerkits/linux-x86_64/data_object"
%endif
install -m 0755 %{_builddir}/${module_out_path}/*.so %{buildroot}%{_libdir}
install -m 0755 %{_builddir}/${module_out_path}/*.so %{buildroot}/system/lib64
find %{_builddir}/${header_out_path} -name *.h -print0 | xargs -0 -i cp -rf {} %{buildroot}%{_includedir}/data_object/
pushd %{_builddir}/foundation/distributeddatamgr/data_object
for include_file in `find . \( -name test -o -name jskitsimpl \) -prune -o -name "*.h" -type f`
do
if [[ ${include_file} != *.h ]]; then
continue
fi
cp --parents ${include_file} %{buildroot}%{bundle_dir}
done
popd
%files
%{_libdir}/*.so
%{_includedir}/data_object/*
%{bundle_dir}/*
/system/*
%changelog
* Thu Aug 03 2023 Peng He <hepeng68@huawei.com> - 1.0.0-2
- Add requires and rectify the contents of the RPM package.
* Wed Jun 07 2023 Ge Wang <wang__ge@126.com> - 1.0.0-1
- init package

View File

@ -0,0 +1,27 @@
# Copyright (c) 2022 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")
config("objectstore_public_config") {
visibility = [ ":*" ]
include_dirs = [ "." ]
libs = [ "distributeddataobject_impl.z" ]
}
group("distributeddataobject_impl") {
public_configs = [ ":objectstore_public_config" ]
part_name = "data_object"
subsystem_name = "distributeddatamgr"
}