forked from LawnchairLauncher/lawnicons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
172 lines (149 loc) · 5.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
import app.cash.licensee.LicenseeTask
import com.android.build.gradle.internal.api.ApkVariantOutputImpl
import com.android.build.gradle.tasks.MergeResources
import java.util.Locale
import java.util.Properties
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.plugin.compose")
id("org.jetbrains.kotlin.plugin.serialization")
id("com.google.devtools.ksp")
id("com.google.dagger.hilt.android")
id("app.cash.licensee")
id("org.gradle.android.cache-fix")
}
val buildCommit = providers.exec {
commandLine("git", "rev-parse", "--short=7", "HEAD")
}.standardOutput.asText.get().trim()
val ciBuild = providers.environmentVariable("CI").isPresent
val ciRef = providers.environmentVariable("GITHUB_REF").orNull.orEmpty()
val ciRunNumber = providers.environmentVariable("GITHUB_RUN_NUMBER").orNull.orEmpty()
val isReleaseBuild = ciBuild && ciRef.contains("main")
val devReleaseName = if (ciBuild) "(Dev #$ciRunNumber)" else "($buildCommit)"
val version = "2.13.1"
val versionDisplayName = version + if (!isReleaseBuild) " $devReleaseName" else ""
android {
compileSdk = 35
namespace = "app.lawnchair.lawnicons"
defaultConfig {
applicationId = "app.lawnchair.lawnicons"
minSdk = 26
targetSdk = compileSdk
versionCode = 18
versionName = versionDisplayName
vectorDrawables.useSupportLibrary = true
}
androidResources {
generateLocaleConfig = true
}
val releaseSigning = try {
val keystoreProperties = Properties()
keystoreProperties.load(rootProject.file("keystore.properties").inputStream())
signingConfigs.create("release") {
keyAlias = keystoreProperties["keyAlias"].toString()
keyPassword = keystoreProperties["keyPassword"].toString()
storeFile = rootProject.file(keystoreProperties["storeFile"].toString())
storePassword = keystoreProperties["storePassword"].toString()
}
} catch (ignored: Exception) {
signingConfigs["debug"]
}
buildTypes {
all {
signingConfig = releaseSigning
isPseudoLocalesEnabled = true
}
release {
isMinifyEnabled = true
proguardFiles("proguard-rules.pro")
}
create("play") {
applicationIdSuffix = ".play"
isMinifyEnabled = true
proguardFiles("proguard-rules.pro")
}
}
flavorDimensions += "product"
productFlavors {
create("app") {
dimension = "product"
resValue("string", "apps_name", "Lawnicons")
}
}
sourceSets.getByName("app") {
res.setSrcDirs(listOf("src/runtime/res"))
}
buildFeatures {
buildConfig = true
resValues = true
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
dependenciesInfo {
includeInApk = false
includeInBundle = false
}
applicationVariants.all {
outputs.all {
(this as? ApkVariantOutputImpl)?.outputFileName =
"Lawnicons $versionName v${versionCode}_${buildType.name}.apk"
}
}
}
androidComponents.onVariants { variant ->
val capName = variant.name.replaceFirstChar { it.titlecase(Locale.ROOT) }
val licenseeTask = tasks.named<LicenseeTask>("licenseeAndroid$capName")
val copyArtifactsTask = tasks.register<Copy>("copy${capName}Artifacts") {
dependsOn(licenseeTask)
from(licenseeTask.map { it.jsonOutput })
// Copy artifacts.json to a new directory.
into(layout.buildDirectory.dir("generated/dependencyAssets/${variant.name}"))
}
variant.sources.assets?.addGeneratedSourceDirectory(licenseeTask) {
// Avoid using LicenseeTask::outputDir as it contains extra files that we don't need.
objects.directoryProperty().fileProvider(copyArtifactsTask.map { it.destinationDir })
}
}
// Process SVGs before every build.
tasks.withType<MergeResources>().configureEach {
dependsOn(projects.svgProcessor.dependencyProject.tasks.named("run"))
}
composeCompiler {
stabilityConfigurationFile = layout.projectDirectory.file("compose_compiler_config.conf")
reportsDestination = layout.buildDirectory.dir("compose_build_reports")
}
licensee {
allow("Apache-2.0")
allow("MIT")
}
dependencies {
implementation("androidx.core:core-ktx:1.15.0")
implementation("androidx.core:core-splashscreen:1.0.1")
implementation("androidx.activity:activity-compose:1.10.0")
implementation(platform("androidx.compose:compose-bom:2025.02.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.ui:ui-util")
debugImplementation("androidx.compose.ui:ui-tooling")
implementation("androidx.compose.animation:animation")
implementation("androidx.compose.material:material-icons-core-android")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.material3:material3-window-size-class")
implementation("androidx.navigation:navigation-compose:2.8.7")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.7")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
val hiltVersion = "2.55"
implementation("com.google.dagger:hilt-android:$hiltVersion")
ksp("com.google.dagger:hilt-compiler:$hiltVersion")
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
val retrofitVersion = "2.11.0"
implementation("com.squareup.retrofit2:retrofit:$retrofitVersion")
implementation("com.squareup.retrofit2:converter-kotlinx-serialization:$retrofitVersion")
implementation("io.coil-kt:coil-compose:2.7.0")
implementation("com.github.nanihadesuka:LazyColumnScrollbar:2.2.0")
implementation("io.github.fornewid:material-motion-compose-core:1.2.1")
}