Change certificat configuration for debug

This commit is contained in:
Thomas Andres Gomez 2023-08-10 08:50:32 +02:00
parent d09b16ee33
commit de0fc464a4
5 changed files with 34 additions and 29 deletions

View file

@ -1,5 +1,3 @@
import com.android.build.gradle.internal.dsl.SigningConfig
plugins { plugins {
id("com.android.application") id("com.android.application")
id("org.jetbrains.kotlin.android") id("org.jetbrains.kotlin.android")
@ -14,11 +12,17 @@ android {
compileSdk = 33 compileSdk = 33
signingConfigs { signingConfigs {
getByName("debug") {
storeFile = file("../debug.keystore")
storePassword = "123456"
keyAlias = "debug"
keyPassword = "123456"
}
create("pixelized") { create("pixelized") {
storeFile = file(project.properties["PIXELIZED_RELEASE_STORE_FILE"] as String) storeFile = (project.properties["PIXELIZED_RELEASE_STORE_FILE"] as? String)?.let { file(it) }
storePassword = project.properties["PIXELIZED_RELEASE_STORE_PASSWORD"] as String storePassword = project.properties["PIXELIZED_RELEASE_STORE_PASSWORD"] as? String
keyAlias = project.properties["PIXELIZED_RELEASE_KEY_ALIAS"] as String keyAlias = project.properties["PIXELIZED_RELEASE_KEY_ALIAS"] as? String
keyPassword = project.properties["PIXELIZED_RELEASE_KEY_PASSWORD"] as String keyPassword = project.properties["PIXELIZED_RELEASE_KEY_PASSWORD"] as? String
} }
} }
@ -36,19 +40,19 @@ android {
} }
buildTypes { buildTypes {
release {
isDebuggable = false
isMinifyEnabled = true
signingConfig = signingConfigs.pixelized
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
}
debug { debug {
applicationIdSuffix = ".dev" applicationIdSuffix = ".dev"
isDebuggable = true isDebuggable = true
isMinifyEnabled = false isMinifyEnabled = false
signingConfig = signingConfigs.pixelized signingConfig = signingConfigs.getByName("debug")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
}
release {
isDebuggable = false
isMinifyEnabled = true
signingConfig = signingConfigs.getByName("pixelized")
proguardFiles( proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
) )
@ -126,13 +130,12 @@ dependencies {
kapt("com.github.bumptech.glide:compiler:4.14.2") // this have to be align with landscapist-glide kapt("com.github.bumptech.glide:compiler:4.14.2") // this have to be align with landscapist-glide
} }
private val NamedDomainObjectContainer<SigningConfig>.pixelized get() = this.getByName("pixelized") val gitBuildNumber: Int
get() {
val gitBuildNumber: Int get() { val stdout = org.apache.commons.io.output.ByteArrayOutputStream()
val stdout = org.apache.commons.io.output.ByteArrayOutputStream() rootProject.exec {
rootProject.exec { commandLine("git", "rev-list", "--count", "HEAD")
commandLine("git", "rev-list", "--count", "HEAD") standardOutput = stdout
standardOutput = stdout }
} return stdout.toString().trim().toInt()
return stdout.toString().trim().toInt() }
}

View file

@ -55,7 +55,7 @@
"client_type": 1, "client_type": 1,
"android_info": { "android_info": {
"package_name": "com.pixelized.rplexicon.dev", "package_name": "com.pixelized.rplexicon.dev",
"certificate_hash": "39ee1766d2225263052d4a4e82182d1c3e886f35" "certificate_hash": "b5bd860f1f89de118613c3e94b3f6c8cbd6d876a"
} }
}, },
{ {

View file

@ -387,7 +387,7 @@ private fun AuthenticationScreenContentPreview() {
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.padding(all = 16.dp), .padding(all = 16.dp),
version = VersionViewModel.Version(R.string.app_name, "0.0.0", "0"), version = VersionViewModel.Version(R.string.app_name, "0.0.0", "0", true),
onGoogleSignIn = { }, onGoogleSignIn = { },
) )
} }

View file

@ -16,7 +16,8 @@ class VersionViewModel @Inject constructor() : ViewModel() {
val version = Version( val version = Version(
appName = R.string.app_name, appName = R.string.app_name,
version = BuildConfig.VERSION_NAME, version = BuildConfig.VERSION_NAME,
code = BuildConfig.VERSION_CODE.toString() code = BuildConfig.VERSION_CODE.toString(),
debug = BuildConfig.DEBUG,
) )
@Stable @Stable
@ -24,11 +25,12 @@ class VersionViewModel @Inject constructor() : ViewModel() {
@StringRes val appName: Int, @StringRes val appName: Int,
val version: String, val version: String,
val code: String, val code: String,
val debug: Boolean,
) { ) {
@Composable @Composable
@Stable @Stable
fun toText(): String { fun toText(): String {
return "${stringResource(id = appName)} ${version}.${code}" return "${stringResource(id = appName)}${if (debug) "-dev" else ""} ${version}.${code}"
} }
} }
} }

BIN
debug.keystore Normal file

Binary file not shown.