Skip to content

Commit

Permalink
Migrate: Java APIを使うように (#37)
Browse files Browse the repository at this point in the history
* WIP: Java APIを使う用に

* Fix: クラッシュを修正

* Fix: ESLintを有効化

* Change: CAPACITOR_ADDRESS環境変数でいじるように

* Fix: CIを修正

* Fix: コメントを修正

* Change: デフォルトで検出するように

* Fix: metas.jsonを使う用に

* Change: metasをマージするように
  • Loading branch information
sevenc-nanashi authored Oct 28, 2023
1 parent bcb89fb commit 8d2dc8f
Show file tree
Hide file tree
Showing 26 changed files with 346 additions and 957 deletions.
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ VITE_DEFAULT_ENGINE_INFOS=`[
}
]`
VITE_GTM_CONTAINER_ID=GTM-DUMMY
CAPACITOR_ADDRESS=
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ VITE_DEFAULT_ENGINE_INFOS=`[
}
]`
VITE_GTM_CONTAINER_ID=GTM-DUMMY
CAPACITOR_ADDRESS=
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ electron-builder.yml
# generated licenses.json
/*licenses.json

# generated speakerInfo.json
public/speakerInfos.json
# generated speakerInfo
public/speakerInfos
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ npm ci
## 実行

以下のコマンドで Vite の開発サーバーを起動し、Capacitor をライブリロードモードでセットアップします。
PC のプライベート IP アドレスは自動で取得されますが、手動で設定する場合は`.env` 内で `CAPACITOR_ADDRESS` を指定してください。

```bash
npm run cap:serve
Expand Down Expand Up @@ -169,6 +170,7 @@ npm run test-watch:unit # 監視モード
### ブラウザ End to End テスト

Electron の機能が不要な、UI や音声合成などの End to End テストを実行します。

> **Note**
> 一部のエンジンの設定を書き換えるテストは、CI(Github Actions)上でのみ実行されるようになっています。
Expand Down
45 changes: 32 additions & 13 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ android {

ndkVersion '25.2.9519653'
namespace 'jp.hiroshiba.voicevox'
externalNativeBuild {
cmake {
path file('src/main/cpp/CMakeLists.txt')
version '3.22.1'
}
}

compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
Expand All @@ -24,12 +18,6 @@ android {
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_shared'
}
}
ndk.abiFilters 'arm64-v8a', 'x86_64'

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand All @@ -53,6 +41,25 @@ repositories {
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}
def urlZipFile = { name, path, url ->
File zipFile = new File("$buildDir/download/${name}.zip")
zipFile.parentFile.mkdirs()
if (!zipFile.exists()) {
new URL(url).withInputStream { downloadStream ->
zipFile.withOutputStream { fileOut ->
fileOut << downloadStream
}
}
}
def tree = zipTree(zipFile)
def fileName = path.split("/")[-1]
def outFile = file("$buildDir/download/${fileName}")
tree.visit { file ->
if (file.getPath() != path) return
file.copyTo(outFile)
}
files(outFile)
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
Expand All @@ -66,7 +73,19 @@ dependencies {
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation project(':capacitor-cordova-android-plugins')

implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime-android', version: '1.14.0'
// TODO: ちゃんと公開されたらそれに置き換える
implementation urlZipFile("voicevoxcore-android", "jp/hiroshiba/voicevoxcore/voicevoxcore-android/0.15.0-preview.13/voicevoxcore-android-0.15.0-preview.13.aar", "https://github.com/VOICEVOX/voicevox_core/releases/download/0.15.0-preview.13/java_packages.zip")

// https://mvnrepository.com/artifact/com.google.code.gson/gson
implementation group: 'com.google.code.gson', name: 'gson', version: "2.10.1"

// https://mvnrepository.com/artifact/jakarta.validation/jakarta.validation-api
implementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: "3.0.2"

// https://mvnrepository.com/artifact/jakarta.annotation/jakarta.annotation-api
implementation group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: "2.1.1"

implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime-android', version: "1.14.0"
}

apply from: 'capacitor.build.gradle'
Expand Down
56 changes: 0 additions & 56 deletions android/app/src/main/cpp/CMakeLists.txt

This file was deleted.

181 changes: 0 additions & 181 deletions android/app/src/main/cpp/voicevox_core_wrapper/core_caller.cpp

This file was deleted.

Loading

0 comments on commit 8d2dc8f

Please sign in to comment.