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'