111 lines
3.8 KiB
Plaintext
111 lines
3.8 KiB
Plaintext
import java.io.FileInputStream
|
|
import java.util.Properties
|
|
|
|
plugins {
|
|
id("com.android.application")
|
|
id("org.jetbrains.kotlin.android")
|
|
}
|
|
|
|
// Release signing credentials live in keystore.properties, which is kept out of
|
|
// version control. When it is missing the release APK is left unsigned so that
|
|
// `assembleDebug` and secret-less CI builds keep working.
|
|
val keystorePropsFile = rootProject.file("keystore.properties")
|
|
val keystoreProps = Properties().apply {
|
|
if (keystorePropsFile.exists()) {
|
|
FileInputStream(keystorePropsFile).use { load(it) }
|
|
}
|
|
}
|
|
|
|
android {
|
|
namespace = "com.bm.pagescribe"
|
|
compileSdk = 36
|
|
|
|
defaultConfig {
|
|
applicationId = "com.bm.pagescribe"
|
|
minSdk = 26
|
|
targetSdk = 36
|
|
versionCode = 1
|
|
versionName = "1.0"
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
}
|
|
|
|
signingConfigs {
|
|
if (keystorePropsFile.exists()) {
|
|
create("release") {
|
|
storeFile = rootProject.file(keystoreProps.getProperty("storeFile"))
|
|
storePassword = keystoreProps.getProperty("storePassword")
|
|
keyAlias = keystoreProps.getProperty("keyAlias")
|
|
keyPassword = keystoreProps.getProperty("keyPassword")
|
|
}
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
isMinifyEnabled = false
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"proguard-rules.pro"
|
|
)
|
|
if (keystorePropsFile.exists()) {
|
|
signingConfig = signingConfigs.getByName("release")
|
|
}
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = "17"
|
|
}
|
|
|
|
testOptions {
|
|
unitTests {
|
|
// Robolectric needs the real Android resources (drawables are not
|
|
// used by the tests, but the framework classes are).
|
|
isIncludeAndroidResources = true
|
|
isReturnDefaultValues = true
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation("androidx.core:core-ktx:1.16.0")
|
|
implementation("androidx.appcompat:appcompat:1.7.1")
|
|
implementation("androidx.activity:activity-ktx:1.10.1")
|
|
implementation("androidx.recyclerview:recyclerview:1.4.0")
|
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.9.4")
|
|
implementation("com.google.android.material:material:1.14.0")
|
|
|
|
// Background OCR queue. WorkManager persists the queue across reboots.
|
|
implementation("androidx.work:work-runtime-ktx:2.12.0")
|
|
|
|
// CameraX: live preview + still capture of the book spread.
|
|
implementation("androidx.camera:camera-core:1.6.2")
|
|
implementation("androidx.camera:camera-camera2:1.6.2")
|
|
implementation("androidx.camera:camera-lifecycle:1.6.2")
|
|
implementation("androidx.camera:camera-view:1.6.2")
|
|
|
|
// EXIF orientation, so a photo taken in portrait is not OCR'd sideways.
|
|
implementation("androidx.exifinterface:exifinterface:1.4.2")
|
|
|
|
// Text recognition v2 (Latin), *bundled* variant: the ~18 MB model ships
|
|
// inside the APK, so OCR works with no network and no Google Play services.
|
|
implementation("com.google.mlkit:text-recognition:16.0.1")
|
|
|
|
// Task -> coroutine bridge for the ML Kit recognizer.
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.10.2")
|
|
|
|
testImplementation("junit:junit:4.13.2")
|
|
// Android graphics (Bitmap/Canvas/Bitmap.compress) on the JVM for the
|
|
// image-archiving tests.
|
|
testImplementation("org.robolectric:robolectric:4.16.1")
|
|
// android.* classes the framework ships but the plain JVM does not.
|
|
testImplementation("org.json:json:20250107")
|
|
}
|