Restore branch and git sha, to use it in logs and in rageshakes.
Remove quite useless `gitRevisionDate`.
This commit is contained in:
@@ -20,6 +20,8 @@ import com.android.build.api.variant.FilterConfiguration.FilterType.ABI
|
|||||||
import extension.allFeaturesImpl
|
import extension.allFeaturesImpl
|
||||||
import extension.allLibrariesImpl
|
import extension.allLibrariesImpl
|
||||||
import extension.allServicesImpl
|
import extension.allServicesImpl
|
||||||
|
import extension.gitBranchName
|
||||||
|
import extension.gitRevision
|
||||||
import extension.koverDependencies
|
import extension.koverDependencies
|
||||||
import extension.setupKover
|
import extension.setupKover
|
||||||
import org.jetbrains.kotlin.cli.common.toBooleanLenient
|
import org.jetbrains.kotlin.cli.common.toBooleanLenient
|
||||||
@@ -54,6 +56,9 @@ android {
|
|||||||
abiFilters += listOf("armeabi-v7a", "x86", "arm64-v8a", "x86_64")
|
abiFilters += listOf("armeabi-v7a", "x86", "arm64-v8a", "x86_64")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildConfigField("String", "GIT_REVISION", "\"${gitRevision()}\"")
|
||||||
|
buildConfigField("String", "GIT_BRANCH_NAME", "\"${gitBranchName()}\"")
|
||||||
|
|
||||||
// Ref: https://developer.android.com/studio/build/configure-apk-splits.html#configure-abi-split
|
// Ref: https://developer.android.com/studio/build/configure-apk-splits.html#configure-abi-split
|
||||||
splits {
|
splits {
|
||||||
// Configures multiple APKs based on ABI.
|
// Configures multiple APKs based on ABI.
|
||||||
|
|||||||
@@ -85,12 +85,8 @@ object AppModule {
|
|||||||
lowPrivacyLoggingEnabled = false,
|
lowPrivacyLoggingEnabled = false,
|
||||||
versionName = BuildConfig.VERSION_NAME,
|
versionName = BuildConfig.VERSION_NAME,
|
||||||
versionCode = BuildConfig.VERSION_CODE,
|
versionCode = BuildConfig.VERSION_CODE,
|
||||||
// BuildConfig.GIT_REVISION,
|
gitRevision = BuildConfig.GIT_REVISION,
|
||||||
gitRevision = "TODO",
|
gitBranchName = BuildConfig.GIT_BRANCH_NAME,
|
||||||
// BuildConfig.GIT_REVISION_DATE,
|
|
||||||
gitRevisionDate = "TODO",
|
|
||||||
// BuildConfig.GIT_BRANCH_NAME,
|
|
||||||
gitBranchName = "TODO",
|
|
||||||
flavorDescription = BuildConfig.FLAVOR_DESCRIPTION,
|
flavorDescription = BuildConfig.FLAVOR_DESCRIPTION,
|
||||||
flavorShortDescription = BuildConfig.SHORT_FLAVOR_DESCRIPTION,
|
flavorShortDescription = BuildConfig.SHORT_FLAVOR_DESCRIPTION,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ fun logApplicationInfo() {
|
|||||||
Timber.d("----------------------------------------------------------------")
|
Timber.d("----------------------------------------------------------------")
|
||||||
Timber.d("----------------------------------------------------------------")
|
Timber.d("----------------------------------------------------------------")
|
||||||
Timber.d(" Application version: $appVersion")
|
Timber.d(" Application version: $appVersion")
|
||||||
|
Timber.d(" Git SHA: ${BuildConfig.GIT_REVISION}")
|
||||||
Timber.d(" SDK version: $sdkVersion")
|
Timber.d(" SDK version: $sdkVersion")
|
||||||
Timber.d(" Local time: $date")
|
Timber.d(" Local time: $date")
|
||||||
Timber.d("----------------------------------------------------------------")
|
Timber.d("----------------------------------------------------------------")
|
||||||
|
|||||||
@@ -200,6 +200,8 @@ class DefaultBugReporter @Inject constructor(
|
|||||||
// add some github labels
|
// add some github labels
|
||||||
builder.addFormDataPart("label", buildMeta.versionName)
|
builder.addFormDataPart("label", buildMeta.versionName)
|
||||||
builder.addFormDataPart("label", buildMeta.flavorDescription)
|
builder.addFormDataPart("label", buildMeta.flavorDescription)
|
||||||
|
builder.addFormDataPart("branch_name", buildMeta.gitBranchName)
|
||||||
|
|
||||||
if (crashCallStack.isNotEmpty() && withCrashLogs) {
|
if (crashCallStack.isNotEmpty() && withCrashLogs) {
|
||||||
builder.addFormDataPart("label", "crash")
|
builder.addFormDataPart("label", "crash")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ data class BuildMeta(
|
|||||||
val versionName: String,
|
val versionName: String,
|
||||||
val versionCode: Int,
|
val versionCode: Int,
|
||||||
val gitRevision: String,
|
val gitRevision: String,
|
||||||
val gitRevisionDate: String,
|
|
||||||
val gitBranchName: String,
|
val gitBranchName: String,
|
||||||
val flavorDescription: String,
|
val flavorDescription: String,
|
||||||
val flavorShortDescription: String,
|
val flavorShortDescription: String,
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ fun aBuildMeta(
|
|||||||
versionName: String = "",
|
versionName: String = "",
|
||||||
versionCode: Int = 0,
|
versionCode: Int = 0,
|
||||||
gitRevision: String = "",
|
gitRevision: String = "",
|
||||||
gitRevisionDate: String = "",
|
|
||||||
gitBranchName: String = "",
|
gitBranchName: String = "",
|
||||||
flavorDescription: String = "",
|
flavorDescription: String = "",
|
||||||
flavorShortDescription: String = "",
|
flavorShortDescription: String = "",
|
||||||
@@ -41,7 +40,6 @@ fun aBuildMeta(
|
|||||||
versionName,
|
versionName,
|
||||||
versionCode,
|
versionCode,
|
||||||
gitRevision,
|
gitRevision,
|
||||||
gitRevisionDate,
|
|
||||||
gitBranchName,
|
gitBranchName,
|
||||||
flavorDescription,
|
flavorDescription,
|
||||||
flavorShortDescription
|
flavorShortDescription
|
||||||
|
|||||||
40
plugins/src/main/kotlin/extension/Utils.kt
Normal file
40
plugins/src/main/kotlin/extension/Utils.kt
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package extension
|
||||||
|
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
private fun Project.runCommand(cmd: String): String {
|
||||||
|
val outputStream = ByteArrayOutputStream()
|
||||||
|
val errorStream = ByteArrayOutputStream()
|
||||||
|
project.exec {
|
||||||
|
commandLine = cmd.split(" ")
|
||||||
|
standardOutput = outputStream
|
||||||
|
errorOutput = errorStream
|
||||||
|
}
|
||||||
|
if (errorStream.size() > 0) {
|
||||||
|
println("Error while running command: $cmd")
|
||||||
|
throw IOException(String(errorStream.toByteArray()))
|
||||||
|
}
|
||||||
|
return String(outputStream.toByteArray()).trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.gitRevision() = runCommand("git rev-parse --short=8 HEAD")
|
||||||
|
|
||||||
|
fun Project.gitBranchName() = runCommand("git rev-parse --abbrev-ref HEAD")
|
||||||
@@ -37,12 +37,8 @@ object Singleton {
|
|||||||
lowPrivacyLoggingEnabled = false,
|
lowPrivacyLoggingEnabled = false,
|
||||||
versionName = "0.1.0",
|
versionName = "0.1.0",
|
||||||
versionCode = 1,
|
versionCode = 1,
|
||||||
// BuildConfig.GIT_REVISION,
|
gitRevision = "",
|
||||||
gitRevision = "TODO",
|
gitBranchName = "",
|
||||||
// BuildConfig.GIT_REVISION_DATE,
|
|
||||||
gitRevisionDate = "TODO",
|
|
||||||
// BuildConfig.GIT_BRANCH_NAME,
|
|
||||||
gitBranchName = "TODO",
|
|
||||||
flavorDescription = "NA",
|
flavorDescription = "NA",
|
||||||
flavorShortDescription = "NA",
|
flavorShortDescription = "NA",
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user