Updated on 2026-08-14
This commit is contained in:
parent
ec9bd02e35
commit
5863b5af2a
112 changed files with 919 additions and 282 deletions
|
|
@ -71,12 +71,15 @@ private fun AndroidBuildType.configureBuildVariant(appExtension: AppExtension, b
|
|||
when (buildType) {
|
||||
BuildType.Release -> {
|
||||
isDebuggable = false
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(appExtension.getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
|
||||
}
|
||||
BuildType.Debug -> {
|
||||
isDebuggable = true
|
||||
isMinifyEnabled = false
|
||||
}
|
||||
BuildType.DebugPG -> {
|
||||
// build is not debuggable to let R8 make optimizations
|
||||
// otherwise, only shrinking will be applied
|
||||
matchingFallbacks.add(BuildType.Debug.id)
|
||||
signingConfig = appExtension.signingConfigs.getByName(BuildType.Debug.id)
|
||||
}
|
||||
BuildType.Internal,
|
||||
BuildType.External,
|
||||
|
|
@ -95,6 +98,9 @@ private fun AndroidBuildType.configureBuildVariant(appExtension: AppExtension, b
|
|||
|
||||
versionNameSuffix = buildType.versionSuffix?.let { "-$it" }
|
||||
applicationIdSuffix = buildType.appIdSuffix?.let { ".$it" }
|
||||
isMinifyEnabled = buildType.obfuscating
|
||||
isShrinkResources = buildType.obfuscating
|
||||
proguardFiles("proguard-rules.pro", appExtension.getDefaultProguardFile("proguard-android.txt"))
|
||||
}
|
||||
|
||||
private fun AppExtension.configurePackagingOptions() {
|
||||
|
|
@ -104,6 +110,7 @@ private fun AppExtension.configurePackagingOptions() {
|
|||
excludes += "lib/x86_64/freebsd/libscrypt.so"
|
||||
excludes += "lib/x86_64/linux/libscrypt.so"
|
||||
excludes += "META-INF/gradle/incremental.annotation.processors"
|
||||
pickFirsts += "google/protobuf/*"
|
||||
|
||||
merges += "paymentrequest.proto"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.tangem.plugin.configuration.configurations.extension
|
||||
|
||||
import com.android.build.gradle.internal.plugins.AppPlugin
|
||||
import com.android.build.gradle.internal.plugins.LibraryPlugin
|
||||
import com.tangem.plugin.configuration.model.BuildType
|
||||
import org.gradle.api.Project
|
||||
|
||||
fun Project.kaptForObfuscatingVariants(dependencyNotation: Any) {
|
||||
plugins.all {
|
||||
when (this) {
|
||||
is AppPlugin -> {
|
||||
BuildType.values().filter { it.obfuscating }.forEach {
|
||||
dependencies.add(it.createKaptConfiguration(), dependencyNotation)
|
||||
}
|
||||
}
|
||||
is LibraryPlugin -> {
|
||||
BuildType.values().filter { it.obfuscating }.forEach {
|
||||
dependencies.add(it.createKaptConfiguration(), dependencyNotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun BuildType.createKaptConfiguration() = "kapt" + name.replaceFirstChar(Char::titlecase)
|
||||
|
|
@ -45,6 +45,7 @@ private fun LibraryExtension.configurePackagingOptions() {
|
|||
excludes += "lib/x86_64/freebsd/libscrypt.so"
|
||||
excludes += "lib/x86_64/linux/libscrypt.so"
|
||||
excludes += "META-INF/gradle/incremental.annotation.processors"
|
||||
pickFirsts += "google/protobuf/*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ internal enum class BuildType(
|
|||
val id: String,
|
||||
val appIdSuffix: String? = null,
|
||||
val versionSuffix: String? = null,
|
||||
val obfuscating: Boolean = false,
|
||||
val configFields: List<BuildConfigField>,
|
||||
) {
|
||||
|
||||
|
|
@ -31,6 +32,19 @@ internal enum class BuildType(
|
|||
),
|
||||
),
|
||||
|
||||
DebugPG(
|
||||
id = "debugPG",
|
||||
appIdSuffix = "debug",
|
||||
obfuscating = true,
|
||||
configFields = listOf(
|
||||
BuildConfigField.Environment(value = "dev"),
|
||||
BuildConfigField.TestActionEnabled(isEnabled = true),
|
||||
BuildConfigField.LogEnabled(isEnabled = true),
|
||||
BuildConfigField.TesterMenuAvailability(isEnabled = true),
|
||||
BuildConfigField.MockDataSource(isEnabled = false),
|
||||
),
|
||||
),
|
||||
|
||||
/**
|
||||
* Build type for QA and business
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue