11plugins {
22 id(" com.android.application" )
33 id(" org.jetbrains.kotlin.android" )
4+ id(" org.jlleitschuh.gradle.ktlint" ) version " 12.1.0"
45}
56
67android {
@@ -11,17 +12,51 @@ android {
1112 applicationId = " com.heisenberg.lux"
1213 minSdk = 26
1314 targetSdk = 34
14- versionCode = 1
15- versionName = " 1.0"
15+ versionCode = 4
16+ versionName = " 0.4.1"
17+ }
18+
19+ signingConfigs {
20+ create(" release" ) {
21+ // Use keystore from environment variable or default locations
22+ val keystorePath = System .getenv(" ANDROID_KEYSTORE" )
23+ ? : " ${System .getProperty(" user.home" )} /android.jks"
24+ val keystoreFile = file(keystorePath)
25+
26+ if (keystoreFile.exists()) {
27+ println (" Using keystore: $keystorePath " )
28+ storeFile = keystoreFile
29+ // Try environment variables first, then Gradle properties, then defaults
30+ storePassword = System .getenv(" ANDROID_KEYSTORE_PASSWORD" )
31+ ? : project.findProperty(" android.keystorePassword" ) as String?
32+ ? : " android"
33+ keyAlias = System .getenv(" ANDROID_KEY_ALIAS" )
34+ ? : project.findProperty(" android.keyAlias" ) as String?
35+ ? : " key0"
36+ keyPassword = System .getenv(" ANDROID_KEY_PASSWORD" )
37+ ? : project.findProperty(" android.keyPassword" ) as String?
38+ ? : storePassword // Use store password as key password if not specified
39+ println (" Using key alias: $keyAlias " )
40+ } else {
41+ println (" Warning: Keystore not found at $keystorePath - release build will be unsigned" )
42+ }
43+ }
1644 }
1745
1846 buildTypes {
1947 release {
2048 isMinifyEnabled = true
2149 proguardFiles(
2250 getDefaultProguardFile(" proguard-android-optimize.txt" ),
23- " proguard-rules.pro"
51+ " proguard-rules.pro" ,
2452 )
53+ // Sign if keystore exists, otherwise build unsigned
54+ signingConfig =
55+ if (rootProject.file(" heisenberg.keystore" ).exists()) {
56+ signingConfigs.getByName(" release" )
57+ } else {
58+ null
59+ }
2560 }
2661 }
2762
@@ -39,6 +74,16 @@ android {
3974 }
4075}
4176
77+ ktlint {
78+ version.set(" 1.0.1" )
79+ android.set(true )
80+ ignoreFailures.set(false )
81+ reporters {
82+ reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType .PLAIN )
83+ reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType .CHECKSTYLE )
84+ }
85+ }
86+
4287dependencies {
4388 // Minimal dependencies - only what's needed for CameraX and lifecycle
4489 implementation(" androidx.appcompat:appcompat:1.6.1" )
0 commit comments