plugins { id 'com.android.library' id 'org.jlleitschuh.gradle.ktlint' } abstract class GenerateProjectLanguages extends Exec { @OutputDirectory abstract DirectoryProperty getOutputDirectory() } androidComponents { onVariants(selector().all()) { variant -> def generator = tasks.register("generate${variant.name.capitalize()}ProjectLanguages", GenerateProjectLanguages) { inputs.file(rootProject.file('config/project.json')) inputs.file(rootProject.file('tools/project_config.py')) doFirst { commandLine 'python3', rootProject.file('tools/project_config.py'), '--kotlin', outputDirectory.file('link/roadio/riff/config/ProjectLanguages.kt').get().asFile } } variant.sources.kotlin.addGeneratedSourceDirectory(generator) { it.outputDirectory } } } android { namespace = 'link.roadio.riff.indexer.module' compileSdk = 37 compileSdkMinor = 2 ndkVersion = '29.0.14206865' defaultConfig { minSdk = 31 consumerProguardFiles rootProject.file('standalone/cuegrain/ced/consumer-rules.pro') testInstrumentationRunner = 'androidx.test.runner.AndroidJUnitRunner' externalNativeBuild { cmake { arguments '-DANDROID_STL=c++_static' } } } externalNativeBuild { cmake { path = file('src/main/cpp/CMakeLists.txt') version = '3.31.6' } } compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } buildFeatures { aidl = true buildConfig = true } androidResources { noCompress += ['tflite', 'fb'] } sourceSets { main.kotlin.srcDir 'src/main/generated/kotlin' // Compile Cuegrain's JNI bridge directly; its desktop native resources are not Android artifacts. main.kotlin.srcDir rootProject.file('standalone/cuegrain/ced/src/main/kotlin') androidTest.assets.srcDir 'src/test/resources' } } dependencies { api project(':configuration') implementation 'link.roadio.cuegrain:cuegrain-core:0.1.0' implementation 'link.roadio.cuetree:cuetree-core:0.1.0-SNAPSHOT' // CPU-only Interpreter API for the current content-derived public-beta Level 2 package. implementation 'com.google.ai.edge.litert:litert:2.3.0' implementation 'androidx.media3:media3-extractor:1.11.1' implementation 'androidx.media3:media3-inspector:1.11.1' androidTestImplementation 'androidx.test.ext:junit:1.3.0' androidTestImplementation 'androidx.test:runner:1.7.0' testImplementation 'com.dynatrace.hash4j:hash4j:0.31.0' testImplementation 'junit:junit:4.13.2' testImplementation 'org.json:json:20260814' testImplementation 'org.jetbrains.kotlin:kotlin-test:2.4.21' } ktlint { filter { exclude { entry -> entry.file.path.contains('/src/main/generated/') } } } tasks.register('verifyKotlinFlatbuffers') { group = 'verification' description = 'Reject Java FlatBuffers bindings/runtime imports.' inputs.files(fileTree('src/main/generated')) doLast { def generatedJava = fileTree('src/main/generated') { include '**/*.java' }.files if (!generatedJava.empty) { throw new GradleException("Generated Java FlatBuffers sources are prohibited: ${generatedJava}") } def kotlinFiles = fileTree('src/main/generated/kotlin') { include '**/*.kt' }.files if (kotlinFiles.empty) { throw new GradleException('Kotlin FlatBuffers sources are missing') } def javaRuntimeImports = kotlinFiles.findAll { source -> source.readLines().any { line -> line.startsWith('import com.google.flatbuffers.') && !line.startsWith('import com.google.flatbuffers.kotlin.') } } if (!javaRuntimeImports.empty) { throw new GradleException("Java FlatBuffers runtime imports are prohibited: ${javaRuntimeImports}") } } } tasks.named('preBuild') { dependsOn ':configuration:verifyPackagedConfiguration' dependsOn rootProject.tasks.named('verifyConfusables') dependsOn rootProject.tasks.named('verifyGnreAsset') dependsOn tasks.named('verifyKotlinFlatbuffers') } tasks.named('build') { dependsOn 'ktlintCheck' } apply from: rootProject.file('gradle/runtime-dependencies.gradle')