-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.gradle.kts
210 lines (184 loc) · 6.89 KB
/
build.gradle.kts
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
@file:Suppress("UnstableApiUsage")
import com.android.build.gradle.tasks.PackageAndroidArtifact
import org.jetbrains.kotlin.util.removeSuffixIfPresent
import java.util.Properties
plugins {
id("com.android.application")
kotlin("android")
kotlin("plugin.parcelize")
id("com.google.devtools.ksp")
}
android {
val releaseType = readProperties(file("../package.properties")).getProperty("releaseType")
if (releaseType.contains("\"")) {
throw IllegalArgumentException("releaseType must not contain \"")
}
namespace = "org.akanework.gramophone"
compileSdk = 35
buildToolsVersion = "35.0.0"
ndkVersion = "28.0.12674087-rc2"
androidResources {
generateLocaleConfig = true
}
buildFeatures {
buildConfig = true
}
packaging {
jniLibs {
useLegacyPackaging = false
}
dex {
useLegacyPackaging = false
}
resources {
// https://stackoverflow.com/a/58956288
excludes += "META-INF/*.version"
// https://github.com/Kotlin/kotlinx.coroutines?tab=readme-ov-file#avoiding-including-the-debug-infrastructure-in-the-resulting-apk
excludes += "DebugProbesKt.bin"
// https://issueantenna.com/repo/kotlin/kotlinx.coroutines/issues/3158
excludes += "kotlin-tooling-metadata.json"
excludes += "META-INF/**/LICENSE.txt"
}
}
defaultConfig {
applicationId = "uk.akane.accord"
// Reasons to not support KK include me.zhanghai.android.fastscroll, WindowInsets for
// bottom sheet padding, ExoPlayer requiring multidex for KK and poor SD card support
// That said, supporting Android 5.0 barely costs any tech debt and we plan to keep support
// for it for a while.
// Bye bye android 12 - cuz blur
minSdk = 31
targetSdk = 35
versionCode = 18
versionName = "beta2"
buildConfigField(
"String",
"MY_VERSION_NAME",
"\"Beta 2\""
)
buildConfigField(
"String",
"RELEASE_TYPE",
"\"$releaseType\""
)
setProperty("archivesBaseName", "Accord-$versionName")
}
signingConfigs {
create("release") {
if (project.hasProperty("AKANE_RELEASE_KEY_ALIAS")) {
storeFile = file(project.properties["AKANE_RELEASE_STORE_FILE"].toString())
storePassword = project.properties["AKANE_RELEASE_STORE_PASSWORD"].toString()
keyAlias = project.properties["AKANE_RELEASE_KEY_ALIAS"].toString()
keyPassword = project.properties["AKANE_RELEASE_KEY_PASSWORD"].toString()
}
}
}
splits.abi {
// Enables building multiple APKs per ABI.
isEnable = true
// By default all ABIs are included, so use reset() and include to specify that you only
// want APKs for x86 and x86_64.
// Resets the list of ABIs for Gradle to create APKs for to none.
reset()
// Specifies a list of ABIs for Gradle to create APKs for.
include("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
// Specifies that you don't want to also generate a universal APK that includes all ABIs.
isUniversalApk = true
}
buildTypes {
release {
if (releaseType != "Profile") {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
} else {
isMinifyEnabled = false
isProfileable = true
}
if (project.hasProperty("AKANE_RELEASE_KEY_ALIAS")) {
signingConfig = signingConfigs["release"]
}
}
debug {
applicationIdSuffix = ".debug"
if (project.hasProperty("AKANE_RELEASE_KEY_ALIAS")) {
signingConfig = signingConfigs["release"]
}
}
}
// https://gitlab.com/IzzyOnDroid/repo/-/issues/491
dependenciesInfo {
includeInApk = false
includeInBundle = false
}
}
// https://stackoverflow.com/a/77745844
tasks.withType<PackageAndroidArtifact> {
doFirst { appMetadata.asFile.orNull?.writeText("") }
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
kotlin {
jvmToolchain(17)
compilerOptions {
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}
configurations.configureEach {
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk7")
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
exclude("androidx.recyclerview", "recyclerview")
}
dependencies {
val media3Version = "1.5.1"
val roomVersion = "2.7.0-alpha12"
ksp("androidx.room:room-compiler:$roomVersion")
implementation("androidx.room:room-runtime:$roomVersion")
implementation("androidx.room:room-ktx:$roomVersion")
implementation("androidx.core:core-ktx:1.15.0")
implementation("androidx.activity:activity-ktx:1.10.0-rc01")
implementation("androidx.concurrent:concurrent-futures-ktx:1.2.0")
implementation("androidx.transition:transition-ktx:1.5.1") // <-- for predictive back
implementation("androidx.fragment:fragment-ktx:1.8.5")
implementation("androidx.core:core-splashscreen:1.2.0-alpha02")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.9.0-alpha08")
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.constraintlayout:constraintlayout:2.2.0")
implementation("androidx.media3:media3-exoplayer:$media3Version")
implementation("androidx.media3:media3-exoplayer-midi:$media3Version")
implementation("androidx.media3:media3-session:$media3Version")
implementation("androidx.preference:preference-ktx:1.2.1")
implementation("com.google.android.material:material:1.13.0-alpha09")
implementation("com.google.android.flexbox:flexbox:3.0.0")
implementation("me.zhanghai.android.fastscroll:library:1.3.0")
implementation("io.coil-kt.coil3:coil:3.0.4")
implementation(files("../libs/lib-decoder-ffmpeg-release.aar"))
implementation(projects.recyclerview)
// --- below does not apply to release builds ---
debugImplementation("com.squareup.leakcanary:leakcanary-android:3.0-alpha-8")
testImplementation("junit:junit:4.13.2")
}
fun String.runCommand(
workingDir: File = File(".")
): String = providers.exec {
setWorkingDir(workingDir)
commandLine(split(' '))
}.standardOutput.asText.get().removeSuffixIfPresent("\n")
fun readProperties(propertiesFile: File) = Properties().apply {
propertiesFile.inputStream().use { fis ->
load(fis)
}
}