-
Notifications
You must be signed in to change notification settings - Fork 186
Expand file tree
/
Copy pathConfig.kt
More file actions
36 lines (32 loc) · 1.62 KB
/
Config.kt
File metadata and controls
36 lines (32 loc) · 1.62 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
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import org.gradle.api.Project
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
object Config {
// Synchronized build configuration for all modules
const val buildToolsVersion = "37.0.0"
const val compileSdkMajorVersion = 37
const val compileSdkMinorVersion = 0
const val minSdkVersion = 26
const val targetSdkVersion = 37
const val jvmTargetCompatibility = 17
@JvmStatic
fun generateDebugVersionName(): String {
val today = Date()
// Append the year (2 digits) and week in year (2 digits). This will make it easier to distinguish versions and
// identify ancient versions when debugging issues. However this will still keep the same version number during
// the week so that we do not end up with a lot of versions in tools like Sentry. As an extra this matches the
// sections we use in the changelog (weeks).
return SimpleDateFormat("1.0.yyww", Locale.US).format(today)
}
@JvmStatic
fun releaseVersionName(project: Project): String {
// This function is called in the configuration phase, before gradle knows which variants we'll use.
// So, validation that "versionName" has been set happens elsewhere (at time of writing, we staple
// validation to tasks of type "AppPreBuildTask"
return if (project.hasProperty("versionName")) project.property("versionName") as String else ""
}
}