build.gradle.kts raw
1 import com.android.build.gradle.internal.tasks.factory.dependsOn
2
3 private val readAndUnderstoodLicense = false
4
5 plugins {
6 id("com.android.application")
7 id("org.jetbrains.kotlin.android")
8 id("io.gitlab.arturbosch.detekt")
9 }
10
11 android {
12 namespace = "io.github.domi04151309.alwayson"
13 compileSdk = 34
14
15 defaultConfig {
16 applicationId = "io.github.domi04151309.alwayson"
17 minSdk = 24
18 //noinspection EditedTargetSdkVersion
19 targetSdk = 34
20 versionCode = 3100
21 versionName = "3.10.0"
22 }
23
24 buildTypes {
25 debug {
26 isMinifyEnabled = true
27 isShrinkResources = true
28 applicationIdSuffix = ".debug"
29 versionNameSuffix = " debug"
30 proguardFiles(
31 getDefaultProguardFile("proguard-android-optimize.txt"),
32 "proguard-rules.pro",
33 )
34 }
35 release {
36 isMinifyEnabled = true
37 isShrinkResources = true
38 proguardFiles(
39 getDefaultProguardFile("proguard-android-optimize.txt"),
40 "proguard-rules.pro",
41 )
42 }
43 }
44 buildFeatures {
45 buildConfig = true
46 }
47 compileOptions {
48 sourceCompatibility = JavaVersion.VERSION_17
49 targetCompatibility = JavaVersion.VERSION_17
50 }
51 kotlinOptions {
52 jvmTarget = "17"
53 }
54 detekt {
55 config.setFrom(file("detekt-config.yml"))
56 buildUponDefaultConfig = true
57 basePath = rootProject.projectDir.absolutePath
58 }
59 lint {
60 disable += "MissingTranslation"
61 }
62 project.tasks.preBuild.dependsOn("license")
63 }
64
65 tasks.register("license") {
66 doFirst {
67 val data =
68 file("./src/main/res/xml/pref_about.xml")
69 .readText()
70 .contains("app:key=\"license\"")
71 if (!data) {
72 throw Exception(
73 "Please note that removing the license from the about page is not allowed if you " +
74 "plan to publish your modified version of this app. " +
75 "Please read the project's LICENSE.",
76 )
77 }
78 if (!(
79 android.defaultConfig.applicationId?.contains("domi04151309") == true ||
80 readAndUnderstoodLicense
81 )
82 ) {
83 throw Exception(
84 "Please make sure you have read and understood the LICENSE!",
85 )
86 }
87 }
88 }
89
90 dependencies {
91 implementation("androidx.appcompat:appcompat:1.7.1")
92 implementation("com.google.android.material:material:1.12.0")
93 implementation("androidx.preference:preference-ktx:1.2.1")
94 implementation("com.jaredrummler:colorpicker:1.1.0")
95 implementation("com.android.volley:volley:1.2.1")
96 }
97