Skip to content

Commit

Permalink
Fix publishing har packages for HarmonyOS (#1576)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Nov 29, 2024
1 parent f3f8961 commit be159f9
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 5 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/har.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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 ../../
Expand All @@ -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: |
Expand Down
19 changes: 19 additions & 0 deletions harmony-os/SherpaOnnxHar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<https://huggingface.co/csukuangfj/sherpa-onnx-harmony-os/tree/main/har>

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
<https://ohpm.openharmony.cn/#/cn/detail/sherpa_onnx>
6 changes: 3 additions & 3 deletions harmony-os/SherpaOnnxHar/sherpa_onnx/BuildProfile.ets
Original file line number Diff line number Diff line change
@@ -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';

/**
Expand Down
30 changes: 30 additions & 0 deletions harmony-os/SherpaOnnxHar/sherpa_onnx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<https://k2-fsa.github.io/sherpa/onnx/> or create an issue at
<https://github.com/k2-fsa/sherpa-onnx/issues>
7 changes: 5 additions & 2 deletions harmony-os/SherpaOnnxHar/sherpa_onnx/oh-package.json5
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 5 additions & 0 deletions new-release.sh
Original file line number Diff line number Diff line change
@@ -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' {} \;

0 comments on commit be159f9

Please sign in to comment.