From be159f943ed83c607940958c654bde1c5fa82bec Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 29 Nov 2024 12:20:12 +0800 Subject: [PATCH] Fix publishing har packages for HarmonyOS (#1576) --- .github/workflows/har.yaml | 33 +++++++++++++++++++ harmony-os/SherpaOnnxHar/README.md | 19 +++++++++++ .../sherpa_onnx/BuildProfile.ets | 6 ++-- .../SherpaOnnxHar/sherpa_onnx/README.md | 30 +++++++++++++++++ .../sherpa_onnx/oh-package.json5 | 7 ++-- new-release.sh | 5 +++ 6 files changed, 95 insertions(+), 5 deletions(-) diff --git a/.github/workflows/har.yaml b/.github/workflows/har.yaml index afe99a1be..7b5b2e514 100644 --- a/.github/workflows/har.yaml +++ b/.github/workflows/har.yaml @@ -92,6 +92,12 @@ jobs: x86_64-unknown-linux-ohos-clang++ --version x86_64-unknown-linux-ohos-clang --version + - name: Install tree + shell: bash + run: | + sudo apt-get update -q + sudo apt-get install -y -q tree + - name: Build libraries shell: bash run: | @@ -113,6 +119,9 @@ jobs: pushd harmony-os/SherpaOnnxHar + cp -fv ../../LICENSE ./sherpa_onnx + cp -fv ../../CHANGELOG.md ./sherpa_onnx + hvigorw --mode module -p product=default -p module=sherpa_onnx@default assembleHar --analyze=normal --parallel --incremental --no-daemon ls -lh ./sherpa_onnx/build/default/outputs/default/sherpa_onnx.har cp -v ./sherpa_onnx/build/default/outputs/default/sherpa_onnx.har ../../ @@ -121,6 +130,30 @@ jobs: ls -lh *.har + - name: View Har + shell: bash + run: | + file sherpa_onnx.har + tar xvf sherpa_onnx.har + + cd package + ls -lh + + ls -lh libs + echo "---libs/x86_64---" + ls -lh libs/x86_64 + + echo "---libs/arm64-v8a---" + ls -lh libs/arm64-v8a + + echo "---src/main/ets/components---" + ls -lh src/main/ets/components/ + + echo "---src/main/cpp/types/libsherpa_onnx/---" + ls -lh src/main/cpp/types/libsherpa_onnx/ + + tree . + - name: Collect result shell: bash run: | diff --git a/harmony-os/SherpaOnnxHar/README.md b/harmony-os/SherpaOnnxHar/README.md index 936315564..e775cedee 100644 --- a/harmony-os/SherpaOnnxHar/README.md +++ b/harmony-os/SherpaOnnxHar/README.md @@ -16,3 +16,22 @@ hvigorw --mode module -p product=default -p module=sherpa_onnx@default assembleH ls -lh ./sherpa_onnx/build/default/outputs/default/sherpa_onnx.har ``` + +Pre-built `har` packages can be found at + + +You can also download it using +``` +wget https://ohpm.openharmony.cn/ohpm/sherpa_onnx/-/sherpa_onnx-1.10.32.har + +# Please replace the version 1.10.32 if needed. +``` + +You can also use +``` +ohpm install sherpa_onnx +``` +to install it. + +See also + diff --git a/harmony-os/SherpaOnnxHar/sherpa_onnx/BuildProfile.ets b/harmony-os/SherpaOnnxHar/sherpa_onnx/BuildProfile.ets index 3a501e5dd..502c150fd 100644 --- a/harmony-os/SherpaOnnxHar/sherpa_onnx/BuildProfile.ets +++ b/harmony-os/SherpaOnnxHar/sherpa_onnx/BuildProfile.ets @@ -1,9 +1,9 @@ /** * Use these variables when you tailor your ArkTS code. They must be of the const type. */ -export const HAR_VERSION = '1.0.0'; -export const BUILD_MODE_NAME = 'debug'; -export const DEBUG = true; +export const HAR_VERSION = '1.10.32'; +export const BUILD_MODE_NAME = 'release'; +export const DEBUG = false; export const TARGET_NAME = 'default'; /** diff --git a/harmony-os/SherpaOnnxHar/sherpa_onnx/README.md b/harmony-os/SherpaOnnxHar/sherpa_onnx/README.md index 2690bf624..8f8243981 100644 --- a/harmony-os/SherpaOnnxHar/sherpa_onnx/README.md +++ b/harmony-os/SherpaOnnxHar/sherpa_onnx/README.md @@ -10,3 +10,33 @@ It also supports embedded systems, Android, iOS, HarmonyOS, Raspberry Pi, RISC-V, x86_64 servers, websocket server/client, C/C++, Python, Kotlin, C#, Go, NodeJS, Java, Swift, Dart, JavaScript, Flutter, Object Pascal, Lazarus, Rust, etc. + + +# Installation + +To use `sherpa-onnx` in your project, please either use + +``` +ohpm install sherpa_onnx +``` +or update your `oh-package.json5` to include the following: + +``` + "dependencies": { + "sherpa_onnx": "1.10.32", + }, +``` + +Note that we recommend always using the latest version. + +# Examples + +| Demo | URL | Description| +|------|-----|------------| +|SherpaOnnxVadAsr|[Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/harmony-os/SherpaOnnxVadAsr)|It shows how to use VAD with a non-streaming ASR model for speech recognition| + +# Documentation + +If you have any issues, please either look at our doc at + or create an issue at + diff --git a/harmony-os/SherpaOnnxHar/sherpa_onnx/oh-package.json5 b/harmony-os/SherpaOnnxHar/sherpa_onnx/oh-package.json5 index cc2260a23..4d622d6e4 100644 --- a/harmony-os/SherpaOnnxHar/sherpa_onnx/oh-package.json5 +++ b/harmony-os/SherpaOnnxHar/sherpa_onnx/oh-package.json5 @@ -1,16 +1,19 @@ { "name": "sherpa_onnx", - "version": "1.0.0", + "version": "1.10.32", "description": "Speech-to-text, text-to-speech, and speaker diarization using Next-gen Kaldi without internet connection", "main": "Index.ets", "author": "The next-gen Kaldi team", "license": "Apache-2.0", "homepage": "https://github.com/k2-fsa/sherpa-onnx", - "repository": "https://github.com/k2-fsa/sherpa-onnx/tree/master/harmonyos-SherpaOnnxHar", + "repository": "https://github.com/k2-fsa/sherpa-onnx/tree/master/harmony-os/SherpaOnnxHar", "dependencies": { "libsherpa_onnx.so": "file:./src/main/cpp/types/libsherpa_onnx" }, "keywords": [ + "语音识别", + "语音合成", + "新一代Kaldi", "tts", "asr", "locally", diff --git a/new-release.sh b/new-release.sh index eaf868971..2fc30371f 100755 --- a/new-release.sh +++ b/new-release.sh @@ -1,8 +1,13 @@ #!/usr/bin/env bash +set -ex + sed -i.bak 's/1\.10\.31/1\.10\.32/g' ./build-ios-shared.sh find flutter -name *.yaml -type f -exec sed -i.bak 's/1\.10\.31/1\.10\.32/g' {} \; find dart-api-examples -name *.yaml -type f -exec sed -i.bak 's/1\.10\.31/1\.10\.32/g' {} \; find flutter-examples -name *.yaml -type f -exec sed -i.bak 's/1\.10\.31/1\.10\.32/g' {} \; find flutter -name *.podspec -type f -exec sed -i.bak 's/1\.10\.31/1\.10\.32/g' {} \; find nodejs-addon-examples -name package.json -type f -exec sed -i.bak 's/1\.10\.31/1\.10\.32/g' {} \; + +find harmony-os -name "README.md" -type f -exec sed -i.bak 's/1\.10\.31/1\.10\.32/g' {} \; +find harmony-os -name oh-package.json5 -type f -exec sed -i.bak 's/1\.10\.31/1\.10\.32/g' {} \;