1
0
Fork 0
fenix/buildSrc/src/main/java/Config.kt

38 lines
1.5 KiB
Kotlin
Raw Normal View History

import java.text.SimpleDateFormat
2019-02-13 19:58:07 +01:00
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.util.Date
import java.util.Locale
/* 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/. */
object Config {
const val versionCode = 1
const val versionName = "1.0"
// Synchronized build configuration for all modules
const val compileSdkVersion = 28
const val minSdkVersion = 21
const val targetSdkVersion = 28
@JvmStatic
fun generateVersionSuffix(): 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(".yyww", Locale.US).format(today)
}
2019-02-13 19:58:07 +01:00
@JvmStatic
fun generateBuildDate(): String {
val dateTime = LocalDateTime.now()
val timeFormatter = DateTimeFormatter.ofPattern("h:mm a")
return "${dateTime.dayOfWeek.toString().toLowerCase().capitalize()} ${dateTime.monthValue}/${dateTime.dayOfMonth} @ ${timeFormatter.format(dateTime)}"
}
}