diff --git a/thirdparty/diff-match-patch-cpp-stl/HPKBUILD b/thirdparty/diff-match-patch-cpp-stl/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..cadbabda2d9650020f979d8c14ff8c20cf2fa996 --- /dev/null +++ b/thirdparty/diff-match-patch-cpp-stl/HPKBUILD @@ -0,0 +1,51 @@ +# Contributor: tvBrave +# Maintainer: tvBrave +pkgname=diff-match-patch-cpp-stl +pkgver=master +pkgrel=0 +pkgdesc="" +url="https://github.com/leutloff/diff-match-patch-cpp-stl" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache License 2.0") +depends=() +makedepends=() + +source="https://github.com/leutloff/$pkgname/archive/refs/heads/$pkgver.zip" + +autounpack=true +downloadpackage=true +buildtools="cmake" + +builddir=$pkgname-${pkgver} +packagename=$builddir.zip + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir/ + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > `pwd`/$ARCH-build/build.log 2>&1 + make -j4 -C $ARCH-build >> `pwd`/$ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir/ + make -C $ARCH-build install >> `pwd`/$ARCH-build/build.log 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # 在OpenHarmony开发板中执行用例 + # ./diff_match_patch_test_string + # ./diff_match_patch_test_wstring +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/thirdparty/diff-match-patch-cpp-stl/README.OpenSource b/thirdparty/diff-match-patch-cpp-stl/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..e6d55d50e122047f553462d57b9acf20e9f9566f --- /dev/null +++ b/thirdparty/diff-match-patch-cpp-stl/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "diff-match-patch-cpp-stl", + "License": "Apache License 2.0", + "License File": "https://github.com/leutloff/diff-match-patch-cpp-stl/blob/master/LICENSE", + "Version Number": "master", + "Owner": "tianyong13@huawei.com", + "Upstream URL": "https://github.com/leutloff/diff-match-patch-cpp-stl/archive/refs/heads/master.zip", + "Description": "C++ STL variant of https://code.google.com/p/google-diff-match-patch." + } +] diff --git a/thirdparty/diff-match-patch-cpp-stl/README_zh.md b/thirdparty/diff-match-patch-cpp-stl/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..acfad19e261f922e839dcb07bd28ffbaa282abed --- /dev/null +++ b/thirdparty/diff-match-patch-cpp-stl/README_zh.md @@ -0,0 +1,12 @@ +# diff-match-patch-cpp-stl三方库说明 +## 功能简介 +C++ STL variant of https://code.google.com/p/google-diff-match-patch. +## 使用约束 +- IDE版本:DevEco Studio 3.1 Beta2 +- SDK版本:ohos_sdk_public 3.2.11.9 (API Version 9 Release) +- 三方库版本:master +- 当前适配的功能:支持文本对比等功能。 +- [Apache License 2.0](https://github.com/leutloff/diff-match-patch-cpp-stl/blob/master/LICENSE) + +## 集成方式 ++ [编译说明](docs/hap_integrate.md) diff --git a/thirdparty/diff-match-patch-cpp-stl/SHA512SUM b/thirdparty/diff-match-patch-cpp-stl/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..0d0d942f9d41891971cc4179eac1bb26b49e9391 --- /dev/null +++ b/thirdparty/diff-match-patch-cpp-stl/SHA512SUM @@ -0,0 +1 @@ +52e1d8bc4a31c3b3e01d41c9c8683946c6fb58fbd375bfe4b0f0e501d7d98957f8e35d4de52e0e9d3b69096b39dd0678fdaf54c11f8031759b774e817acb9c42 diff-match-patch-cpp-stl-master.zip diff --git a/thirdparty/diff-match-patch-cpp-stl/docs/hap_integrate.md b/thirdparty/diff-match-patch-cpp-stl/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..3d3368e2c77c3d42986460adbfa8ce57f16879d0 --- /dev/null +++ b/thirdparty/diff-match-patch-cpp-stl/docs/hap_integrate.md @@ -0,0 +1,54 @@ +# diff-match-patch-cpp-stl编译说明 +本库是在RK3568开发板上基于OpenHarmony3.2 Release版本的镜像验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 +## 开发环境 +- ubuntu20.04 +- [OpenHarmony3.2Release镜像](https://gitee.com/link?target=https%3A%2F%2Frepo.huaweicloud.com%2Fopenharmony%2Fos%2F3.2-Release%2Fdayu200_standard_arm32.tar.gz) +- [ohos_sdk_public 3.2.11.9 (API Version 9 Release)](https://gitee.com/link?target=https%3A%2F%2Frepo.huaweicloud.com%2Fopenharmony%2Fos%2F3.2-Release%2Fohos-sdk-windows_linux-public.tar.gz) +- [DevEco Studio 3.1 Beta2](https://gitee.com/link?target=https%3A%2F%2Fcontentcenter-vali-drcn.dbankcdn.cn%2Fpvt_2%2FDeveloperAlliance_package_901_9%2Ff3%2Fv3%2FuJyuq3syQ2ak4hE1QZmAug%2Fdevecostudio-windows-3.1.0.400.zip%3FHW-CC-KV%3DV1%26HW-CC-Date%3D20230408T013335Z%26HW-CC-Expire%3D315360000%26HW-CC-Sign%3D96262721EDC9B34E6F62E66884AB7AE2A94C2A7B8C28D6F7FC891F46EB211A70) +- [准备三方库构建环境](../../../tools/README.md#编译环境准备) +- [准备三方库测试环境](../../../tools/README.md#ci环境准备) +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/diff-match-patch-cpp-stl #三方库diff-match-patch-cpp-stl的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 将diff-match-patch-cpp-stl拷贝至tools/main目录下 + ``` + cd tpc_c_cplusplus + cp thirdparty/diff-match-patch-cpp-stl tools/main -rf + ``` +- 在tools目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../tools/README.md#编译环境准备) + ``` + cd tools + ./build.sh diff-match-patch-cpp-stl + ``` + +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../tools/README.md#ci环境准备) + +进入到构建目录下目录执行可执行文件(diff_match_patch_test_string、 diff_match_patch_test_wstring),运行测试用例(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) + +diff_match_patch_test_string执行结果如下 + + ![diff_match_patch_test_string](pic/diff_match_patch_test_string_RESULT.png) + +diff_match_patch_test_wstring执行结果如下 + + ![diff_match_patch_test_wstring](pic/diff_match_patch_test_wstring_RESULT.png) + +## 参考资料 +- [润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld) +- [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +- [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +- [通过DevEco Studio开发一个NAPI工程](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/napi_study/docs/hello_napi.md) diff --git a/thirdparty/diff-match-patch-cpp-stl/docs/pic/diff_match_patch_test_string_RESULT.png b/thirdparty/diff-match-patch-cpp-stl/docs/pic/diff_match_patch_test_string_RESULT.png new file mode 100644 index 0000000000000000000000000000000000000000..3f6095976bb57c5d2d5b335fad21c6f86413b71b Binary files /dev/null and b/thirdparty/diff-match-patch-cpp-stl/docs/pic/diff_match_patch_test_string_RESULT.png differ diff --git a/thirdparty/diff-match-patch-cpp-stl/docs/pic/diff_match_patch_test_wstring_RESULT.png b/thirdparty/diff-match-patch-cpp-stl/docs/pic/diff_match_patch_test_wstring_RESULT.png new file mode 100644 index 0000000000000000000000000000000000000000..0a3f0c0102f717777533ba754b1daf7403453261 Binary files /dev/null and b/thirdparty/diff-match-patch-cpp-stl/docs/pic/diff_match_patch_test_wstring_RESULT.png differ