summaryrefslogtreecommitdiff
path: root/app/build.gradle.kts
blob: c53996051dad492ab8eaeb36ae9c7498608da9d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import java.util.Properties

plugins {
    id("com.android.application")
}

// Release signing is read from keystore.properties (git-ignored, present only on
// the maintainer's machine). CI (e.g. F-Droid) builds an unsigned APK.
val keystorePropertiesFile = rootProject.file("keystore.properties")
val keystoreProperties = Properties().apply {
    if (keystorePropertiesFile.exists()) {
        keystorePropertiesFile.inputStream().use { load(it) }
    }
}

android {
    namespace = "com.tomcooks.reccoon"

    compileSdk {
        version = release(37) {
            minorApiLevel = 0
        }
    }

    defaultConfig {
        applicationId = "com.tomcooks.reccoon"
        minSdk = 26
        targetSdk = 35
        versionCode = 1
        versionName = "1.0.0"

        ndk {
            // Prebuilt sherpa-onnx / onnxruntime native libraries. Only arm64 is
            // shipped; x86_64 was only useful for emulators and doubled the APK.
            abiFilters += listOf("arm64-v8a")
        }
    }

    signingConfigs {
        if (keystorePropertiesFile.exists()) {
            create("release") {
                storeFile = file(keystoreProperties.getProperty("storeFile"))
                storePassword = keystoreProperties.getProperty("storePassword")
                keyAlias = keystoreProperties.getProperty("keyAlias")
                keyPassword = keystoreProperties.getProperty("keyPassword")
            }
        }
    }

    buildTypes {
        debug {
            isMinifyEnabled = false
        }
        release {
            isMinifyEnabled = false
            // Signed with the maintainer's key when keystore.properties is
            // present; unsigned otherwise so F-Droid/CI signs it itself.
            signingConfig = if (keystorePropertiesFile.exists()) {
                signingConfigs.getByName("release")
            } else {
                null
            }
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }

    packaging {
        jniLibs {
            useLegacyPackaging = false
        }
    }
}

dependencies {
    implementation("androidx.appcompat:appcompat:1.8.0")
    implementation("androidx.constraintlayout:constraintlayout:2.2.2")
    implementation("androidx.recyclerview:recyclerview:1.4.0")

    // Kotlin runtime required by the sherpa-onnx Kotlin API.
    implementation("org.jetbrains.kotlin:kotlin-stdlib:2.4.20")

    // On-device speech recognition runtime (loads the Parakeet ONNX graphs).
    // Pulled from JitPack (an F-Droid-trusted Maven repository) so no prebuilt
    // binary has to live in this repo. Byte-identical to the official AAR.
    implementation("com.github.k2-fsa.sherpa-onnx:sherpa-onnx:1.13.8@aar")

    testImplementation("junit:junit:4.13.2")
}