From 2979fb9869d6bea1e240c1ced6cf8b234f1765aa Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Thu, 14 Sep 2023 18:24:43 +0900 Subject: [PATCH 01/36] =?UTF-8?q?Change:=20build-android.gradle=E3=81=AB?= =?UTF-8?q?=E5=88=86=E9=9B=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/build-android.gradle | 64 +++++++++++++++++++ .../voicevox_core_java_api/lib/build.gradle | 13 +++- .../hiroshiba/voicevoxcore/Synthesizer.java | 4 -- .../jp/hiroshiba/voicevoxcore/UserDict.java | 3 +- .../settings-android.gradle | 15 +++++ 5 files changed, 91 insertions(+), 8 deletions(-) create mode 100644 crates/voicevox_core_java_api/lib/build-android.gradle create mode 100644 crates/voicevox_core_java_api/settings-android.gradle diff --git a/crates/voicevox_core_java_api/lib/build-android.gradle b/crates/voicevox_core_java_api/lib/build-android.gradle new file mode 100644 index 000000000..eba4be466 --- /dev/null +++ b/crates/voicevox_core_java_api/lib/build-android.gradle @@ -0,0 +1,64 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * This generated file contains a sample Java library project to get you started. + * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.2.1/userguide/building_java_projects.html in the Gradle documentation. + */ + +plugins { + // Apply the java-library plugin for API and implementation separation. + id 'com.android.library' version '8.1.1' +} + +version = '0.0.0' + +repositories { + // Use Maven Central for resolving dependencies. + mavenCentral() +} + +dependencies { + // Use JUnit Jupiter for testing. + testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2' + + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + + // This dependency is exported to consumers, that is to say found on their compile classpath. + api 'org.apache.commons:commons-math3:3.6.1' + + // This dependency is used internally, and not exposed to consumers on their own compile classpath. + implementation 'com.google.guava:guava:31.1-jre' + + // 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' + + implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime-android', version: '1.14.0' +} + +// Apply a specific Java toolchain to ease working on different environments. +java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } +} + +android { + compileSdkVersion 31 + namespace "jp.hiroshiba.voicevoxcore" + + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + kotlinOptions { + jvmTarget = "1.11" + } + sourceSets { + main { + jniLibs.srcDirs = ["./src/main/resources/jniLibs"] + } + } +} diff --git a/crates/voicevox_core_java_api/lib/build.gradle b/crates/voicevox_core_java_api/lib/build.gradle index 3e87cceff..cbede7e1b 100644 --- a/crates/voicevox_core_java_api/lib/build.gradle +++ b/crates/voicevox_core_java_api/lib/build.gradle @@ -11,7 +11,12 @@ plugins { id "com.diffplug.spotless" version "6.20.0" } -version = '0.0.0' +def String cargoToml = file('../../../Cargo.toml').text +def String version = cargoToml =~ /version = "([0-9.]+)"/ + +def boolean isGpu = System.getenv('IS_GPU') == 'true' + +version = version[0][1] repositories { // Use Maven Central for resolving dependencies. @@ -36,7 +41,11 @@ dependencies { // https://mvnrepository.com/artifact/jakarta.validation/jakarta.validation-api implementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: '3.0.2' - implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime', version: '1.14.0' + if (isGpu) { + implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime-gpu', version: '1.14.0' + } else { + implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime', version: '1.14.0' + } } // Apply a specific Java toolchain to ease working on different environments. diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java index 5047048b8..98bf9f403 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java @@ -55,7 +55,6 @@ public boolean isLoadedVoiceModel(String voiceModelId) { * @param text テキスト。 * @param styleId スタイルID。 * @return {@link CreateAudioQueryConfigurator}。 - * * @see CreateAudioQueryConfigurator#execute */ @Nonnull @@ -69,7 +68,6 @@ public CreateAudioQueryConfigurator createAudioQuery(String text, int styleId) { * @param text テキスト。 * @param styleId スタイルID。 * @return {@link CreateAccentPhrasesConfigurator}。 - * * @see CreateAccentPhrasesConfigurator#execute */ @Nonnull @@ -137,7 +135,6 @@ public List replaceMoraPitch(List accentPhrases, int * @param audioQuery {@link AudioQuery}。 * @param styleId スタイルID。 * @return {@link SynthesisConfigurator}。 - * * @see SynthesisConfigurator#execute */ @Nonnull @@ -151,7 +148,6 @@ public SynthesisConfigurator synthesis(AudioQuery audioQuery, int styleId) { * @param text テキスト。 * @param styleId スタイルID。 * @return {@link TtsConfigurator}。 - * * @see TtsConfigurator#execute */ @Nonnull diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java index e31d56338..d75924feb 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java @@ -6,7 +6,6 @@ import com.google.gson.internal.LinkedTreeMap; import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Min; - import java.lang.ref.Cleaner; import java.util.HashMap; import javax.annotation.Nonnull; @@ -177,7 +176,7 @@ public static class Word { /** * UserDict.Wordを作成する。 * - * @param surface 言葉の表層形。 + * @param surface 言葉の表層形。 * @param pronunciation 言葉の発音。 * @throws IllegalArgumentException pronunciationが不正な場合。 */ diff --git a/crates/voicevox_core_java_api/settings-android.gradle b/crates/voicevox_core_java_api/settings-android.gradle new file mode 100644 index 000000000..85515af95 --- /dev/null +++ b/crates/voicevox_core_java_api/settings-android.gradle @@ -0,0 +1,15 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} +plugins { + // Apply the foojay-resolver plugin to allow automatic download of JDKs + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' +} + +rootProject.name = 'jp.hiroshiba.voicevoxcore' +include('lib') +project(':lib').buildFileName = 'build-android.gradle' From 92555bd2f14b6d8946e3f7c296c7c7adfc705f8a Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Thu, 14 Sep 2023 23:55:44 +0900 Subject: [PATCH 02/36] =?UTF-8?q?Fix:=20Android=E7=89=88=E3=81=AE=E6=A7=8B?= =?UTF-8?q?=E6=88=90=E3=82=92=E8=89=B2=E3=80=85=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/voicevox_core_java_api/README.md | 7 ++- .../lib/build-android.gradle | 48 +++++++++++-------- .../voicevox_core_java_api/lib/build.gradle | 13 ++--- .../jp/hiroshiba/voicevoxcore/OpenJtalk.java | 12 ++--- .../hiroshiba/voicevoxcore/Synthesizer.java | 22 +++++---- .../jp/hiroshiba/voicevoxcore/UserDict.java | 9 ++-- .../jp/hiroshiba/voicevoxcore/VoiceModel.java | 7 +-- .../lib/src/main/resources/jniLibs/README.md | 5 ++ .../main/resources/jniLibs/arm64-x8a/.gitkeep | 0 .../main/resources/jniLibs/x86_64/.gitkeep | 0 .../settings-android.gradle | 15 ------ crates/voicevox_core_java_api/settings.gradle | 22 +++++++++ 12 files changed, 91 insertions(+), 69 deletions(-) create mode 100644 crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/README.md delete mode 100644 crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/arm64-x8a/.gitkeep delete mode 100644 crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/x86_64/.gitkeep delete mode 100644 crates/voicevox_core_java_api/settings-android.gradle diff --git a/crates/voicevox_core_java_api/README.md b/crates/voicevox_core_java_api/README.md index d1bc31938..65b7d9668 100644 --- a/crates/voicevox_core_java_api/README.md +++ b/crates/voicevox_core_java_api/README.md @@ -44,14 +44,16 @@ Java プロジェクトを動かすには、 - `lib/src/main/resources/dll/[target]/libvoicevox_core_java_api.so` を作成する(`libvoicevox_core_java_api.so`はプラットフォームによって異なります、詳細は後述)。 必要があります。 +また、ハードウェアアクセラレーションをテストするには`IS_GPU`環境変数を`true`にする必要があります。 ```console ❯ cargo build -❯ LD_LIBRARY_PATH=$(realpath ../../target/debug) ./gradlew build +❯ LD_LIBRARY_PATH=$(realpath ../../target/debug) ./gradlew test # または ❯ cp ../../target/debug/libvoicevox_core_java_api.so lib/src/main/resources/dll/[target]/libvoicevox_core_java_api.so -❯ ./gradlew build +❯ ./gradlew test +❯ IS_GPU=true ./gradlew test ``` ## ビルド(リリース) @@ -63,6 +65,7 @@ Java プロジェクトを動かすには、 ❯ cargo build --release ❯ cp ../../target/release/libvoicevox_core_java_api.so lib/src/main/resources/dll/[target]/libvoicevox_core_java_api.so ❯ ./gradlew build +❯ IS_GPU=true ./gradlew build ``` ## テスト diff --git a/crates/voicevox_core_java_api/lib/build-android.gradle b/crates/voicevox_core_java_api/lib/build-android.gradle index eba4be466..48c6c6508 100644 --- a/crates/voicevox_core_java_api/lib/build-android.gradle +++ b/crates/voicevox_core_java_api/lib/build-android.gradle @@ -6,14 +6,21 @@ */ plugins { - // Apply the java-library plugin for API and implementation separation. id 'com.android.library' version '8.1.1' + id 'org.jetbrains.kotlin.android' version '1.9.10' } -version = '0.0.0' +def String cargoToml = file('../../../Cargo.toml').text +def String cargoTomlVersion = (cargoToml =~ /version = "([0-9.]+)"/)[0][1] + +def String target = System.getenv('TARGET')?.toLowerCase() ?: "cpu" +def boolean isGpu = target.contains('cuda') || target.contains('directml') + +version = cargoTomlVersion + repositories { - // Use Maven Central for resolving dependencies. + google() mavenCentral() } @@ -23,9 +30,6 @@ dependencies { testRuntimeOnly 'org.junit.platform:junit-platform-launcher' - // This dependency is exported to consumers, that is to say found on their compile classpath. - api 'org.apache.commons:commons-math3:3.6.1' - // This dependency is used internally, and not exposed to consumers on their own compile classpath. implementation 'com.google.guava:guava:31.1-jre' @@ -41,24 +45,26 @@ dependencies { // Apply a specific Java toolchain to ease working on different environments. java { toolchain { - languageVersion = JavaLanguageVersion.of(11) + languageVersion = JavaLanguageVersion.of(8) } } android { - compileSdkVersion 31 - namespace "jp.hiroshiba.voicevoxcore" - - compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 - } - kotlinOptions { - jvmTarget = "1.11" - } - sourceSets { - main { - jniLibs.srcDirs = ["./src/main/resources/jniLibs"] + compileSdkVersion 26 + + defaultConfig { + minSdkVersion 26 + targetSdkVersion 26 + } + namespace "jp.hiroshiba.voicevoxcore" + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + sourceSets { + main { + jniLibs.srcDirs = ["./src/main/resources/jniLibs"] + } } - } } diff --git a/crates/voicevox_core_java_api/lib/build.gradle b/crates/voicevox_core_java_api/lib/build.gradle index cbede7e1b..bf2207201 100644 --- a/crates/voicevox_core_java_api/lib/build.gradle +++ b/crates/voicevox_core_java_api/lib/build.gradle @@ -12,11 +12,12 @@ plugins { } def String cargoToml = file('../../../Cargo.toml').text -def String version = cargoToml =~ /version = "([0-9.]+)"/ +def String cargoTomlVersion = (cargoToml =~ /version = "([0-9.]+)"/)[0][1] -def boolean isGpu = System.getenv('IS_GPU') == 'true' +def String target = System.getenv('TARGET')?.toLowerCase() ?: "cpu" +def boolean isGpu = target.contains('cuda') || target.contains('directml') -version = version[0][1] +version = cargoTomlVersion repositories { // Use Maven Central for resolving dependencies. @@ -29,9 +30,6 @@ dependencies { testRuntimeOnly 'org.junit.platform:junit-platform-launcher' - // This dependency is exported to consumers, that is to say found on their compile classpath. - api 'org.apache.commons:commons-math3:3.6.1' - // This dependency is used internally, and not exposed to consumers on their own compile classpath. implementation 'com.google.guava:guava:31.1-jre' @@ -51,10 +49,9 @@ dependencies { // Apply a specific Java toolchain to ease working on different environments. java { toolchain { - languageVersion = JavaLanguageVersion.of(11) + languageVersion = JavaLanguageVersion.of(8) } } - tasks.named('test') { // Use JUnit Platform for unit tests. useJUnitPlatform() diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/OpenJtalk.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/OpenJtalk.java index 3228b8d51..50390bdb0 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/OpenJtalk.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/OpenJtalk.java @@ -1,11 +1,7 @@ package jp.hiroshiba.voicevoxcore; -import java.lang.ref.Cleaner; - -/** テキスト解析器としてのOpen JTalk。 */ public class OpenJtalk extends Dll { private long handle; - private static final Cleaner cleaner = Cleaner.create(); /** * Open JTalkの辞書ディレクトリ。 @@ -14,14 +10,18 @@ public class OpenJtalk extends Dll { */ public OpenJtalk(String openJtalkDictDir) { rsNewWithInitialize(openJtalkDictDir); + } - cleaner.register(this, () -> rsDrop()); + protected void finalize() throws Throwable { + rsDrop(); + super.finalize(); } /** * ユーザー辞書を設定する。 * - *

この関数を呼び出した後にユーザー辞書を変更した場合は、再度この関数を呼ぶ必要がある。 + *

+ * この関数を呼び出した後にユーザー辞書を変更した場合は、再度この関数を呼ぶ必要がある。 * * @param userDict ユーザー辞書。 */ diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java index 98bf9f403..5d5f1516e 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java @@ -1,7 +1,6 @@ package jp.hiroshiba.voicevoxcore; import com.google.gson.Gson; -import java.lang.ref.Cleaner; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -14,11 +13,14 @@ */ public class Synthesizer extends Dll { private long handle; - private static final Cleaner cleaner = Cleaner.create(); private Synthesizer(OpenJtalk openJtalk, Builder builder) { rsNewWithInitialize(openJtalk, builder); - cleaner.register(this, () -> rsDrop()); + } + + protected void finalize() throws Throwable { + rsDrop(); + super.finalize(); } /** @@ -52,7 +54,7 @@ public boolean isLoadedVoiceModel(String voiceModelId) { /** * {@link AudioQuery} を生成するためのオブジェクトを生成する。 * - * @param text テキスト。 + * @param text テキスト。 * @param styleId スタイルID。 * @return {@link CreateAudioQueryConfigurator}。 * @see CreateAudioQueryConfigurator#execute @@ -65,7 +67,7 @@ public CreateAudioQueryConfigurator createAudioQuery(String text, int styleId) { /** * {@link AccentPhrase} のリストを生成するためのオブジェクトを生成する。 * - * @param text テキスト。 + * @param text テキスト。 * @param styleId スタイルID。 * @return {@link CreateAccentPhrasesConfigurator}。 * @see CreateAccentPhrasesConfigurator#execute @@ -79,7 +81,7 @@ public CreateAccentPhrasesConfigurator createAccentPhrases(String text, int styl * アクセント句の音高・音素長を変更する。 * * @param accentPhrases 変更元のアクセント句の配列。 - * @param styleId スタイルID。 + * @param styleId スタイルID。 * @return 変更後のアクセント句の配列。 */ @Nonnull @@ -97,7 +99,7 @@ public List replaceMoraData(List accentPhrases, int * アクセント句の音素長を変更する。 * * @param accentPhrases 変更元のアクセント句の配列。 - * @param styleId スタイルID。 + * @param styleId スタイルID。 * @return 変更後のアクセント句の配列。 */ @Nonnull @@ -115,7 +117,7 @@ public List replacePhonemeLength(List accentPhrases, * アクセント句の音高を変更する。 * * @param accentPhrases 変更元のアクセント句の配列。 - * @param styleId スタイルID。 + * @param styleId スタイルID。 * @return 変更後のアクセント句の配列。 */ @Nonnull @@ -133,7 +135,7 @@ public List replaceMoraPitch(List accentPhrases, int * {@link AudioQuery} から音声合成するためのオブジェクトを生成する。 * * @param audioQuery {@link AudioQuery}。 - * @param styleId スタイルID。 + * @param styleId スタイルID。 * @return {@link SynthesisConfigurator}。 * @see SynthesisConfigurator#execute */ @@ -145,7 +147,7 @@ public SynthesisConfigurator synthesis(AudioQuery audioQuery, int styleId) { /** * テキスト音声合成を実行するためのオブジェクトを生成する。 * - * @param text テキスト。 + * @param text テキスト。 * @param styleId スタイルID。 * @return {@link TtsConfigurator}。 * @see TtsConfigurator#execute diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java index d75924feb..b91f82874 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java @@ -6,20 +6,21 @@ import com.google.gson.internal.LinkedTreeMap; import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Min; -import java.lang.ref.Cleaner; import java.util.HashMap; import javax.annotation.Nonnull; /** ユーザー辞書。 */ public class UserDict extends Dll { private long handle; - private static final Cleaner cleaner = Cleaner.create(); /** ユーザー辞書を作成する。 */ public UserDict() { rsNew(); + } - cleaner.register(this, () -> rsDrop()); + protected void finalize() throws Throwable { + rsDrop(); + super.finalize(); } /** @@ -176,7 +177,7 @@ public static class Word { /** * UserDict.Wordを作成する。 * - * @param surface 言葉の表層形。 + * @param surface 言葉の表層形。 * @param pronunciation 言葉の発音。 * @throws IllegalArgumentException pronunciationが不正な場合。 */ diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java index 6b157fdba..bd515d896 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java @@ -3,13 +3,11 @@ import com.google.gson.Gson; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; -import java.lang.ref.Cleaner; import javax.annotation.Nonnull; /** 音声モデル。 */ public class VoiceModel extends Dll { private long handle; - private static final Cleaner cleaner = Cleaner.create(); /** ID。 */ @Nonnull public final String id; @@ -27,8 +25,11 @@ public VoiceModel(String modelPath) { throw new RuntimeException("Failed to parse metasJson"); } metas = rawMetas; + } - cleaner.register(this, () -> rsDrop()); + protected void finalize() throws Throwable { + rsDrop(); + super.finalize(); } private native void rsFromPath(String modelPath); diff --git a/crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/README.md b/crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/README.md new file mode 100644 index 000000000..9073988ec --- /dev/null +++ b/crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/README.md @@ -0,0 +1,5 @@ +このディレクトリに Android での JNI 用に読み込まれる DLL を配置します。 +ディレクトリ名は以下のうちのいずれかになります。 + +- `arm64-v8a` +- `x86_64` diff --git a/crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/arm64-x8a/.gitkeep b/crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/arm64-x8a/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/x86_64/.gitkeep b/crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/x86_64/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/crates/voicevox_core_java_api/settings-android.gradle b/crates/voicevox_core_java_api/settings-android.gradle deleted file mode 100644 index 85515af95..000000000 --- a/crates/voicevox_core_java_api/settings-android.gradle +++ /dev/null @@ -1,15 +0,0 @@ -pluginManagement { - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} -plugins { - // Apply the foojay-resolver plugin to allow automatic download of JDKs - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' -} - -rootProject.name = 'jp.hiroshiba.voicevoxcore' -include('lib') -project(':lib').buildFileName = 'build-android.gradle' diff --git a/crates/voicevox_core_java_api/settings.gradle b/crates/voicevox_core_java_api/settings.gradle index 7d07347eb..f8a4d46e8 100644 --- a/crates/voicevox_core_java_api/settings.gradle +++ b/crates/voicevox_core_java_api/settings.gradle @@ -1,7 +1,29 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } + + resolutionStrategy { + eachPlugin { + if(requested.id.namespace == "com.android") { + useModule("com.android.tools.build:gradle:${requested.version}") + } + } + } +} plugins { // Apply the foojay-resolver plugin to allow automatic download of JDKs id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' } rootProject.name = 'jp.hiroshiba.voicevoxcore' +def String target = System.getenv('TARGET')?.toLowerCase() ?: "cpu" +def boolean isAndroid = target == 'android' include('lib') +if (isAndroid) { + project(':lib').buildFileName = 'build-android.gradle' +} else { + project(':lib').buildFileName = 'build.gradle' +} From fb0041873d2bc37b27b63283510a7d4fd03e4adf Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Fri, 15 Sep 2023 00:33:06 +0900 Subject: [PATCH 03/36] =?UTF-8?q?Fix:=20=E4=BE=9D=E5=AD=98=E9=96=A2?= =?UTF-8?q?=E4=BF=82=E5=91=A8=E3=82=8A=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/voicevox_core_java_api/README.md | 7 ++++--- crates/voicevox_core_java_api/lib/build.gradle | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/voicevox_core_java_api/README.md b/crates/voicevox_core_java_api/README.md index 65b7d9668..a331c8450 100644 --- a/crates/voicevox_core_java_api/README.md +++ b/crates/voicevox_core_java_api/README.md @@ -44,7 +44,7 @@ Java プロジェクトを動かすには、 - `lib/src/main/resources/dll/[target]/libvoicevox_core_java_api.so` を作成する(`libvoicevox_core_java_api.so`はプラットフォームによって異なります、詳細は後述)。 必要があります。 -また、ハードウェアアクセラレーションをテストするには`IS_GPU`環境変数を`true`にする必要があります。 +また、ハードウェアアクセラレーションを有効にする時は`TARGET`環境変数を`cuda`または`directml`にし、Android 版をビルドする時は`TARGET`環境変数を`android`にしてください。 ```console ❯ cargo build @@ -53,19 +53,20 @@ Java プロジェクトを動かすには、 # または ❯ cp ../../target/debug/libvoicevox_core_java_api.so lib/src/main/resources/dll/[target]/libvoicevox_core_java_api.so ❯ ./gradlew test -❯ IS_GPU=true ./gradlew test +❯ TARGET=cuda ./gradlew test ``` ## ビルド(リリース) `cargo build --release` で Rust 側を、`./gradlew build` で Java 側をビルドできます。 パッケージ化する時は lib/src/main/resources/dll 内に dll をコピーしてください。 +`TARGET`環境変数は開発時と同様に設定してください。 ```console ❯ cargo build --release ❯ cp ../../target/release/libvoicevox_core_java_api.so lib/src/main/resources/dll/[target]/libvoicevox_core_java_api.so ❯ ./gradlew build -❯ IS_GPU=true ./gradlew build +❯ TARGET=cuda ./gradlew build ``` ## テスト diff --git a/crates/voicevox_core_java_api/lib/build.gradle b/crates/voicevox_core_java_api/lib/build.gradle index bf2207201..a26f2c96c 100644 --- a/crates/voicevox_core_java_api/lib/build.gradle +++ b/crates/voicevox_core_java_api/lib/build.gradle @@ -40,7 +40,7 @@ dependencies { implementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: '3.0.2' if (isGpu) { - implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime-gpu', version: '1.14.0' + implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime_gpu', version: '1.14.0' } else { implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime', version: '1.14.0' } From 3bd192c12e568bb4c071cf1f6964434fc1deb58b Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Fri, 15 Sep 2023 00:33:33 +0900 Subject: [PATCH 04/36] Code: gradlew spotlessApply --- .../java/jp/hiroshiba/voicevoxcore/OpenJtalk.java | 3 +-- .../jp/hiroshiba/voicevoxcore/Synthesizer.java | 14 +++++++------- .../java/jp/hiroshiba/voicevoxcore/UserDict.java | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/OpenJtalk.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/OpenJtalk.java index 50390bdb0..c9ad2f963 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/OpenJtalk.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/OpenJtalk.java @@ -20,8 +20,7 @@ protected void finalize() throws Throwable { /** * ユーザー辞書を設定する。 * - *

- * この関数を呼び出した後にユーザー辞書を変更した場合は、再度この関数を呼ぶ必要がある。 + *

この関数を呼び出した後にユーザー辞書を変更した場合は、再度この関数を呼ぶ必要がある。 * * @param userDict ユーザー辞書。 */ diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java index 5d5f1516e..2562b3a19 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java @@ -54,7 +54,7 @@ public boolean isLoadedVoiceModel(String voiceModelId) { /** * {@link AudioQuery} を生成するためのオブジェクトを生成する。 * - * @param text テキスト。 + * @param text テキスト。 * @param styleId スタイルID。 * @return {@link CreateAudioQueryConfigurator}。 * @see CreateAudioQueryConfigurator#execute @@ -67,7 +67,7 @@ public CreateAudioQueryConfigurator createAudioQuery(String text, int styleId) { /** * {@link AccentPhrase} のリストを生成するためのオブジェクトを生成する。 * - * @param text テキスト。 + * @param text テキスト。 * @param styleId スタイルID。 * @return {@link CreateAccentPhrasesConfigurator}。 * @see CreateAccentPhrasesConfigurator#execute @@ -81,7 +81,7 @@ public CreateAccentPhrasesConfigurator createAccentPhrases(String text, int styl * アクセント句の音高・音素長を変更する。 * * @param accentPhrases 変更元のアクセント句の配列。 - * @param styleId スタイルID。 + * @param styleId スタイルID。 * @return 変更後のアクセント句の配列。 */ @Nonnull @@ -99,7 +99,7 @@ public List replaceMoraData(List accentPhrases, int * アクセント句の音素長を変更する。 * * @param accentPhrases 変更元のアクセント句の配列。 - * @param styleId スタイルID。 + * @param styleId スタイルID。 * @return 変更後のアクセント句の配列。 */ @Nonnull @@ -117,7 +117,7 @@ public List replacePhonemeLength(List accentPhrases, * アクセント句の音高を変更する。 * * @param accentPhrases 変更元のアクセント句の配列。 - * @param styleId スタイルID。 + * @param styleId スタイルID。 * @return 変更後のアクセント句の配列。 */ @Nonnull @@ -135,7 +135,7 @@ public List replaceMoraPitch(List accentPhrases, int * {@link AudioQuery} から音声合成するためのオブジェクトを生成する。 * * @param audioQuery {@link AudioQuery}。 - * @param styleId スタイルID。 + * @param styleId スタイルID。 * @return {@link SynthesisConfigurator}。 * @see SynthesisConfigurator#execute */ @@ -147,7 +147,7 @@ public SynthesisConfigurator synthesis(AudioQuery audioQuery, int styleId) { /** * テキスト音声合成を実行するためのオブジェクトを生成する。 * - * @param text テキスト。 + * @param text テキスト。 * @param styleId スタイルID。 * @return {@link TtsConfigurator}。 * @see TtsConfigurator#execute diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java index b91f82874..d9ed67ba5 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java @@ -177,7 +177,7 @@ public static class Word { /** * UserDict.Wordを作成する。 * - * @param surface 言葉の表層形。 + * @param surface 言葉の表層形。 * @param pronunciation 言葉の発音。 * @throws IllegalArgumentException pronunciationが不正な場合。 */ From 4186e79b3acdc9e1d1cce20b10479213f6ce1617 Mon Sep 17 00:00:00 2001 From: Nanashi Date: Fri, 15 Sep 2023 01:31:08 +0900 Subject: [PATCH 05/36] =?UTF-8?q?Delete:=20=E5=98=98=E3=82=B3=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/voicevox_core_java_api/lib/build-android.gradle | 7 ------- 1 file changed, 7 deletions(-) diff --git a/crates/voicevox_core_java_api/lib/build-android.gradle b/crates/voicevox_core_java_api/lib/build-android.gradle index 48c6c6508..9cb05b54b 100644 --- a/crates/voicevox_core_java_api/lib/build-android.gradle +++ b/crates/voicevox_core_java_api/lib/build-android.gradle @@ -1,10 +1,3 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * This generated file contains a sample Java library project to get you started. - * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.2.1/userguide/building_java_projects.html in the Gradle documentation. - */ - plugins { id 'com.android.library' version '8.1.1' id 'org.jetbrains.kotlin.android' version '1.9.10' From 55fc8ec96d6db6b7028c279d01b75cd6a92669f1 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Fri, 15 Sep 2023 23:45:45 +0900 Subject: [PATCH 06/36] =?UTF-8?q?Change:=20=E7=92=B0=E5=A2=83=E5=A4=89?= =?UTF-8?q?=E6=95=B0=E3=82=92OS=E3=81=A8DEVICE=E3=81=AB=E5=88=86=E9=9B=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/voicevox_core_java_api/README.md | 10 ++++++---- .../voicevox_core_java_api/lib/build-android.gradle | 12 ++++-------- crates/voicevox_core_java_api/lib/build.gradle | 12 ++++++------ .../java/jp/hiroshiba/voicevoxcore/AccentPhrase.java | 4 ++-- .../java/jp/hiroshiba/voicevoxcore/AudioQuery.java | 4 ++-- .../main/java/jp/hiroshiba/voicevoxcore/Mora.java | 4 ++-- .../java/jp/hiroshiba/voicevoxcore/Synthesizer.java | 2 +- .../java/jp/hiroshiba/voicevoxcore/UserDict.java | 2 +- .../java/jp/hiroshiba/voicevoxcore/VoiceModel.java | 2 +- crates/voicevox_core_java_api/settings.gradle | 4 ++-- 10 files changed, 27 insertions(+), 29 deletions(-) diff --git a/crates/voicevox_core_java_api/README.md b/crates/voicevox_core_java_api/README.md index a331c8450..ab5ef5064 100644 --- a/crates/voicevox_core_java_api/README.md +++ b/crates/voicevox_core_java_api/README.md @@ -44,7 +44,7 @@ Java プロジェクトを動かすには、 - `lib/src/main/resources/dll/[target]/libvoicevox_core_java_api.so` を作成する(`libvoicevox_core_java_api.so`はプラットフォームによって異なります、詳細は後述)。 必要があります。 -また、ハードウェアアクセラレーションを有効にする時は`TARGET`環境変数を`cuda`または`directml`にし、Android 版をビルドする時は`TARGET`環境変数を`android`にしてください。 +また、ハードウェアアクセラレーションを有効にする時は`DEVICE`環境変数を`cuda`または`directml`にし、Android 版をビルドする時は`OS`環境変数を`android`にしてください。 ```console ❯ cargo build @@ -53,20 +53,22 @@ Java プロジェクトを動かすには、 # または ❯ cp ../../target/debug/libvoicevox_core_java_api.so lib/src/main/resources/dll/[target]/libvoicevox_core_java_api.so ❯ ./gradlew test -❯ TARGET=cuda ./gradlew test +❯ DEVICE=cuda ./gradlew test +❯ OS=android ./gradlew test ``` ## ビルド(リリース) `cargo build --release` で Rust 側を、`./gradlew build` で Java 側をビルドできます。 パッケージ化する時は lib/src/main/resources/dll 内に dll をコピーしてください。 -`TARGET`環境変数は開発時と同様に設定してください。 +`DEVICE`、`OS`環境変数は開発時と同様です。 ```console ❯ cargo build --release ❯ cp ../../target/release/libvoicevox_core_java_api.so lib/src/main/resources/dll/[target]/libvoicevox_core_java_api.so ❯ ./gradlew build -❯ TARGET=cuda ./gradlew build +❯ DEVICE=cuda ./gradlew build +❯ OS=android ./gradlew build ``` ## テスト diff --git a/crates/voicevox_core_java_api/lib/build-android.gradle b/crates/voicevox_core_java_api/lib/build-android.gradle index 48c6c6508..599cbaa9c 100644 --- a/crates/voicevox_core_java_api/lib/build-android.gradle +++ b/crates/voicevox_core_java_api/lib/build-android.gradle @@ -11,14 +11,10 @@ plugins { } def String cargoToml = file('../../../Cargo.toml').text -def String cargoTomlVersion = (cargoToml =~ /version = "([0-9.]+)"/)[0][1] - -def String target = System.getenv('TARGET')?.toLowerCase() ?: "cpu" -def boolean isGpu = target.contains('cuda') || target.contains('directml') +def String cargoTomlVersion = (cargoToml =~ /(?m)^version = "(\S+)"$/)[0][1] version = cargoTomlVersion - repositories { google() mavenCentral() @@ -30,15 +26,15 @@ dependencies { testRuntimeOnly 'org.junit.platform:junit-platform-launcher' - // This dependency is used internally, and not exposed to consumers on their own compile classpath. - implementation 'com.google.guava:guava:31.1-jre' - // 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' } diff --git a/crates/voicevox_core_java_api/lib/build.gradle b/crates/voicevox_core_java_api/lib/build.gradle index a26f2c96c..58b1f2015 100644 --- a/crates/voicevox_core_java_api/lib/build.gradle +++ b/crates/voicevox_core_java_api/lib/build.gradle @@ -12,10 +12,10 @@ plugins { } def String cargoToml = file('../../../Cargo.toml').text -def String cargoTomlVersion = (cargoToml =~ /version = "([0-9.]+)"/)[0][1] +def String cargoTomlVersion = (cargoToml =~ /(?m)^version = "(\S+)"$/)[0][1] -def String target = System.getenv('TARGET')?.toLowerCase() ?: "cpu" -def boolean isGpu = target.contains('cuda') || target.contains('directml') +def String device = System.getenv('DEVICE')?.toLowerCase() ?: "cpu" +def boolean isGpu = ['cuda', 'directml'].contains(device) version = cargoTomlVersion @@ -30,15 +30,15 @@ dependencies { testRuntimeOnly 'org.junit.platform:junit-platform-launcher' - // This dependency is used internally, and not exposed to consumers on their own compile classpath. - implementation 'com.google.guava:guava:31.1-jre' - // 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' + if (isGpu) { implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime_gpu', version: '1.14.0' } else { diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/AccentPhrase.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/AccentPhrase.java index 8c64c9d11..61e8b5d28 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/AccentPhrase.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/AccentPhrase.java @@ -2,10 +2,10 @@ import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; /** AccentPhrase (アクセント句ごとの情報)。 */ public class AccentPhrase { diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/AudioQuery.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/AudioQuery.java index 4a23be3f7..c03accf2f 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/AudioQuery.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/AudioQuery.java @@ -2,10 +2,10 @@ import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; /** AudioQuery(音声合成用のクエリ)。 */ public class AudioQuery { diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Mora.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Mora.java index 61dbaf233..f03874323 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Mora.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Mora.java @@ -2,8 +2,8 @@ import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; /** モーラ(子音+母音)ごとの情報。 */ public class Mora { diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java index 2562b3a19..5739b14f7 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/Synthesizer.java @@ -1,10 +1,10 @@ package jp.hiroshiba.voicevoxcore; import com.google.gson.Gson; +import jakarta.annotation.Nonnull; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; /** * 音声シンセサイザ。 diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java index d9ed67ba5..b0b8921a2 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDict.java @@ -4,10 +4,10 @@ import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.google.gson.internal.LinkedTreeMap; +import jakarta.annotation.Nonnull; import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Min; import java.util.HashMap; -import javax.annotation.Nonnull; /** ユーザー辞書。 */ public class UserDict extends Dll { diff --git a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java index bd515d896..90e74f6d9 100644 --- a/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java +++ b/crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/VoiceModel.java @@ -3,7 +3,7 @@ import com.google.gson.Gson; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; /** 音声モデル。 */ public class VoiceModel extends Dll { diff --git a/crates/voicevox_core_java_api/settings.gradle b/crates/voicevox_core_java_api/settings.gradle index f8a4d46e8..7dbabe4a7 100644 --- a/crates/voicevox_core_java_api/settings.gradle +++ b/crates/voicevox_core_java_api/settings.gradle @@ -19,8 +19,8 @@ plugins { } rootProject.name = 'jp.hiroshiba.voicevoxcore' -def String target = System.getenv('TARGET')?.toLowerCase() ?: "cpu" -def boolean isAndroid = target == 'android' +def String targetOs = System.getenv('OS')?.toLowerCase() ?: "desktop" +def boolean isAndroid = targetOs == 'android' include('lib') if (isAndroid) { project(':lib').buildFileName = 'build-android.gradle' From 5db3d3db6290aa8542ffec792b0c04b220354f14 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sat, 16 Sep 2023 06:40:51 +0900 Subject: [PATCH 07/36] =?UTF-8?q?Change:=20=E3=83=90=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E5=91=A8=E3=82=8A=E3=82=92=E5=85=B1=E9=80=9A?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/build-android.gradle | 13 +++++-------- crates/voicevox_core_java_api/lib/build.gradle | 15 ++------------- crates/voicevox_core_java_api/settings.gradle | 12 ++++++++++++ 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/crates/voicevox_core_java_api/lib/build-android.gradle b/crates/voicevox_core_java_api/lib/build-android.gradle index 32b117241..f369c663c 100644 --- a/crates/voicevox_core_java_api/lib/build-android.gradle +++ b/crates/voicevox_core_java_api/lib/build-android.gradle @@ -3,10 +3,7 @@ plugins { id 'org.jetbrains.kotlin.android' version '1.9.10' } -def String cargoToml = file('../../../Cargo.toml').text -def String cargoTomlVersion = (cargoToml =~ /(?m)^version = "(\S+)"$/)[0][1] - -version = cargoTomlVersion +version = gradle.ext.version repositories { google() @@ -20,15 +17,15 @@ dependencies { testRuntimeOnly 'org.junit.platform:junit-platform-launcher' // https://mvnrepository.com/artifact/com.google.code.gson/gson - implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1' + implementation group: 'com.google.code.gson', name: 'gson', version: gradle.ext.gsonVersion // https://mvnrepository.com/artifact/jakarta.validation/jakarta.validation-api - implementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: '3.0.2' + implementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: gradle.ext.jakartaValidationVersion // https://mvnrepository.com/artifact/jakarta.annotation/jakarta.annotation-api - implementation group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '2.1.1' + implementation group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: gradle.ext.jakartaAnnotationVersion - implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime-android', version: '1.14.0' + implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime-android', version: gradle.ext.onnxruntimeVersion } // Apply a specific Java toolchain to ease working on different environments. diff --git a/crates/voicevox_core_java_api/lib/build.gradle b/crates/voicevox_core_java_api/lib/build.gradle index 58b1f2015..e17404a76 100644 --- a/crates/voicevox_core_java_api/lib/build.gradle +++ b/crates/voicevox_core_java_api/lib/build.gradle @@ -17,8 +17,6 @@ def String cargoTomlVersion = (cargoToml =~ /(?m)^version = "(\S+)"$/)[0][1] def String device = System.getenv('DEVICE')?.toLowerCase() ?: "cpu" def boolean isGpu = ['cuda', 'directml'].contains(device) -version = cargoTomlVersion - repositories { // Use Maven Central for resolving dependencies. mavenCentral() @@ -30,19 +28,10 @@ dependencies { testRuntimeOnly 'org.junit.platform:junit-platform-launcher' - // 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' - if (isGpu) { - implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime_gpu', version: '1.14.0' + implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime_gpu', version: gradle.ext.onnxruntimeVersion } else { - implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime', version: '1.14.0' + implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime', version: gradle.ext.onnxruntimeVersion } } diff --git a/crates/voicevox_core_java_api/settings.gradle b/crates/voicevox_core_java_api/settings.gradle index 7dbabe4a7..d3f20d855 100644 --- a/crates/voicevox_core_java_api/settings.gradle +++ b/crates/voicevox_core_java_api/settings.gradle @@ -27,3 +27,15 @@ if (isAndroid) { } else { project(':lib').buildFileName = 'build.gradle' } + +def String cargoToml = file('../../Cargo.toml').text +def String cargoTomlVersion = (cargoToml =~ /(?m)^version = "(\S+)"$/)[0][1] + +gradle.ext { + version = cargoTomlVersion + + gsonVersion = '2.10.1' + jakartaValidationVersion = '3.0.2' + jakartaAnnotationVersion = '2.1.1' + onnxruntimeVersion = '1.14.0' +} From a50ecbdd70a1b3fcb03217f3d13b11e6aba9706f Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sat, 16 Sep 2023 13:36:15 +0900 Subject: [PATCH 08/36] =?UTF-8?q?Fix:=20=E4=BE=9D=E5=AD=98=E9=96=A2?= =?UTF-8?q?=E4=BF=82=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/voicevox_core_java_api/lib/build.gradle | 15 +++++++++++---- crates/voicevox_core_java_api/settings.gradle | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/crates/voicevox_core_java_api/lib/build.gradle b/crates/voicevox_core_java_api/lib/build.gradle index e17404a76..bc2ebe8f8 100644 --- a/crates/voicevox_core_java_api/lib/build.gradle +++ b/crates/voicevox_core_java_api/lib/build.gradle @@ -11,11 +11,9 @@ plugins { id "com.diffplug.spotless" version "6.20.0" } -def String cargoToml = file('../../../Cargo.toml').text -def String cargoTomlVersion = (cargoToml =~ /(?m)^version = "(\S+)"$/)[0][1] +def boolean isGpu = ['cuda', 'directml'].contains(gradle.ext.device) -def String device = System.getenv('DEVICE')?.toLowerCase() ?: "cpu" -def boolean isGpu = ['cuda', 'directml'].contains(device) +version = gradle.ext.version repositories { // Use Maven Central for resolving dependencies. @@ -28,6 +26,15 @@ dependencies { testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + // https://mvnrepository.com/artifact/com.google.code.gson/gson + implementation group: 'com.google.code.gson', name: 'gson', version: gradle.ext.gsonVersion + + // https://mvnrepository.com/artifact/jakarta.validation/jakarta.validation-api + implementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: gradle.ext.jakartaValidationVersion + + // https://mvnrepository.com/artifact/jakarta.annotation/jakarta.annotation-api + implementation group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: gradle.ext.jakartaAnnotationVersion + if (isGpu) { implementation group: 'com.microsoft.onnxruntime', name: 'onnxruntime_gpu', version: gradle.ext.onnxruntimeVersion } else { diff --git a/crates/voicevox_core_java_api/settings.gradle b/crates/voicevox_core_java_api/settings.gradle index d3f20d855..20a5e2c6a 100644 --- a/crates/voicevox_core_java_api/settings.gradle +++ b/crates/voicevox_core_java_api/settings.gradle @@ -34,6 +34,9 @@ def String cargoTomlVersion = (cargoToml =~ /(?m)^version = "(\S+)"$/)[0][1] gradle.ext { version = cargoTomlVersion + targetOs = targetOs + targetDevice = System.getenv('DEVICE') ?: 'cpu' + gsonVersion = '2.10.1' jakartaValidationVersion = '3.0.2' jakartaAnnotationVersion = '2.1.1' From f092e366b375b6a92be9a90f3da03bc124026475 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sat, 16 Sep 2023 13:49:10 +0900 Subject: [PATCH 09/36] =?UTF-8?q?Fix:=20=E5=A4=89=E6=95=B0=E5=90=8D?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/voicevox_core_java_api/lib/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/voicevox_core_java_api/lib/build.gradle b/crates/voicevox_core_java_api/lib/build.gradle index bc2ebe8f8..f1eb5b106 100644 --- a/crates/voicevox_core_java_api/lib/build.gradle +++ b/crates/voicevox_core_java_api/lib/build.gradle @@ -11,7 +11,7 @@ plugins { id "com.diffplug.spotless" version "6.20.0" } -def boolean isGpu = ['cuda', 'directml'].contains(gradle.ext.device) +def boolean isGpu = ['cuda', 'directml'].contains(gradle.ext.targetDevice) version = gradle.ext.version From d3864d3335d64ff7910beeaed83706f5357105df Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 17 Sep 2023 19:17:26 +0900 Subject: [PATCH 10/36] =?UTF-8?q?Add:=20Java=E3=81=AE=E3=83=93=E3=83=AB?= =?UTF-8?q?=E3=83=89=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 144 +++++++++++++++++- .../lib/build-android.gradle | 14 ++ .../voicevox_core_java_api/lib/build.gradle | 14 ++ 3 files changed, 171 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index cdc2d1c7a..6e4bf51d3 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -256,6 +256,15 @@ jobs: run: | cargo set-version "$VERSION" --exclude voicevox_core_python_api --exclude download --exclude xtask if ${{ !!matrix.whl_local_version }}; then cargo set-version "$VERSION+"${{ matrix.whl_local_version }} -p voicevox_core_python_api; fi + - name: cache target + uses: actions/cache@v3 + with: + path: | + ~/.cargo + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- - name: build voicevox_core_c_api shell: bash run: | @@ -286,6 +295,17 @@ jobs: echo "whl=$(find ./target/wheels -type f)" >> "$GITHUB_OUTPUT" env: ORT_USE_CUDA: ${{ matrix.use_cuda }} + - name: build voicevox_core_java_api + if: "!endsWith(matrix.target, 'ios')" + run: | + function build() { + cargo build -p voicevox_core_java_api -vv --features ${{ matrix.features }}, --target ${{ matrix.target }} --release + } + if ${{ github.event.inputs.is_production != 'true' }}; then + build + else + build > /dev/null 2>&1 + fi - name: Set ASSET_NAME env var run: echo "ASSET_NAME=voicevox_core-${{ matrix.artifact_name }}-${{ env.VERSION }}" >> "$GITHUB_ENV" - name: Organize artifact @@ -300,6 +320,11 @@ jobs: cp -v README.md "artifact/${{ env.ASSET_NAME }}/README.txt" cp -vr model "artifact/${{ env.ASSET_NAME }}/" echo "${{ env.VERSION }}" > "artifact/${{ env.ASSET_NAME }}/VERSION" + + mkdir java_artifact + cp -v crates/voicevox_core_java_api/target/${{ matrix.target }}/release/libvoicevox_core_java_api.so java_artifact/ || true + cp -v crates/voicevox_core_java_api/target/${{ matrix.target }}/release/libvoicevox_core_java_api.dylib java_artifact/ || true + cp -v crates/voicevox_core_java_api/target/${{ matrix.target }}/release/voicevox_core_java_api.dll java_artifact/ || true - name: Code signing (Windows) if: startsWith(matrix.os, 'windows') && github.event.inputs.code_signing == 'true' run: | @@ -309,7 +334,7 @@ jobs: CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }} - name: Upload artifact to build XCFramework if: contains(matrix.target, 'ios') - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: voicevox_core-${{ matrix.target }} path: artifact/${{ env.ASSET_NAME }} @@ -335,6 +360,12 @@ jobs: files: |- ${{ steps.build-voicevox-core-python-api.outputs.whl }} target_commitish: ${{ github.sha }} + - name: Upload voicevox_core_java_api to artifact + if: env.VERSION != '0.0.0' && !contains(matrix.target, 'ios') + uses: actions/upload-artifact@v3 + with: + name: voicevox_core_java_api-${{ matrix.artifact_name }} + path: java_artifact build_xcframework: if: ${{ !(github.event_name != 'release' && github.event_name != 'workflow_dispatch') }} # !env.IS_SIMPLE_TEST と同じ @@ -389,3 +420,114 @@ jobs: files: |- ${{ env.ASSET_NAME }}.zip target_commitish: ${{ github.sha }} + + build_java_api: + runs-on: ubuntu-latest + if: ${{ !(github.event_name != 'release' && github.event_name != 'workflow_dispatch') }} # !env.IS_SIMPLE_TEST と同じ + needs: + - build_and_deploy + steps: + - uses: actions/checkout@v3 + - name: Set up Rust + uses: ./.github/actions/rust-toolchain-from-file + - name: Set up Java + uses: actions/setup-java@v2 + with: + java-version: "11" + distribution: "adopt" + - uses: nttld/setup-ndk@v1 + if: endsWith(matrix.target, '-linux-android') + with: + ndk-version: r25b + - name: Install cargo-binstall + uses: taiki-e/install-action@cargo-binstall + - name: Install cargo-edit + run: cargo binstall cargo-edit@^0.11 --no-confirm --log-level debug + - name: set cargo version + run: | + cargo set-version "$VERSION" --exclude voicevox_core_python_api --exclude download --exclude xtask + - name: Download artifact + run: | + mkdir artifact + cd artifact + gh run download ${{ github.run_id }} -R ${{ github.repository }} -p voicevox_core_java_api-* + + - name: Build voicevoxcore + run: | + cat < files.txt + windows-x64-cpu|windows-x64 + windows-x86-cpu|windows-x86 + linux-x64-cpu|linux-x64 + linux-arm64-cpu|linux-arm64 + osx-x64-cpu|macos-x64 + osx-arm64-cpu|macos-arm64 + EOF + + for line in $(cat files.txt); do + IFS='|' read artifact_name target <<< "$line" + cp -v "artifact/voicevox_core_java_api-${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + done + + cd crates/voicevox_core_java_api + OS=desktop DEVICE=cpu gradle publishToMavenLocal + + - name: Build voicevoxcore-directml + run: | + cat < files.txt + windows-x64-directml|windows-x64 + EOF + + for line in $(cat files.txt); do + IFS='|' read artifact_name target <<< "$line" + cp -v "artifact/voicevox_core_java_api-${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + done + + cd crates/voicevox_core_java_api + OS=desktop DEVICE=directml gradle publishToMavenLocal + + - name: Build voicevoxcore-cuda + run: | + cat < files.txt + windows-x64-cuda|windows-x64 + linux-x64-gpu|linux-x64 + EOF + + for line in $(cat files.txt); do + IFS='|' read artifact_name target <<< "$line" + cp -v "artifact/voicevox_core_java_api-${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + done + + cd crates/voicevox_core_java_api + OS=desktop DEVICE=cuda gradle publishToMavenLocal + + - name: Build voicevoxcore-android + run: | + rm -rf crates/voicevox_core_java_api/lib/src/main/resources/dll + cat < files.txt + android-arm64-cpu|arm64-v8a + android-x86_64-cpu|x86_64 + EOF + + for line in $(cat files.txt); do + IFS='|' read artifact_name target <<< "$line" + cp -v "artifact/voicevox_core_java_api-${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + done + + cd crates/voicevox_core_java_api + OS=android DEVICE=cpu gradle publishToMavenLocal + + - name: Package + run: | + cd ~/.m2/repository + rm -rf dev || true + zip -r /tmp/java_packages.zip . + + - name: Upload to Release + if: env.VERSION != '0.0.0' && env.SKIP_UPLOADING_RELEASE_ASSET == '0' + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ env.VERSION }} + files: |- + /tmp/java_packages.zip + target_commitish: ${{ github.sha }} diff --git a/crates/voicevox_core_java_api/lib/build-android.gradle b/crates/voicevox_core_java_api/lib/build-android.gradle index f369c663c..4c9fedf25 100644 --- a/crates/voicevox_core_java_api/lib/build-android.gradle +++ b/crates/voicevox_core_java_api/lib/build-android.gradle @@ -1,5 +1,6 @@ plugins { id 'com.android.library' version '8.1.1' + id 'maven-publish' id 'org.jetbrains.kotlin.android' version '1.9.10' } @@ -33,6 +34,8 @@ java { toolchain { languageVersion = JavaLanguageVersion.of(8) } + + withJavadocJar() } android { @@ -54,3 +57,14 @@ android { } } } + +publishing { + publications { + maven(MavenPublication) { + groupId = 'jp.hiroshiba.voicevoxcore' + artifactId = gradle.ext.targetDevice == 'cpu' ? 'voicevoxcore-android' : "voicevoxcore-android-${gradle.ext.targetDevice}" + version = gradle.ext.version + from components.java + } + } +} diff --git a/crates/voicevox_core_java_api/lib/build.gradle b/crates/voicevox_core_java_api/lib/build.gradle index f1eb5b106..80eceaa82 100644 --- a/crates/voicevox_core_java_api/lib/build.gradle +++ b/crates/voicevox_core_java_api/lib/build.gradle @@ -8,6 +8,7 @@ plugins { // Apply the java-library plugin for API and implementation separation. id 'java-library' + id 'maven-publish' id "com.diffplug.spotless" version "6.20.0" } @@ -47,6 +48,8 @@ java { toolchain { languageVersion = JavaLanguageVersion.of(8) } + + withJavadocJar() } tasks.named('test') { // Use JUnit Platform for unit tests. @@ -61,3 +64,14 @@ spotless { googleJavaFormat() } } + +publishing { + publications { + maven(MavenPublication) { + groupId = 'jp.hiroshiba.voicevoxcore' + artifactId = gradle.ext.targetDevice == 'cpu' ? 'voicevoxcore' : "voicevoxcore-${gradle.ext.targetDevice}" + version = gradle.ext.version + from components.java + } + } +} From 3e52b1e0b4663a49dcf814e2fc4baf09e24ea18f Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 17 Sep 2023 20:25:27 +0900 Subject: [PATCH 11/36] =?UTF-8?q?Add:=20feature=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/voicevox_core_java_api/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/voicevox_core_java_api/Cargo.toml b/crates/voicevox_core_java_api/Cargo.toml index 7a8583245..bd546a243 100644 --- a/crates/voicevox_core_java_api/Cargo.toml +++ b/crates/voicevox_core_java_api/Cargo.toml @@ -7,6 +7,9 @@ publish.workspace = true [lib] crate-type = ["cdylib"] +[features] +directml = ["voicevox_core/directml"] + [dependencies] android_logger = "0.13.1" anyhow.workspace = true From 0c3b789a6b1e0b19fb0b949e17a79f2839a04ff0 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 17 Sep 2023 20:33:56 +0900 Subject: [PATCH 12/36] =?UTF-8?q?Fix:=20target=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 6e4bf51d3..752138f94 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -322,9 +322,9 @@ jobs: echo "${{ env.VERSION }}" > "artifact/${{ env.ASSET_NAME }}/VERSION" mkdir java_artifact - cp -v crates/voicevox_core_java_api/target/${{ matrix.target }}/release/libvoicevox_core_java_api.so java_artifact/ || true - cp -v crates/voicevox_core_java_api/target/${{ matrix.target }}/release/libvoicevox_core_java_api.dylib java_artifact/ || true - cp -v crates/voicevox_core_java_api/target/${{ matrix.target }}/release/voicevox_core_java_api.dll java_artifact/ || true + cp -v target/${{ matrix.target }}/release/libvoicevox_core_java_api.so java_artifact/ || true + cp -v target/${{ matrix.target }}/release/libvoicevox_core_java_api.dylib java_artifact/ || true + cp -v target/${{ matrix.target }}/release/voicevox_core_java_api.dll java_artifact/ || true - name: Code signing (Windows) if: startsWith(matrix.os, 'windows') && github.event.inputs.code_signing == 'true' run: | From 04648def0de711d0b0eb15a68c1174d63a98fe56 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 17 Sep 2023 20:54:49 +0900 Subject: [PATCH 13/36] =?UTF-8?q?Fix:=20wheel=E3=82=92=E4=B8=80=E3=81=A4?= =?UTF-8?q?=E3=81=A0=E3=81=91=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 752138f94..5ecad7b6f 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -292,7 +292,8 @@ jobs: else build > /dev/null 2>&1 fi - echo "whl=$(find ./target/wheels -type f)" >> "$GITHUB_OUTPUT" + ls -l ./target/wheels + echo "whl=$(find ./target/wheels -type f | head -1)" >> "$GITHUB_OUTPUT" env: ORT_USE_CUDA: ${{ matrix.use_cuda }} - name: build voicevox_core_java_api From c1b911e3bf56a94dc2ac65a0f46ff531a87cc78a Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 17 Sep 2023 21:03:33 +0900 Subject: [PATCH 14/36] =?UTF-8?q?Change:=20key=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 5ecad7b6f..aeca26de9 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -262,7 +262,7 @@ jobs: path: | ~/.cargo target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo- - name: build voicevox_core_c_api From 8f65c16475516c761ad74f9560b6974e1b656e35 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 17 Sep 2023 21:21:42 +0900 Subject: [PATCH 15/36] =?UTF-8?q?Fix:=20GH=5FTOKEN=E3=82=92=E6=8C=87?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index aeca26de9..86464e471 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -437,13 +437,13 @@ jobs: java-version: "11" distribution: "adopt" - uses: nttld/setup-ndk@v1 - if: endsWith(matrix.target, '-linux-android') + id: setup-ndk with: ndk-version: r25b - name: Install cargo-binstall uses: taiki-e/install-action@cargo-binstall - name: Install cargo-edit - run: cargo binstall cargo-edit@^0.11 --no-confirm --log-level debug + run: cargo binstall cargo-edit@^0.11 --no-confirm - name: set cargo version run: | cargo set-version "$VERSION" --exclude voicevox_core_python_api --exclude download --exclude xtask @@ -452,6 +452,8 @@ jobs: mkdir artifact cd artifact gh run download ${{ github.run_id }} -R ${{ github.repository }} -p voicevox_core_java_api-* + env: + GH_TOKEN: ${{ github.token }} - name: Build voicevoxcore run: | From 7114365b7062218c7063cee273fac7071195c3c2 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 17 Sep 2023 21:25:21 +0900 Subject: [PATCH 16/36] =?UTF-8?q?Fix:=20restore-keys=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 86464e471..9e3fb65cd 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -258,13 +258,14 @@ jobs: if ${{ !!matrix.whl_local_version }}; then cargo set-version "$VERSION+"${{ matrix.whl_local_version }} -p voicevox_core_python_api; fi - name: cache target uses: actions/cache@v3 + if: github.event.inputs.is_production != 'true' with: path: | ~/.cargo target key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - ${{ runner.os }}-cargo- + ${{ runner.os }}-rust- - name: build voicevox_core_c_api shell: bash run: | From 654449f72ff4f1b30189586609ee88884ecc2df0 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 17 Sep 2023 21:27:04 +0900 Subject: [PATCH 17/36] =?UTF-8?q?Fix:=20keys=E3=81=ABtarget=E3=82=92?= =?UTF-8?q?=E5=90=AB=E3=82=81=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 9e3fb65cd..9ab45d67a 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -263,7 +263,7 @@ jobs: path: | ~/.cargo target - key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.artifact_name }} restore-keys: | ${{ runner.os }}-rust- - name: build voicevox_core_c_api From bf27296d41ee2b9d25c9406d0e114b0c5a61de45 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 17 Sep 2023 21:32:07 +0900 Subject: [PATCH 18/36] =?UTF-8?q?Fix:=20actionlint=E3=81=AB=E5=BE=93?= =?UTF-8?q?=E3=81=A3=E3=81=A6=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 9ab45d67a..776c88f67 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -458,7 +458,7 @@ jobs: - name: Build voicevoxcore run: | - cat < files.txt + cat < files.txt + cat < files.txt + cat < files.txt + cat < Date: Sun, 17 Sep 2023 21:54:01 +0900 Subject: [PATCH 19/36] =?UTF-8?q?Fix:=20=E3=83=80=E3=82=A6=E3=83=B3?= =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=83=89=E5=91=A8=E3=82=8A=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 84 ++++++++++++++++++++++---- 1 file changed, 71 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 776c88f67..c6f5f1649 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -263,9 +263,9 @@ jobs: path: | ~/.cargo target - key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.artifact_name }} + key: ${{ matrix.artifact_name }}-rust-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - ${{ runner.os }}-rust- + ${{ matrix.artifact_name }}-rust- - name: build voicevox_core_c_api shell: bash run: | @@ -448,13 +448,71 @@ jobs: - name: set cargo version run: | cargo set-version "$VERSION" --exclude voicevox_core_python_api --exclude download --exclude xtask - - name: Download artifact - run: | - mkdir artifact - cd artifact - gh run download ${{ github.run_id }} -R ${{ github.repository }} -p voicevox_core_java_api-* - env: - GH_TOKEN: ${{ github.token }} + - name: "Download artifact (windows-x64-cpu)" + uses: actions/download-artifact@v3 + with: + name: voicevox_core_java_api-windows-x64-cpu + path: artifact/windows-x64-cpu + + - name: "Download artifact (windows-x64-directml)" + uses: actions/download-artifact@v3 + with: + name: voicevox_core_java_api-windows-x64-directml + path: artifact/windows-x64-directml + + - name: "Download artifact (windows-x64-cuda)" + uses: actions/download-artifact@v3 + with: + name: voicevox_core_java_api-windows-x64-cuda + path: artifact/windows-x64-cuda + + - name: "Download artifact (windows-x86-cpu)" + uses: actions/download-artifact@v3 + with: + name: voicevox_core_java_api-windows-x86-cpu + path: artifact/windows-x86-cpu + + - name: "Download artifact (linux-x64-cpu)" + uses: actions/download-artifact@v3 + with: + name: voicevox_core_java_api-linux-x64-cpu + path: artifact/linux-x64-cpu + + - name: "Download artifact (linux-x64-gpu)" + uses: actions/download-artifact@v3 + with: + name: voicevox_core_java_api-linux-x64-gpu + path: artifact/linux-x64-gpu + + - name: "Download artifact (linux-arm64-cpu)" + uses: actions/download-artifact@v3 + with: + name: voicevox_core_java_api-linux-arm64-cpu + path: artifact/linux-arm64-cpu + + - name: "Download artifact (android-arm64-cpu)" + uses: actions/download-artifact@v3 + with: + name: voicevox_core_java_api-android-arm64-cpu + path: artifact/android-arm64-cpu + + - name: "Download artifact (android-x86_64-cpu)" + uses: actions/download-artifact@v3 + with: + name: voicevox_core_java_api-android-x86_64-cpu + path: artifact/android-x86_64-cpu + + - name: "Download artifact (osx-arm64-cpu)" + uses: actions/download-artifact@v3 + with: + name: voicevox_core_java_api-osx-arm64-cpu + path: artifact/osx-arm64-cpu + + - name: "Download artifact (osx-x64-cpu)" + uses: actions/download-artifact@v3 + with: + name: voicevox_core_java_api-osx-x64-cpu + path: artifact/osx-x64-cpu - name: Build voicevoxcore run: | @@ -467,7 +525,7 @@ jobs: osx-arm64-cpu|macos-arm64 EOF IFS='|' read -r artifact_name target <<< "$line" - cp -v "artifact/voicevox_core_java_api-${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + cp -v "artifact/${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" done cd crates/voicevox_core_java_api @@ -479,7 +537,7 @@ jobs: windows-x64-directml|windows-x64 EOF IFS='|' read -r artifact_name target <<< "$line" - cp -v "artifact/voicevox_core_java_api-${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + cp -v "artifact/${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" done cd crates/voicevox_core_java_api @@ -492,7 +550,7 @@ jobs: linux-x64-gpu|linux-x64 EOF IFS='|' read -r artifact_name target <<< "$line" - cp -v "artifact/voicevox_core_java_api-${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + cp -v "artifact/${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" done cd crates/voicevox_core_java_api @@ -506,7 +564,7 @@ jobs: android-x86_64-cpu|x86_64 EOF IFS='|' read -r artifact_name target <<< "$line" - cp -v "artifact/voicevox_core_java_api-${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + cp -v "artifact/${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" done cd crates/voicevox_core_java_api From 4594d6f3fc92079110260a3a79c160fe46a11525 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 17 Sep 2023 22:18:22 +0900 Subject: [PATCH 20/36] =?UTF-8?q?Add:=20tree=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index c6f5f1649..8c3735ed6 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -513,6 +513,8 @@ jobs: with: name: voicevox_core_java_api-osx-x64-cpu path: artifact/osx-x64-cpu + - name: Print tree + run: tree artifact - name: Build voicevoxcore run: | From 41c0988efb73f065c63da8e9c0a617c925f914d6 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 17 Sep 2023 22:32:10 +0900 Subject: [PATCH 21/36] =?UTF-8?q?Fix:=20=E6=96=87=E6=B3=95=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 8c3735ed6..5923a160d 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -362,7 +362,7 @@ jobs: files: |- ${{ steps.build-voicevox-core-python-api.outputs.whl }} target_commitish: ${{ github.sha }} - - name: Upload voicevox_core_java_api to artifact + - name: Upload voicevox_core_java_api artifact if: env.VERSION != '0.0.0' && !contains(matrix.target, 'ios') uses: actions/upload-artifact@v3 with: From eae0b85a07321a5fd60375798b44b82cc15759c6 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 17 Sep 2023 22:33:52 +0900 Subject: [PATCH 22/36] =?UTF-8?q?Fix:=20=E3=83=87=E3=82=A3=E3=83=AC?= =?UTF-8?q?=E3=82=AF=E3=83=88=E3=83=AA=E4=BD=9C=E6=88=90=E5=91=A8=E3=82=8A?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 5923a160d..7aea13258 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -527,6 +527,7 @@ jobs: osx-arm64-cpu|macos-arm64 EOF IFS='|' read -r artifact_name target <<< "$line" + mkdir "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" cp -v "artifact/${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" done @@ -538,7 +539,7 @@ jobs: cat < Date: Mon, 18 Sep 2023 09:37:46 +0900 Subject: [PATCH 23/36] =?UTF-8?q?Fix:=20glob=E3=81=8C=E9=81=A9=E7=94=A8?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 7aea13258..54bb941d9 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -528,7 +528,7 @@ jobs: EOF IFS='|' read -r artifact_name target <<< "$line" mkdir "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" - cp -v "artifact/${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + cp -v artifact/$artifact_name/* "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" done cd crates/voicevox_core_java_api @@ -540,7 +540,7 @@ jobs: windows-x64-directml|windows-x64 EOF mkdir "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" - cp -v "artifact/${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + cp -v artifact/$artifact_name/* "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" done cd crates/voicevox_core_java_api @@ -553,7 +553,7 @@ jobs: linux-x64-gpu|linux-x64 EOF IFS='|' read -r artifact_name target <<< "$line" - cp -v "artifact/${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + cp -v artifact/$artifact_name/* "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" done cd crates/voicevox_core_java_api @@ -568,7 +568,7 @@ jobs: EOF mkdir -p "crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/${target}/" IFS='|' read -r artifact_name target <<< "$line" - cp -v "artifact/${artifact_name}/*" "crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/${target}/" + cp -v artifact/$artifact_name/* "crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/${target}/" done cd crates/voicevox_core_java_api From 78ea083dace9fd829747e139c0e814b2b8a9f26b Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Mon, 18 Sep 2023 10:24:38 +0900 Subject: [PATCH 24/36] =?UTF-8?q?Fix:=20read=E5=BF=98=E3=82=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 54bb941d9..5e35d3aaa 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -539,7 +539,7 @@ jobs: cat < Date: Mon, 18 Sep 2023 10:39:58 +0900 Subject: [PATCH 25/36] =?UTF-8?q?Change:=20Java=2017=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 5e35d3aaa..52ce3e199 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -435,7 +435,7 @@ jobs: - name: Set up Java uses: actions/setup-java@v2 with: - java-version: "11" + java-version: "17" distribution: "adopt" - uses: nttld/setup-ndk@v1 id: setup-ndk From 264235ceebce199ab50757085d7efed6af09d9fe Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Mon, 18 Sep 2023 11:28:23 +0900 Subject: [PATCH 26/36] =?UTF-8?q?Fix:=20android=E7=89=88=E3=81=AE=E6=A0=A1?= =?UTF-8?q?=E6=AD=A3=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../voicevox_core_java_api/lib/build-android.gradle | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/voicevox_core_java_api/lib/build-android.gradle b/crates/voicevox_core_java_api/lib/build-android.gradle index 4c9fedf25..124689f94 100644 --- a/crates/voicevox_core_java_api/lib/build-android.gradle +++ b/crates/voicevox_core_java_api/lib/build-android.gradle @@ -34,8 +34,6 @@ java { toolchain { languageVersion = JavaLanguageVersion.of(8) } - - withJavadocJar() } android { @@ -56,6 +54,11 @@ android { jniLibs.srcDirs = ["./src/main/resources/jniLibs"] } } + publishing { + singleVariant("release") { + withJavadocJar() + } + } } publishing { @@ -64,7 +67,10 @@ publishing { groupId = 'jp.hiroshiba.voicevoxcore' artifactId = gradle.ext.targetDevice == 'cpu' ? 'voicevoxcore-android' : "voicevoxcore-android-${gradle.ext.targetDevice}" version = gradle.ext.version - from components.java + + afterEvaluate { + from components.release + } } } } From 4db59ff3381f2bdde0ed76ac213cc144a747bc24 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Mon, 18 Sep 2023 22:57:25 +0900 Subject: [PATCH 27/36] =?UTF-8?q?Change:=20libstdc++=E3=82=92static?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cargo/config.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.cargo/config.toml b/.cargo/config.toml index 64fcc6aea..455b6014b 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -13,6 +13,8 @@ linker = "aarch64-linux-gnu-gcc" [target.aarch64-linux-android] linker = "aarch64-linux-android29-clang" +rustflags = ["-C", "link-arg=-static-libstdc++"] [target.x86_64-linux-android] linker = "x86_64-linux-android29-clang" +rustflags = ["-C", "link-arg=-static-libstdc++"] From af7d58317d49ef90d2e268fbf9d21a603288ca87 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Tue, 19 Sep 2023 18:56:51 +0900 Subject: [PATCH 28/36] =?UTF-8?q?Fix:=20SC2086=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 6a03edcff..3933f4a98 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -529,7 +529,7 @@ jobs: EOF IFS='|' read -r artifact_name target <<< "$line" mkdir "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" - cp -v artifact/$artifact_name/* "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + cp -v "artifact/$artifact_name"/* "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" done cd crates/voicevox_core_java_api @@ -541,7 +541,7 @@ jobs: windows-x64-directml|windows-x64 EOF IFS='|' read -r artifact_name target <<< "$line" - cp -v artifact/$artifact_name/* "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + cp -v "artifact/$artifact_name"/* "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" done cd crates/voicevox_core_java_api @@ -554,7 +554,7 @@ jobs: linux-x64-gpu|linux-x64 EOF IFS='|' read -r artifact_name target <<< "$line" - cp -v artifact/$artifact_name/* "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" + cp -v "artifact/$artifact_name"/* "crates/voicevox_core_java_api/lib/src/main/resources/dll/${target}/" done cd crates/voicevox_core_java_api @@ -569,7 +569,7 @@ jobs: EOF IFS='|' read -r artifact_name target <<< "$line" mkdir "crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/${target}/" - cp -v artifact/$artifact_name/* "crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/${target}/" + cp -v "artifact/$artifact_name"/* "crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/${target}/" done cd crates/voicevox_core_java_api From 0c220de2eccbac1631ae1922c435cd970b5e8315 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Tue, 19 Sep 2023 22:28:12 +0900 Subject: [PATCH 29/36] =?UTF-8?q?Fix:=20libc++=5Fshared.so=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cargo/config.toml | 2 -- .github/workflows/build_and_deploy.yml | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 455b6014b..64fcc6aea 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -13,8 +13,6 @@ linker = "aarch64-linux-gnu-gcc" [target.aarch64-linux-android] linker = "aarch64-linux-android29-clang" -rustflags = ["-C", "link-arg=-static-libstdc++"] [target.x86_64-linux-android] linker = "x86_64-linux-android29-clang" -rustflags = ["-C", "link-arg=-static-libstdc++"] diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 3933f4a98..2563c8fe8 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -572,6 +572,9 @@ jobs: cp -v "artifact/$artifact_name"/* "crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/${target}/" done + cp ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/arm64-v8a/ + cp ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so crates/voicevox_core_java_api/lib/src/main/resources/jniLibs/x86_64/ + cd crates/voicevox_core_java_api OS=android DEVICE=cpu gradle publishToMavenLocal From 0e88e3cbd9deb7c89df4043d33fe622e79f9aa6c Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Thu, 21 Sep 2023 06:09:49 +0900 Subject: [PATCH 30/36] =?UTF-8?q?Fix:=20=E3=82=AD=E3=83=A3=E3=83=83?= =?UTF-8?q?=E3=82=B7=E3=83=A5=E5=91=A8=E3=82=8A=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 2563c8fe8..eb57adea8 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -258,15 +258,8 @@ jobs: cargo set-version "$VERSION" --exclude voicevox_core_python_api --exclude download --exclude xtask if ${{ !!matrix.whl_local_version }}; then cargo set-version "$VERSION+"${{ matrix.whl_local_version }} -p voicevox_core_python_api; fi - name: cache target - uses: actions/cache@v3 + uses: Swatinem/rust-cache@v2 if: github.event.inputs.is_production != 'true' - with: - path: | - ~/.cargo - target - key: ${{ matrix.artifact_name }}-rust-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ matrix.artifact_name }}-rust- - name: build voicevox_core_c_api shell: bash run: | @@ -285,6 +278,7 @@ jobs: if: matrix.whl_local_version id: build-voicevox-core-python-api run: | + rm -rf ./target/wheels pip install -r ./crates/voicevox_core_python_api/requirements.txt function build() { maturin build --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --features ${{ matrix.features }}, --target ${{ matrix.target }} --release @@ -295,7 +289,7 @@ jobs: build > /dev/null 2>&1 fi ls -l ./target/wheels - echo "whl=$(find ./target/wheels -type f | head -1)" >> "$GITHUB_OUTPUT" + echo "whl=$(find ./target/wheels -type f)" >> "$GITHUB_OUTPUT" env: ORT_USE_CUDA: ${{ matrix.use_cuda }} - name: build voicevox_core_java_api From 8c49cb5a4746356a25cc20d5e89816b0f9635bc4 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sat, 30 Sep 2023 22:10:45 +0900 Subject: [PATCH 31/36] =?UTF-8?q?Delete:=20Android=E7=89=88=E4=BB=A5?= =?UTF-8?q?=E5=A4=96=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- .github/workflows/build_and_deploy.yml | 101 +------------------------ 1 file changed, 2 insertions(+), 99 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index eb57adea8..4fad93638 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -293,7 +293,7 @@ jobs: env: ORT_USE_CUDA: ${{ matrix.use_cuda }} - name: build voicevox_core_java_api - if: "!endsWith(matrix.target, 'ios')" + if: "includes(matrix.target, 'android')" run: | function build() { cargo build -p voicevox_core_java_api -vv --features ${{ matrix.features }}, --target ${{ matrix.target }} --release @@ -320,8 +320,6 @@ jobs: mkdir java_artifact cp -v target/${{ matrix.target }}/release/libvoicevox_core_java_api.so java_artifact/ || true - cp -v target/${{ matrix.target }}/release/libvoicevox_core_java_api.dylib java_artifact/ || true - cp -v target/${{ matrix.target }}/release/voicevox_core_java_api.dll java_artifact/ || true - name: Code signing (Windows) if: startsWith(matrix.os, 'windows') && github.event.inputs.code_signing == 'true' run: | @@ -358,7 +356,7 @@ jobs: ${{ steps.build-voicevox-core-python-api.outputs.whl }} target_commitish: ${{ github.sha }} - name: Upload voicevox_core_java_api artifact - if: env.VERSION != '0.0.0' && !contains(matrix.target, 'ios') + if: env.VERSION != '0.0.0' && !contains(matrix.target, 'android') uses: actions/upload-artifact@v3 with: name: voicevox_core_java_api-${{ matrix.artifact_name }} @@ -443,47 +441,6 @@ jobs: - name: set cargo version run: | cargo set-version "$VERSION" --exclude voicevox_core_python_api --exclude download --exclude xtask - - name: "Download artifact (windows-x64-cpu)" - uses: actions/download-artifact@v3 - with: - name: voicevox_core_java_api-windows-x64-cpu - path: artifact/windows-x64-cpu - - - name: "Download artifact (windows-x64-directml)" - uses: actions/download-artifact@v3 - with: - name: voicevox_core_java_api-windows-x64-directml - path: artifact/windows-x64-directml - - - name: "Download artifact (windows-x64-cuda)" - uses: actions/download-artifact@v3 - with: - name: voicevox_core_java_api-windows-x64-cuda - path: artifact/windows-x64-cuda - - - name: "Download artifact (windows-x86-cpu)" - uses: actions/download-artifact@v3 - with: - name: voicevox_core_java_api-windows-x86-cpu - path: artifact/windows-x86-cpu - - - name: "Download artifact (linux-x64-cpu)" - uses: actions/download-artifact@v3 - with: - name: voicevox_core_java_api-linux-x64-cpu - path: artifact/linux-x64-cpu - - - name: "Download artifact (linux-x64-gpu)" - uses: actions/download-artifact@v3 - with: - name: voicevox_core_java_api-linux-x64-gpu - path: artifact/linux-x64-gpu - - - name: "Download artifact (linux-arm64-cpu)" - uses: actions/download-artifact@v3 - with: - name: voicevox_core_java_api-linux-arm64-cpu - path: artifact/linux-arm64-cpu - name: "Download artifact (android-arm64-cpu)" uses: actions/download-artifact@v3 @@ -497,63 +454,9 @@ jobs: name: voicevox_core_java_api-android-x86_64-cpu path: artifact/android-x86_64-cpu - - name: "Download artifact (osx-arm64-cpu)" - uses: actions/download-artifact@v3 - with: - name: voicevox_core_java_api-osx-arm64-cpu - path: artifact/osx-arm64-cpu - - - name: "Download artifact (osx-x64-cpu)" - uses: actions/download-artifact@v3 - with: - name: voicevox_core_java_api-osx-x64-cpu - path: artifact/osx-x64-cpu - name: Print tree run: tree artifact - - name: Build voicevoxcore - run: | - cat < Date: Sat, 30 Sep 2023 22:46:51 +0900 Subject: [PATCH 32/36] Fix: includes -> contains [skip ci] --- .github/workflows/build_and_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 4fad93638..4a5a9d618 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -293,7 +293,7 @@ jobs: env: ORT_USE_CUDA: ${{ matrix.use_cuda }} - name: build voicevox_core_java_api - if: "includes(matrix.target, 'android')" + if: "contains(matrix.target, 'android')" run: | function build() { cargo build -p voicevox_core_java_api -vv --features ${{ matrix.features }}, --target ${{ matrix.target }} --release From d23678943925bf1598ed6c9af66a8dbe77540cb1 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sat, 30 Sep 2023 22:57:43 +0900 Subject: [PATCH 33/36] Fix: Fix condition [skip ci] --- .github/workflows/build_and_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 4a5a9d618..f84bbc73f 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -356,7 +356,7 @@ jobs: ${{ steps.build-voicevox-core-python-api.outputs.whl }} target_commitish: ${{ github.sha }} - name: Upload voicevox_core_java_api artifact - if: env.VERSION != '0.0.0' && !contains(matrix.target, 'android') + if: env.VERSION != '0.0.0' && contains(matrix.target, 'android') uses: actions/upload-artifact@v3 with: name: voicevox_core_java_api-${{ matrix.artifact_name }} From 83f4d63e3bc40c0001def5fabe84910875619bd9 Mon Sep 17 00:00:00 2001 From: Nanashi Date: Sun, 8 Oct 2023 15:31:41 +0900 Subject: [PATCH 34/36] =?UTF-8?q?Change:=20set-version=E3=81=AE=E5=AF=BE?= =?UTF-8?q?=E8=B1=A1=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ryo Yamashita --- .github/workflows/build_and_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index f84bbc73f..0ac48f191 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -440,7 +440,7 @@ jobs: run: cargo binstall cargo-edit@^0.11 --no-confirm - name: set cargo version run: | - cargo set-version "$VERSION" --exclude voicevox_core_python_api --exclude download --exclude xtask + cargo set-version "$VERSION" -p voicevox_core_java_api - name: "Download artifact (android-arm64-cpu)" uses: actions/download-artifact@v3 From bc7e2469a9a230a799218797ac2b6d4885584bf9 Mon Sep 17 00:00:00 2001 From: Nanashi Date: Mon, 9 Oct 2023 06:21:55 +0900 Subject: [PATCH 35/36] Change: build_java_api -> build_java_package --- .github/workflows/build_and_deploy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 0ac48f191..b0905d865 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -416,7 +416,7 @@ jobs: ${{ env.ASSET_NAME }}.zip target_commitish: ${{ github.sha }} - build_java_api: + build_java_package: runs-on: ubuntu-latest if: ${{ !(github.event_name != 'release' && github.event_name != 'workflow_dispatch') }} # !env.IS_SIMPLE_TEST と同じ needs: @@ -490,6 +490,7 @@ jobs: files: |- /tmp/java_packages.zip target_commitish: ${{ github.sha }} + download_test: needs: [config, build_and_deploy] if: needs.config.outputs.deploy == 'true' From f9743f235232f16f00b6f069d98ee99d277ef511 Mon Sep 17 00:00:00 2001 From: Nanashi Date: Mon, 9 Oct 2023 13:03:16 +0900 Subject: [PATCH 36/36] =?UTF-8?q?Delete:=20=E3=83=87=E3=83=90=E3=83=83?= =?UTF-8?q?=E3=82=B0=E3=81=AE=E7=97=95=E8=B7=A1=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index b0905d865..32cb43a00 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -288,7 +288,6 @@ jobs: else build > /dev/null 2>&1 fi - ls -l ./target/wheels echo "whl=$(find ./target/wheels -type f)" >> "$GITHUB_OUTPUT" env: ORT_USE_CUDA: ${{ matrix.use_cuda }}