moving git versioning to the buildMeta abstraction
This commit is contained in:
parent
d42c27bfe0
commit
df02f505ad
|
@ -62,6 +62,7 @@ object Config {
|
||||||
const val HANDLE_CALL_ASSERTED_IDENTITY_EVENTS = false
|
const val HANDLE_CALL_ASSERTED_IDENTITY_EVENTS = false
|
||||||
|
|
||||||
const val LOW_PRIVACY_LOG_ENABLE = false
|
const val LOW_PRIVACY_LOG_ENABLE = false
|
||||||
|
const val ENABLE_STRICT_MODE_LOGS = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The analytics configuration to use for the Debug build type.
|
* The analytics configuration to use for the Debug build type.
|
||||||
|
|
|
@ -237,9 +237,6 @@ android {
|
||||||
resValue "string", "app_name", "Element dbg"
|
resValue "string", "app_name", "Element dbg"
|
||||||
resValue "color", "launcher_background", "#0DBD8B"
|
resValue "color", "launcher_background", "#0DBD8B"
|
||||||
|
|
||||||
// Set to true if you want to enable strict mode in debug
|
|
||||||
buildConfigField "boolean", "ENABLE_STRICT_MODE_LOGS", "false"
|
|
||||||
|
|
||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
|
|
||||||
if (project.hasProperty("coverage")) {
|
if (project.hasProperty("coverage")) {
|
||||||
|
@ -251,9 +248,6 @@ android {
|
||||||
resValue "string", "app_name", "Element"
|
resValue "string", "app_name", "Element"
|
||||||
resValue "color", "launcher_background", "#0DBD8B"
|
resValue "color", "launcher_background", "#0DBD8B"
|
||||||
|
|
||||||
buildConfigField "boolean", "ENABLE_STRICT_MODE_LOGS", "false"
|
|
||||||
|
|
||||||
// When updating this block, please also update the same block in the `nightly` buildType below
|
|
||||||
postprocessing {
|
postprocessing {
|
||||||
removeUnusedCode true
|
removeUnusedCode true
|
||||||
removeUnusedResources true
|
removeUnusedResources true
|
||||||
|
|
|
@ -198,7 +198,7 @@ class VectorApplication :
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun enableStrictModeIfNeeded() {
|
private fun enableStrictModeIfNeeded() {
|
||||||
if (BuildConfig.ENABLE_STRICT_MODE_LOGS) {
|
if (buildMeta.enableStrictModeLogs) {
|
||||||
StrictMode.setThreadPolicy(
|
StrictMode.setThreadPolicy(
|
||||||
StrictMode.ThreadPolicy.Builder()
|
StrictMode.ThreadPolicy.Builder()
|
||||||
.detectAll()
|
.detectAll()
|
||||||
|
|
|
@ -215,6 +215,12 @@ object VectorStaticModule {
|
||||||
sdkInt = Build.VERSION.SDK_INT,
|
sdkInt = Build.VERSION.SDK_INT,
|
||||||
applicationId = BuildConfig.APPLICATION_ID,
|
applicationId = BuildConfig.APPLICATION_ID,
|
||||||
lowPrivacyLoggingEnabled = Config.LOW_PRIVACY_LOG_ENABLE,
|
lowPrivacyLoggingEnabled = Config.LOW_PRIVACY_LOG_ENABLE,
|
||||||
|
enableStrictModeLogs = Config.ENABLE_STRICT_MODE_LOGS,
|
||||||
|
versionName = BuildConfig.VERSION_NAME,
|
||||||
|
gitRevision = BuildConfig.GIT_REVISION,
|
||||||
|
gitRevisionDate = BuildConfig.GIT_REVISION_DATE,
|
||||||
|
gitBranchName = BuildConfig.GIT_BRANCH_NAME,
|
||||||
|
buildNumber = BuildConfig.BUILD_NUMBER,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|
|
@ -21,4 +21,10 @@ data class BuildMeta(
|
||||||
val sdkInt: Int,
|
val sdkInt: Int,
|
||||||
val applicationId: String,
|
val applicationId: String,
|
||||||
val lowPrivacyLoggingEnabled: Boolean,
|
val lowPrivacyLoggingEnabled: Boolean,
|
||||||
|
val enableStrictModeLogs: Boolean,
|
||||||
|
val versionName: String,
|
||||||
|
val gitRevision: String,
|
||||||
|
val gitRevisionDate: String,
|
||||||
|
val gitBranchName: String,
|
||||||
|
val buildNumber: String,
|
||||||
)
|
)
|
||||||
|
|
|
@ -62,9 +62,9 @@ class LoginSplashFragment @Inject constructor(
|
||||||
if (buildMeta.isDebug || vectorPreferences.developerMode()) {
|
if (buildMeta.isDebug || vectorPreferences.developerMode()) {
|
||||||
views.loginSplashVersion.isVisible = true
|
views.loginSplashVersion.isVisible = true
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}\n" +
|
views.loginSplashVersion.text = "Version : ${buildMeta.versionName}\n" +
|
||||||
"Branch: ${BuildConfig.GIT_BRANCH_NAME}\n" +
|
"Branch: ${buildMeta.gitBranchName}\n" +
|
||||||
"Build: ${BuildConfig.BUILD_NUMBER}"
|
"Build: ${buildMeta.buildNumber}"
|
||||||
views.loginSplashVersion.debouncedClicks { navigator.openDebug(requireContext()) }
|
views.loginSplashVersion.debouncedClicks { navigator.openDebug(requireContext()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,9 @@ class LoginSplashSignUpSignInSelectionFragment2 @Inject constructor(
|
||||||
if (buildMeta.isDebug || vectorPreferences.developerMode()) {
|
if (buildMeta.isDebug || vectorPreferences.developerMode()) {
|
||||||
views.loginSplashVersion.isVisible = true
|
views.loginSplashVersion.isVisible = true
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}\n" +
|
views.loginSplashVersion.text = "Version : ${buildMeta.versionName}\n" +
|
||||||
"Branch: ${BuildConfig.GIT_BRANCH_NAME}\n" +
|
"Branch: ${buildMeta.gitBranchName}\n" +
|
||||||
"Build: ${BuildConfig.BUILD_NUMBER}"
|
"Build: ${buildMeta.buildNumber}"
|
||||||
views.loginSplashVersion.debouncedClicks { navigator.openDebug(requireContext()) }
|
views.loginSplashVersion.debouncedClicks { navigator.openDebug(requireContext()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,8 @@ class FtueAuthSplashCarouselFragment @Inject constructor(
|
||||||
if (buildMeta.isDebug || vectorPreferences.developerMode()) {
|
if (buildMeta.isDebug || vectorPreferences.developerMode()) {
|
||||||
views.loginSplashVersion.isVisible = true
|
views.loginSplashVersion.isVisible = true
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}#${BuildConfig.BUILD_NUMBER}\n" +
|
views.loginSplashVersion.text = "Version : ${buildMeta.versionName}#${buildMeta.buildNumber}\n" +
|
||||||
"Branch: ${BuildConfig.GIT_BRANCH_NAME}"
|
"Branch: ${buildMeta.gitBranchName}"
|
||||||
views.loginSplashVersion.debouncedClicks { navigator.openDebug(requireContext()) }
|
views.loginSplashVersion.debouncedClicks { navigator.openDebug(requireContext()) }
|
||||||
}
|
}
|
||||||
views.splashCarousel.registerAutomaticUntilInteractionTransitions()
|
views.splashCarousel.registerAutomaticUntilInteractionTransitions()
|
||||||
|
|
|
@ -64,9 +64,9 @@ class FtueAuthSplashFragment @Inject constructor(
|
||||||
if (buildMeta.isDebug || vectorPreferences.developerMode()) {
|
if (buildMeta.isDebug || vectorPreferences.developerMode()) {
|
||||||
views.loginSplashVersion.isVisible = true
|
views.loginSplashVersion.isVisible = true
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}\n" +
|
views.loginSplashVersion.text = "Version : ${buildMeta.versionName}\n" +
|
||||||
"Branch: ${BuildConfig.GIT_BRANCH_NAME}\n" +
|
"Branch: ${buildMeta.gitBranchName}\n" +
|
||||||
"Build: ${BuildConfig.BUILD_NUMBER}"
|
"Build: ${buildMeta.buildNumber}"
|
||||||
views.loginSplashVersion.debouncedClicks { navigator.openDebug(requireContext()) }
|
views.loginSplashVersion.debouncedClicks { navigator.openDebug(requireContext()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import im.vector.app.R
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
import im.vector.app.core.di.ActiveSessionHolder
|
||||||
import im.vector.app.core.extensions.getAllChildFragments
|
import im.vector.app.core.extensions.getAllChildFragments
|
||||||
import im.vector.app.core.extensions.toOnOff
|
import im.vector.app.core.extensions.toOnOff
|
||||||
|
import im.vector.app.core.resources.BuildMeta
|
||||||
import im.vector.app.features.settings.VectorLocale
|
import im.vector.app.features.settings.VectorLocale
|
||||||
import im.vector.app.features.settings.VectorPreferences
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
import im.vector.app.features.settings.devtools.GossipingEventsSerializer
|
import im.vector.app.features.settings.devtools.GossipingEventsSerializer
|
||||||
|
@ -74,7 +75,8 @@ class BugReporter @Inject constructor(
|
||||||
private val vectorPreferences: VectorPreferences,
|
private val vectorPreferences: VectorPreferences,
|
||||||
private val vectorFileLogger: VectorFileLogger,
|
private val vectorFileLogger: VectorFileLogger,
|
||||||
private val systemLocaleProvider: SystemLocaleProvider,
|
private val systemLocaleProvider: SystemLocaleProvider,
|
||||||
private val matrix: Matrix
|
private val matrix: Matrix,
|
||||||
|
private val buildMeta: BuildMeta,
|
||||||
) {
|
) {
|
||||||
var inMultiWindowMode = false
|
var inMultiWindowMode = false
|
||||||
|
|
||||||
|
@ -278,14 +280,14 @@ class BugReporter @Inject constructor(
|
||||||
.addFormDataPart("can_contact", canContact.toString())
|
.addFormDataPart("can_contact", canContact.toString())
|
||||||
.addFormDataPart("device_id", deviceId)
|
.addFormDataPart("device_id", deviceId)
|
||||||
.addFormDataPart("version", versionProvider.getVersion(longFormat = true, useBuildNumber = false))
|
.addFormDataPart("version", versionProvider.getVersion(longFormat = true, useBuildNumber = false))
|
||||||
.addFormDataPart("branch_name", BuildConfig.GIT_BRANCH_NAME)
|
.addFormDataPart("branch_name", buildMeta.gitBranchName)
|
||||||
.addFormDataPart("matrix_sdk_version", Matrix.getSdkVersion())
|
.addFormDataPart("matrix_sdk_version", Matrix.getSdkVersion())
|
||||||
.addFormDataPart("olm_version", olmVersion)
|
.addFormDataPart("olm_version", olmVersion)
|
||||||
.addFormDataPart("device", Build.MODEL.trim())
|
.addFormDataPart("device", Build.MODEL.trim())
|
||||||
.addFormDataPart("verbose_log", vectorPreferences.labAllowedExtendedLogging().toOnOff())
|
.addFormDataPart("verbose_log", vectorPreferences.labAllowedExtendedLogging().toOnOff())
|
||||||
.addFormDataPart("multi_window", inMultiWindowMode.toOnOff())
|
.addFormDataPart("multi_window", inMultiWindowMode.toOnOff())
|
||||||
.addFormDataPart(
|
.addFormDataPart(
|
||||||
"os", Build.VERSION.RELEASE + " (API " + Build.VERSION.SDK_INT + ") " +
|
"os", Build.VERSION.RELEASE + " (API " + buildMeta.sdkInt + ") " +
|
||||||
Build.VERSION.INCREMENTAL + "-" + Build.VERSION.CODENAME
|
Build.VERSION.INCREMENTAL + "-" + Build.VERSION.CODENAME
|
||||||
)
|
)
|
||||||
.addFormDataPart("locale", Locale.getDefault().toString())
|
.addFormDataPart("locale", Locale.getDefault().toString())
|
||||||
|
@ -299,7 +301,7 @@ class BugReporter @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val buildNumber = BuildConfig.BUILD_NUMBER
|
val buildNumber = buildMeta.buildNumber
|
||||||
if (buildNumber.isNotEmpty() && buildNumber != "0") {
|
if (buildNumber.isNotEmpty() && buildNumber != "0") {
|
||||||
builder.addFormDataPart("build_number", buildNumber)
|
builder.addFormDataPart("build_number", buildNumber)
|
||||||
}
|
}
|
||||||
|
@ -339,9 +341,9 @@ class BugReporter @Inject constructor(
|
||||||
screenshot = null
|
screenshot = null
|
||||||
|
|
||||||
// add some github labels
|
// add some github labels
|
||||||
builder.addFormDataPart("label", BuildConfig.VERSION_NAME)
|
builder.addFormDataPart("label", buildMeta.versionName)
|
||||||
builder.addFormDataPart("label", BuildConfig.FLAVOR_DESCRIPTION)
|
builder.addFormDataPart("label", BuildConfig.FLAVOR_DESCRIPTION)
|
||||||
builder.addFormDataPart("label", BuildConfig.GIT_BRANCH_NAME)
|
builder.addFormDataPart("label", buildMeta.gitBranchName)
|
||||||
|
|
||||||
// Special for Element
|
// Special for Element
|
||||||
builder.addFormDataPart("label", "[Element]")
|
builder.addFormDataPart("label", "[Element]")
|
||||||
|
|
|
@ -70,7 +70,7 @@ class VectorSettingsHelpAboutFragment @Inject constructor(
|
||||||
append(versionProvider.getVersion(longFormat = false, useBuildNumber = true))
|
append(versionProvider.getVersion(longFormat = false, useBuildNumber = true))
|
||||||
if (buildMeta.isDebug) {
|
if (buildMeta.isDebug) {
|
||||||
append(" ")
|
append(" ")
|
||||||
append(BuildConfig.GIT_BRANCH_NAME)
|
append(buildMeta.gitBranchName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,14 @@
|
||||||
package im.vector.app.features.version
|
package im.vector.app.features.version
|
||||||
|
|
||||||
import im.vector.app.BuildConfig
|
import im.vector.app.BuildConfig
|
||||||
|
import im.vector.app.core.resources.BuildMeta
|
||||||
import im.vector.app.core.resources.VersionCodeProvider
|
import im.vector.app.core.resources.VersionCodeProvider
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class VersionProvider @Inject constructor(private val versionCodeProvider: VersionCodeProvider) {
|
class VersionProvider @Inject constructor(
|
||||||
|
private val versionCodeProvider: VersionCodeProvider,
|
||||||
|
private val buildMeta: BuildMeta,
|
||||||
|
) {
|
||||||
|
|
||||||
fun getVersion(longFormat: Boolean, useBuildNumber: Boolean): String {
|
fun getVersion(longFormat: Boolean, useBuildNumber: Boolean): String {
|
||||||
var result = "${BuildConfig.VERSION_NAME} [${versionCodeProvider.getVersionCode()}]"
|
var result = "${BuildConfig.VERSION_NAME} [${versionCodeProvider.getVersionCode()}]"
|
||||||
|
@ -31,9 +35,9 @@ class VersionProvider @Inject constructor(private val versionCodeProvider: Versi
|
||||||
flavor += "-"
|
flavor += "-"
|
||||||
}
|
}
|
||||||
|
|
||||||
var gitVersion = BuildConfig.GIT_REVISION
|
var gitVersion = buildMeta.gitRevision
|
||||||
val gitRevisionDate = BuildConfig.GIT_REVISION_DATE
|
val gitRevisionDate = buildMeta.gitRevisionDate
|
||||||
val buildNumber = BuildConfig.BUILD_NUMBER
|
val buildNumber = buildMeta.buildNumber
|
||||||
|
|
||||||
var useLongFormat = longFormat
|
var useLongFormat = longFormat
|
||||||
|
|
||||||
|
|
|
@ -24,4 +24,10 @@ fun aBuildMeta() = BuildMeta(
|
||||||
sdkInt = Build.VERSION_CODES.O,
|
sdkInt = Build.VERSION_CODES.O,
|
||||||
applicationId = "im.vector",
|
applicationId = "im.vector",
|
||||||
lowPrivacyLoggingEnabled = false,
|
lowPrivacyLoggingEnabled = false,
|
||||||
|
enableStrictModeLogs = false,
|
||||||
|
versionName = "app-version-name",
|
||||||
|
gitRevision = "abcdef",
|
||||||
|
gitRevisionDate = "01-01-01",
|
||||||
|
gitBranchName = "a-branch-name",
|
||||||
|
buildNumber = "100",
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue