You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
3.3 KiB
97 lines
3.3 KiB
import com.google.protobuf.gradle.*
|
|
plugins {
|
|
id("com.android.library")
|
|
id("org.jetbrains.kotlin.android")
|
|
id("com.google.protobuf")
|
|
}
|
|
|
|
android {
|
|
namespace = "com.yunqiinnovation.azure_speech"
|
|
compileSdk = 35
|
|
|
|
defaultConfig {
|
|
minSdk = 21
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
}
|
|
|
|
sourceSets {
|
|
getByName("main") {
|
|
manifest.srcFile("src/main/AndroidManifest.xml")
|
|
java.srcDirs("src/main/kotlin")
|
|
proto {
|
|
srcDir("src/main/protos")
|
|
}
|
|
}
|
|
}
|
|
|
|
// 添加lint选项
|
|
lintOptions {
|
|
isCheckReleaseBuilds = false
|
|
}
|
|
|
|
// 添加packaging配置,排除冲突文件
|
|
packaging {
|
|
resources {
|
|
excludes.add("META-INF/DEPENDENCIES")
|
|
excludes.add("META-INF/LICENSE")
|
|
excludes.add("META-INF/LICENSE.txt")
|
|
excludes.add("META-INF/license.txt")
|
|
excludes.add("META-INF/NOTICE")
|
|
excludes.add("META-INF/NOTICE.txt")
|
|
excludes.add("META-INF/notice.txt")
|
|
excludes.add("META-INF/*.kotlin_module")
|
|
}
|
|
}
|
|
}
|
|
|
|
// 显式设置Kotlin JVM目标版本
|
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
|
kotlinOptions {
|
|
jvmTarget = "11"
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// 添加Microsoft语音SDK
|
|
implementation("com.microsoft.cognitiveservices.speech:client-sdk:1.48.1")
|
|
implementation(project(":speech"))
|
|
implementation("com.squareup.okhttp3:okhttp:4.12.0")
|
|
implementation("com.google.protobuf:protobuf-javalite:3.25.1")
|
|
add("compileOnly", project(":ble_service"))
|
|
// 通话翻译 PCM 原生直连桥:直接给 bluetooth_manager 的 tap 槽赋值 / 直喂它的下行发送器(见 BesCallPcmBridge.kt)
|
|
add("compileOnly", project(":bluetooth_manager"))
|
|
|
|
// gRPC
|
|
val grpcVersion = "1.57.2"
|
|
implementation("io.grpc:grpc-android:$grpcVersion")
|
|
implementation("io.grpc:grpc-okhttp:$grpcVersion")
|
|
implementation("io.grpc:grpc-protobuf-lite:$grpcVersion")
|
|
implementation("io.grpc:grpc-stub:$grpcVersion")
|
|
implementation("javax.annotation:javax.annotation-api:1.3.2")
|
|
}
|
|
|
|
protobuf {
|
|
protoc {
|
|
artifact = "com.google.protobuf:protoc:3.25.1"
|
|
}
|
|
// ⚠️ 不再跑 protoc-gen-grpc-java(2026-09-24 去掉):
|
|
// 1) 它生成的只有 ASTServiceGrpc 这个 gRPC 客户端桩,全项目零引用——豆包 AST 走的是
|
|
// WebSocket(DoubaoE2ETranslateHelper 用 OkHttp 发 protobuf 消息),只用到下面 java lite
|
|
// 生成的消息类(TranslateRequest / TranslateResponse 等),那部分由 protoc 本身产出;
|
|
// 2) grpc-java 官方所有版本(1.57 ~ 1.72 实测)标成 osx-aarch_64 的插件其实都是 x86_64 程序,
|
|
// Apple 芯片的 Mac 没装 Rosetta 就执行不了,Android 编译直接失败在 generateDebugProto。
|
|
// 要恢复 gRPC 桩就把 plugins { id("grpc") } 与 task.plugins { id("grpc") } 加回来,并确保构建机有 Rosetta。
|
|
generateProtoTasks {
|
|
all().forEach { task ->
|
|
task.builtins {
|
|
id("java") {
|
|
option("lite")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|