-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
201 lines (177 loc) · 6.56 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
201 lines (177 loc) · 6.56 KB
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
import java.text.SimpleDateFormat
import java.util.Date
apply(from = "../../gradle_include/compose.gradle")
apply(from = "../../gradle_include/circuit.gradle")
apply(from = "../../gradle_include/flipper.gradle")
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.googleServices)
alias(libs.plugins.kotlin.plugin.parcelize)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.kotlinKapt)
alias(libs.plugins.sentry)
alias(libs.plugins.compose.multiplatform)
}
android {
compileSdk = libs.versions.android.compileSdk.get().toInt()
ndkVersion = "27.0.12077973"
namespace = "io.newm"
testNamespace = "io.newm.test"
defaultConfig {
applicationId = "io.newm"
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = getCurrentDateTimeVersionCode()
versionName = getCustomVersionName(major = 1)
testInstrumentationRunner = "io.newm.NewmAndroidJUnitRunner"
testApplicationId = "io.newm.test"
}
lint { baseline = file("lint-baseline.xml") }
packaging {
resources {
merges += "META-INF/LICENSE.md"
merges += "META-INF/LICENSE-notice.md"
}
jniLibs { useLegacyPackaging = true }
}
buildTypes {
release {
isDebuggable = false
isMinifyEnabled = false
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
debug {
isDebuggable = true
isMinifyEnabled = false
isMinifyEnabled = false
}
}
flavorDimensions += "version"
productFlavors {
create("production") {
namespace = "io.newm"
applicationId = "io.newm"
dimension = "version"
}
create("development") {
namespace = "io.newm"
applicationId = "io.newm"
applicationIdSuffix = ".dev"
dimension = "version"
}
all {
resValue(
"string",
"account_type",
"$applicationId${applicationIdSuffix.orEmpty()}.account",
)
}
}
buildFeatures { buildConfig = true }
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
isCoreLibraryDesugaringEnabled = true
}
kapt { correctErrorTypes = true }
}
dependencies {
implementation(libs.process.phoenix)
coreLibraryDesugaring(libs.desugar.jdk.libs)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.constraintlayout)
implementation(libs.firebase.analytics)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.kotlinx.collections.immutable)
implementation(libs.circuit.retained)
implementation(compose.material)
implementation(compose.components.resources)
implementation(libs.androidx.media3.datasource)
implementation(libs.androidx.media3.exoplayer)
implementation(libs.androidx.media3.database)
implementation(libs.androidx.navigation.ui.ktx)
implementation(libs.launchdarkly.client)
implementation(libs.play.services.auth)
implementation(libs.recaptcha)
implementation(libs.androidx.core.splashscreen)
implementation(libs.koin.android)
implementation(libs.kotlin.reflect)
implementation(libs.cmp.image.pick.n.crop)
implementation(platform(libs.firebase.bom))
implementation(libs.androidx.material.icons.extended)
implementation(compose.components.resources)
implementation(project(Modules.BARCODE_SCANNER))
implementation(project(Modules.CORE_ANDROID_IMPLEMENTATIONS))
implementation(project(Modules.CORE_UI))
implementation(project(Modules.CORE_RESOURCES))
implementation(project(Modules.MUSIC_PLAYER))
implementation(project(Modules.SHARED))
implementation(project(Modules.SHARED_COMPOSE_FEATURES))
testImplementation(libs.junit)
testImplementation(libs.mockk)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.mockk.android)
}
kotlin { compilerOptions { jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11) } }
sentry {
org.set("project-newm")
projectName.set("android")
// this will upload your source code to Sentry to show it as part of the stack traces
// disable if you don't want to expose your sources
includeSourceContext.set(true)
telemetry.set(true)
}
/**
* Generates a version code based on the current date and time in the format `yyMMddHH`.
*
* The version code is an integer composed of:
* - `yy`: The last two digits of the current year.
* - `MM`: The current month.
* - `dd`: The current day of the month.
* - `HH`: The current hour (24-hour format).
*
* The function formats the current date and time using `SimpleDateFormat`, converts it into a
* string, and then parses it as an integer.
*
* @return An integer representing the current date and time in the format `yyMMddHH`.
*/
fun getCurrentDateTimeVersionCode(): Int {
val dateFormat = SimpleDateFormat("yyMMddHH")
return dateFormat.format(Date()).toInt()
}
/**
* Generates a custom version name based on the provided major version and the current date and
* time.
*
* The version name follows the format: `major.yyMMdd.HHmm`, where:
* - `major`: The major version number passed as a parameter.
* - `yy`: The current two-digit year.
* - `MMdd`: The current month and day.
* - `HH`: The current hour in 24-hour format.
* - `mm`: The current minute.
*
* The function retrieves the current date and time using `SimpleDateFormat` to format each
* component.
*
* Example output for `major = 1` on October 1st, 2024 at 13:45 would be: `1.241001.1345`.
*
* @param major The major version number to be used as the first part of the version name.
* @return A custom version name string in the format: `major.yyMMdd.HHmm`.
*/
fun getCustomVersionName(major: Int): String {
val yearFormat = SimpleDateFormat("yy")
val monthDayFormat = SimpleDateFormat("MMdd")
val hourFormat = SimpleDateFormat("HH")
val minuteFormat = SimpleDateFormat("mm")
val year = yearFormat.format(Date())
val monthDay = monthDayFormat.format(Date())
val hour = hourFormat.format(Date())
val minute = minuteFormat.format(Date())
return "$major.$year$monthDay.$hour$minute"
}