Skip to content
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

Migrate: Java APIを使うように #37

Merged
merged 9 commits into from
Oct 28, 2023
Merged
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
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
Comment on lines -44 to -45
Copy link
Member Author

@sevenc-nanashi sevenc-nanashi Oct 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jsonファイルが大きくなりすぎて(51MB近く)大変なことになってたので分割。

# 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'
}
}
Comment on lines -7 to -12
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++に勝利しました。やったぜ


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"
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
}

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
Loading