Recently Written · git

ink-dim

Ink Dim: tap to set the frontlight of a Viwoods AiPaper reader below the lowest system level. Tap again to go back.

git clone https://github.com/equwal/ink-dim

Log | Files | Refs


app/build.gradle.kts (2742 bytes)

1 import java.util.Properties
2 
3 plugins {
4     id("com.android.application")
5     id("org.jetbrains.kotlin.android")
6 }
7 
8 /**
9  * Release signing is optional. The keys come from keystore.properties in the
10  * root of the project, which is not in the repository. Without that file the
11  * release build still runs and makes an unsigned APK, so a fresh clone always
12  * builds.
13  */
14 val keystoreProps = Properties().apply {
15     val f = rootProject.file("keystore.properties")
16     if (f.exists()) f.inputStream().use { load(it) }
17 }
18 val hasSigning = keystoreProps.getProperty("storeFile") != null
19 
20 android {
21     namespace = "dev.equwal.inkdim"
22     compileSdk = 36
23 
24     // No list of dependencies, encrypted for Google alone, in the signed APK.
25     // F-Droid does not accept it, and it would stop the reproducible build check.
26     dependenciesInfo {
27         includeInApk = false
28         includeInBundle = false
29     }
30 
31     defaultConfig {
32         applicationId = "dev.equwal.inkdim"
33         minSdk = 31
34         targetSdk = 36
35         versionCode = 5
36         versionName = "0.1.4"
37     }
38 
39     signingConfigs {
40         if (hasSigning) {
41             create("release") {
42                 storeFile = rootProject.file(keystoreProps.getProperty("storeFile"))
43                 storePassword = keystoreProps.getProperty("storePassword")
44                 keyAlias = keystoreProps.getProperty("keyAlias")
45                 keyPassword = keystoreProps.getProperty("keyPassword")
46             }
47         }
48     }
49 
50     buildTypes {
51         release {
52             // R8 removes unused code and resources. F-Droid asks for it.
53             // proguard-rules.pro keeps the one method that Shell.kt finds by name.
54             isMinifyEnabled = true
55             isShrinkResources = true
56             proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
57             if (hasSigning) signingConfig = signingConfigs.getByName("release")
58         }
59         debug {
60             applicationIdSuffix = ".debug"
61             versionNameSuffix = "-debug"
62         }
63     }
64 
65     buildFeatures {
66         buildConfig = true
67     }
68 
69     compileOptions {
70         sourceCompatibility = JavaVersion.VERSION_17
71         targetCompatibility = JavaVersion.VERSION_17
72     }
73 
74     kotlinOptions {
75         jvmTarget = "17"
76     }
77 }
78 
79 // Shizuku (Apache-2.0) is the only dependency in the APK. It lets the app run a
80 // command as the shell user, which is how it writes the light node. The user
81 // starts Shizuku from the device. Nothing here needs a computer or the network.
82 dependencies {
83     implementation("dev.rikka.shizuku:api:13.1.5")
84     implementation("dev.rikka.shizuku:provider:13.1.5")
85 
86     // Tests only, never in the APK.
87     testImplementation("junit:junit:4.13.2")
88 }