From 5db3d3db6290aa8542ffec792b0c04b220354f14 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sat, 16 Sep 2023 06:40:51 +0900 Subject: [PATCH] =?UTF-8?q?Change:=20=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E5=91=A8=E3=82=8A=E3=82=92=E5=85=B1=E9=80=9A=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' +}