65 lines
3.3 KiB
Groovy
65 lines
3.3 KiB
Groovy
plugins {
|
|
id 'com.android.application'
|
|
id 'org.jetbrains.kotlin.android'
|
|
id 'org.jetbrains.kotlin.plugin.compose'
|
|
}
|
|
def versions = new Properties()
|
|
rootProject.file('gradle/expression-versions.properties').withInputStream { versions.load(it) }
|
|
def shared = ['CameraDiagnosticsActivity.kt', 'ImmersiveMode.kt', 'expression/CameraProbeController.kt', 'expression/CameraProbeState.kt',
|
|
'expression/CameraPreviewSurface.kt', 'expression/FaceDiagnostics.kt', 'expression/FaceCueRules.kt',
|
|
'expression/ExpressionRules.kt', 'expression/ExpressionState.kt', 'expression/PresenceRules.kt',
|
|
'dialogue/ReplyEmotion.kt', 'diag/DiagnosticLog.kt', 'diag/DiagnosticReportUpload.kt']
|
|
// Compile the same production runner/uploader. The whitelist excludes the avatar,
|
|
// voice session, renderer, face model and all assets rather than copying their code.
|
|
def stageSource = layout.buildDirectory.dir('generated/sharedCameraSource')
|
|
def stageCameraSource = tasks.register('stageCameraSource', Sync) {
|
|
from('../app/src/main/java/com/gorios/lanvoice') { shared.each { include it } }
|
|
into(stageSource)
|
|
}
|
|
def trustResources = layout.buildDirectory.dir('generated/cameraTrust/res')
|
|
def stageCameraTrust = tasks.register('stageCameraTrust') {
|
|
inputs.files('../app/src/main/res/raw/gateway_cert.pem', '../app/src/main/res/values/config.xml', '../app/src/main/network_security_config.xml')
|
|
outputs.dir(trustResources)
|
|
doLast {
|
|
def base=trustResources.get().asFile
|
|
def cert=new File(base,'raw/gateway_cert.pem');cert.parentFile.mkdirs()
|
|
cert.bytes=file('../app/src/main/res/raw/gateway_cert.pem').bytes
|
|
def host=new XmlSlurper().parse(file('../app/src/main/res/values/config.xml')).string.find { it.@name.text()=='voice_server_host' }.text()
|
|
if (!(host ==~ /[A-Za-z0-9.:-]+/)) throw new GradleException('Invalid shared gateway host')
|
|
def xml=new File(base,'xml/network_security_config.xml');xml.parentFile.mkdirs()
|
|
xml.text=file('../app/src/main/network_security_config.xml').text.replace('@VOICE_SERVER_HOST@',host)
|
|
}
|
|
}
|
|
android {
|
|
namespace 'com.gorios.lanvoice'
|
|
compileSdk 34
|
|
defaultConfig {
|
|
applicationId 'com.gorios.lanvoice.cameraprobe'
|
|
minSdk 26
|
|
targetSdk 34
|
|
versionCode 2
|
|
versionName 'camera-probe-0.1.1'
|
|
ndk { abiFilters 'arm64-v8a' }
|
|
}
|
|
compileOptions { sourceCompatibility JavaVersion.VERSION_17; targetCompatibility JavaVersion.VERSION_17 }
|
|
kotlinOptions { jvmTarget='17' }
|
|
buildFeatures { compose=true; buildConfig=true }
|
|
buildTypes {
|
|
debug { buildConfigField 'String','EMOTION_MANIFEST_SHA','""' }
|
|
release { buildConfigField 'String','EMOTION_MANIFEST_SHA','""' }
|
|
}
|
|
sourceSets.main.java.srcDir(stageSource)
|
|
sourceSets.main.res.srcDir(trustResources)
|
|
}
|
|
tasks.named('preBuild').configure { dependsOn(stageCameraSource, stageCameraTrust) }
|
|
dependencies {
|
|
implementation platform('androidx.compose:compose-bom:2024.09.03')
|
|
implementation 'androidx.compose.ui:ui'
|
|
implementation 'androidx.compose.material3:material3'
|
|
implementation 'androidx.activity:activity-compose:1.9.3'
|
|
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
|
['camera-core','camera-camera2','camera-lifecycle','camera-view'].each {
|
|
implementation "androidx.camera:$it:${versions.getProperty('camerax.version')}"
|
|
}
|
|
}
|