mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 19:04:38 -06:00
[App] Move buildTimestamp to manifest to improve build performance.
This commit is contained in:
parent
ea2974bfae
commit
582e2059d8
@ -18,8 +18,10 @@ android {
|
||||
versionName release.versionName
|
||||
|
||||
buildConfigField "java.util.Map<String, String>", "GIT_INFO", gitInfoMap
|
||||
buildConfigField "long", "BUILD_TIMESTAMP", String.valueOf(System.currentTimeMillis())
|
||||
buildConfigField "String", "VERSION_BASE", "\"${release.versionName}\""
|
||||
manifestPlaceholders = [
|
||||
buildTimestamp: String.valueOf(System.currentTimeMillis())
|
||||
]
|
||||
|
||||
multiDexEnabled = true
|
||||
|
||||
|
@ -29,6 +29,8 @@
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<meta-data android:name="buildTimestamp" android:value="${buildTimestamp}" />
|
||||
|
||||
<!-- __ __ _ _ _ _ _
|
||||
| \/ | (_) /\ | | (_) (_) |
|
||||
| \ / | __ _ _ _ __ / \ ___| |_ ___ ___| |_ _ _
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
package pl.szczodrzynski.edziennik.utils.managers
|
||||
|
||||
import android.content.pm.PackageManager
|
||||
import android.text.TextUtils
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
@ -26,12 +27,18 @@ class BuildManager(val app: App) : CoroutineScope {
|
||||
|
||||
val buildFlavor = BuildConfig.FLAVOR
|
||||
val buildType = BuildConfig.BUILD_TYPE
|
||||
val buildTimestamp = BuildConfig.BUILD_TIMESTAMP
|
||||
val isRelease = !BuildConfig.DEBUG
|
||||
val isDebug = BuildConfig.DEBUG
|
||||
val isNightly = BuildConfig.VERSION_NAME.contains("nightly")
|
||||
val isDaily = BuildConfig.VERSION_NAME.contains("daily")
|
||||
|
||||
val buildTimestamp: Long
|
||||
get() {
|
||||
val info = app.packageManager.getApplicationInfo(app.packageName, PackageManager.GET_META_DATA)
|
||||
val metadata = info.metaData
|
||||
return metadata?.getFloat("buildTimestamp")?.toLong() ?: 0
|
||||
}
|
||||
|
||||
val gitHash = BuildConfig.GIT_INFO["hash"]
|
||||
val gitVersion = BuildConfig.GIT_INFO["version"]
|
||||
val gitBranch = BuildConfig.GIT_INFO["branch"]
|
||||
|
Loading…
Reference in New Issue
Block a user