For #21084: put git hash on About screen in release builds.

upstream-sync
Michael Comella 3 years ago committed by mergify[bot]
parent 117b35a771
commit c026d8b28a

@ -42,6 +42,7 @@ android {
testInstrumentationRunnerArguments clearPackageData: 'true'
resValue "bool", "IS_DEBUG", "false"
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "false"
buildConfigField "String", "GIT_HASH", "\"\"" // see override in release builds for why it's blank.
// This should be the "public" base URL of AMO.
buildConfigField "String", "AMO_BASE_URL", "\"https://addons.mozilla.org\""
buildConfigField "String", "AMO_COLLECTION_NAME", "\"7dfae8669acc4312a65e8ba5553036\""
@ -82,6 +83,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
matchingFallbacks = ['release'] // Use on the "release" build type in dependencies (AARs)
// Changing the build config can cause files that depend on BuildConfig.java to recompile
// so we only set the git hash in release builds to avoid possible recompilation in debug builds.
buildConfigField "String", "GIT_HASH", "\"${Config.getGitHash()}\""
if (gradle.hasProperty("localProperties.autosignReleaseWithDebugKey")) {
signingConfig signingConfigs.debug
}
@ -227,6 +232,7 @@ android {
composeOptions {
kotlinCompilerExtensionVersion = Versions.androidx_compose
}
}
// -------------------------------------------------------------------------------------------------

@ -98,6 +98,7 @@ class AboutFragment : Fragment(), AboutPageListener {
val packageInfo =
requireContext().packageManager.getPackageInfo(requireContext().packageName, 0)
val versionCode = PackageInfoCompat.getLongVersionCode(packageInfo).toString()
val maybeFenixGitHash = if (BuildConfig.GIT_HASH.isNotBlank()) ", ${BuildConfig.GIT_HASH}" else ""
val componentsAbbreviation = getString(R.string.components_abbreviation)
val componentsVersion =
mozilla.components.Build.version + ", " + mozilla.components.Build.gitHash
@ -108,9 +109,10 @@ class AboutFragment : Fragment(), AboutPageListener {
val appServicesVersion = mozilla.components.Build.applicationServicesVersion
String.format(
"%s (Build #%s)\n%s: %s\n%s: %s\n%s: %s",
"%s (Build #%s)%s\n%s: %s\n%s: %s\n%s: %s",
packageInfo.versionName,
versionCode,
maybeFenixGitHash,
componentsAbbreviation,
componentsVersion,
maybeGecko,

@ -59,7 +59,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/about_content"
app:layout_constraintWidth_percent="0.8"
tools:text="1.0.x (Build #x)\nAC: 1.0.0\nGV: 69.x-x\nAS: 1.0.0" />
tools:text="1.0.x (Build #x), 0d7383fd2\nAC: 1.0.0, 96ae23b628\nGV: 69.x-x\nAS: 1.0.0" />
<TextView
android:id="@+id/build_date"

Loading…
Cancel
Save