Skip to content

Proposal for OpenHarmony Adaptation of protobuf #2061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions OpenHarmony/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
hvigor/hvigor-wrapper.js
entry/src/main/ets/pages/user.js
src/main/ets/pages/user.d.ts
18 changes: 18 additions & 0 deletions OpenHarmony/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
*.iml
.gradle
/local.properties
/.idea
.DS_Store
/build
/captures
.externalNativeBuild
/entry/.preview
.cxx
/node_modules
/.preview
**/build
.hvigor
**/package-lock.json
/oh_modules
/entry/oh_modules
/oh-package-lock.json5
10 changes: 10 additions & 0 deletions OpenHarmony/AppScope/app.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"app": {
"bundleName": "cn.openharmony.protobuf",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
}
8 changes: 8 additions & 0 deletions OpenHarmony/AppScope/resources/base/element/string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"string": [
{
"name": "app_name",
"value": "protobuf"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions OpenHarmony/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
### 3.0.0
- Support BigInt type

### 2.1.0
- 发布2.1.0正式版

### 2.1.0-rc.0
- 重构protobufjs运行时,修复了taskpool下重复序列化反序列化数据丢失的问题

### 2.0.1
- 更新README:修改了依赖的引入名称,更新了bigint在protobuf中的使用方式

### 2.0.0
- 适配DevEco Studio 版本:4.1 Canary(4.1.3.317),OpenHarmony SDK:API11 (4.1.0.36)
- ArkTS新语法适配
- protobufjs 7.2.4 版本适配
- 取消以load方式加载proto文件或者字符串

### 1.2.1
1.适配DevEco Studio 3.1 Beta1版本

### 1.2.0
1.适配api9

### 1.1.1
1.新增rpc和websocket使用样例

### 1.1.0
1.样例适配的系统版本是OpenHarmony API Version 8,且将原来工程转为hvigor工程。

### 1.0.0

1.样例适配的系统版本是OpenHarmony API Version 5~7。

2.使用三方库protobufjs版本支持@5.0.3

3.支持序列化和反序列化的样例

4.支持buffer读写的样例

39 changes: 39 additions & 0 deletions OpenHarmony/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
This license applies to all parts of protobuf.js except those files
either explicitly including or referencing a different license or
located in a directory containing a different LICENSE file.

---

Copyright (c) 2016, Daniel Wirtz All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of its author, nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

---

Code generated by the command line utilities is owned by the owner
of the input file used when generating it. This code is not
standalone and requires a support library to be linked with it. This
support library is itself covered by the above license.
45 changes: 45 additions & 0 deletions OpenHarmony/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
OPEN SOURCE SOFTWARE NOTICE

Please note we provide an open source software notice for the third party open source software along with this software and/or this software component (in the following just “this SOFTWARE”). The open source software licenses are granted by the respective right holders.

Warranty Disclaimer
THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.

Copyright Notice and License Texts

----------------------------------------------------------------------
Software: protobufjs 7.2.4

Copyright (c) 2016, Daniel Wirtz All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of its author, nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

---

Code generated by the command line utilities is owned by the owner
of the input file used when generating it. This code is not
standalone and requires a support library to be linked with it. This
support library is itself covered by the above license.
125 changes: 125 additions & 0 deletions OpenHarmony/OAT.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2021 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.

This is the configuration file template for OpenHarmony OSS Audit Tool, please copy it to your project root dir and modify it refer to OpenHarmony/tools_oat/README.

-->
<configuration>
<oatconfig>
<filefilterlist>
<filefilter
desc="Filters for compatibility,license header policies"
name="copyrightPolicyFilter">
<filteritem
desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"
name="hvigorfile.ts"
type="filename"/>
<filteritem
desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"
name="hvigor-wrapper.js"
type="filename"/>
<filteritem
desc="资源文件,不需要添加版权头"
name="*.proto"
type="filename"/>
<filteritem
desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"
name="hvigorw"
type="filename"/>
<filteritem
desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"
name="hvigorw.bat"
type="filepath"/>
<filteritem
desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加版权头"
name="*.json5"
type="filename"/>
<filteritem
desc="版权免责声明文件,无需修改"
name="NOTICE"
type="filename"/>

<filteritem
desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"
name="library/src/main/ets/.*"
type="filepath"/>

<filteritem
desc="版权免责声明文件,无需修改"
name="LICENSE"
type="filename"/>
</filefilter>
<filefilter
desc="Filters for compatibility,license header policies"
name="defaultPolicyFilter">
<filteritem
desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"
name="hvigorfile.ts"
type="filename"/>
<filteritem
desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"
name="hvigor-wrapper.js"
type="filename"/>
<filteritem
desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"
name="hvigorw"
type="filename"/>
<filteritem
desc="资源文件,不需要添加版权头"
name="*.proto"
type="filename"/>

<filteritem
desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"
name="hvigorw.bat"
type="filename"/>
<filteritem
desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加许可证头"
name="*.json5"
type="filename"/>
<filteritem
desc="第三方开源软件源码,不修改版权头,以防有修改版权风险"
name="library/src/main/ets/.*"
type="filepath"/>
<filteritem
desc="版权免责声明文件,无需修改"
name="NOTICE"
type="filename"/>

<filteritem
desc="版权免责声明文件,无需修改"
name="LICENSE"
type="filename"/>
</filefilter>

<filefilter
desc="Filters for resources files policies"
name="binaryFileTypePolicyFilter">
<filteritem
desc="hvigor配置文件,DevEco Studio自动生成,不手动修改"
name="*.json5"
type="filename"/>
<filteritem
desc="直接使用的资源文件"
name="*.png"
type="filename"/>
<filteritem
desc="资源文件,不需要添加版权头"
name="*.proto"
type="filename"/>
</filefilter>
</filefilterlist>
</oatconfig>
</configuration>
11 changes: 11 additions & 0 deletions OpenHarmony/README.OpenSource
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"Name": "protobuf",
"License": "BSD 3-Clause License",
"License File": " LICENSE ",
"Version Number": "7.2.4",
"Owner" : "[email protected]",
"Upstream URL": "https://github.com/protobufjs/protobuf.js",
"Description": "protoubuf.js is a pure JavaScript implementation with TypeScript for node.js and the browser.Its easy to use,blazingly fast and works out of the box with .proto files "
}
]
Loading