From 6b377e0e08c614b5c7b9b0c86a21236e359bce0c Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 7 Mar 2023 17:09:56 +0300 Subject: [PATCH 1/5] Updated on 2026-08-14 --- app/src/debug/res/values-ru/strings.xml | 2 +- app/src/debug_beta/res/values-ru/strings.xml | 2 +- app/src/debug_beta/res/values/strings.xml | 2 +- .../main/res/xml/network_security_config.xml | 2 - buildSrc/src/main/java/ConfigFieldBuilder.kt | 36 ---- gradle/dependencies.toml | 201 ++++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 12 +- plugins/configuration/.gitignore | 1 + plugins/configuration/build.gradle.kts | 27 +++ .../configuration}/detekt.yml | 0 plugins/configuration/settings.gradle.kts | 7 + .../configuration/ConfigurationPlugin.kt | 30 +++ .../configurations/DetektConfigurations.kt | 52 +++++ .../configurations/KotlinConfigurations.kt | 16 ++ .../configurations/ProjectConfigurations.kt | 8 + .../extension/AppExtensionConfigurations.kt | 94 ++++++++ .../extension/BaseExtensionConfigurations.kt | 33 +++ .../LibraryExtensionConfigurations.kt | 49 +++++ .../plugin/configuration/model}/AppConfig.kt | 4 +- .../configuration/model/BuildConfigField.kt | 35 +++ .../plugin/configuration/model/BuildType.kt | 72 +++++++ .../utils/BuildConfigFieldFactory.kt | 14 ++ .../utils/VersionCatalogsUtils.kt | 28 +++ settings.gradle.kts | 2 + 24 files changed, 681 insertions(+), 48 deletions(-) delete mode 100644 buildSrc/src/main/java/ConfigFieldBuilder.kt create mode 100644 gradle/dependencies.toml create mode 100644 plugins/configuration/.gitignore create mode 100644 plugins/configuration/build.gradle.kts rename {config/detekt => plugins/configuration}/detekt.yml (100%) create mode 100644 plugins/configuration/settings.gradle.kts create mode 100644 plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/ConfigurationPlugin.kt create mode 100644 plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/DetektConfigurations.kt create mode 100644 plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/KotlinConfigurations.kt create mode 100644 plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/ProjectConfigurations.kt create mode 100644 plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/AppExtensionConfigurations.kt create mode 100644 plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/BaseExtensionConfigurations.kt create mode 100644 plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/LibraryExtensionConfigurations.kt rename {buildSrc/src/main/java => plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model}/AppConfig.kt (75%) create mode 100644 plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/BuildConfigField.kt create mode 100644 plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/BuildType.kt create mode 100644 plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/utils/BuildConfigFieldFactory.kt create mode 100644 plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/utils/VersionCatalogsUtils.kt diff --git a/app/src/debug/res/values-ru/strings.xml b/app/src/debug/res/values-ru/strings.xml index 682b552975..878fbcbef1 100644 --- a/app/src/debug/res/values-ru/strings.xml +++ b/app/src/debug/res/values-ru/strings.xml @@ -3,4 +3,4 @@ DebugTangem - \ No newline at end of file + diff --git a/app/src/debug_beta/res/values-ru/strings.xml b/app/src/debug_beta/res/values-ru/strings.xml index 3ae149049f..7fd995cb02 100644 --- a/app/src/debug_beta/res/values-ru/strings.xml +++ b/app/src/debug_beta/res/values-ru/strings.xml @@ -3,4 +3,4 @@ BetaTangem - \ No newline at end of file + diff --git a/app/src/debug_beta/res/values/strings.xml b/app/src/debug_beta/res/values/strings.xml index 3ae149049f..7fd995cb02 100644 --- a/app/src/debug_beta/res/values/strings.xml +++ b/app/src/debug_beta/res/values/strings.xml @@ -3,4 +3,4 @@ BetaTangem - \ No newline at end of file + diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml index d5f3e649d4..c0b6c9cc13 100644 --- a/app/src/main/res/xml/network_security_config.xml +++ b/app/src/main/res/xml/network_security_config.xml @@ -1,6 +1,5 @@ - @@ -17,5 +16,4 @@ - diff --git a/buildSrc/src/main/java/ConfigFieldBuilder.kt b/buildSrc/src/main/java/ConfigFieldBuilder.kt deleted file mode 100644 index 596ae047d6..0000000000 --- a/buildSrc/src/main/java/ConfigFieldBuilder.kt +++ /dev/null @@ -1,36 +0,0 @@ -typealias ConfigFieldBuilder = (String, String, String) -> Unit - -class BuildConfigFieldFactory( - private val fields: List, - private val builder: ConfigFieldBuilder, -) { - fun create() { - fields.forEach { field -> builder(field.type, field.name, field.value) } - } -} - -/** - * Build config field - * - * @property type field type - * @property name field name - * @property value field value - */ -sealed class Field(val type: String, val name: String, val value: String) { - - class Environment(value: String) : Field(type = "String", name = "ENVIRONMENT", value = "\"$value\"") - - class TestActionEnabled(isEnabled: Boolean) : Field( - type = "Boolean", - name = "TEST_ACTION_ENABLED", - value = isEnabled.toString(), - ) - - class LogEnabled(isEnabled: Boolean) : Field(type = "Boolean", name = "LOG_ENABLED", value = isEnabled.toString()) - - class TesterMenuAvailability(isEnabled: Boolean) : Field( - type = "Boolean", - name = "TESTER_MENU_ENABLED", - value = isEnabled.toString(), - ) -} \ No newline at end of file diff --git a/gradle/dependencies.toml b/gradle/dependencies.toml new file mode 100644 index 0000000000..8e68824663 --- /dev/null +++ b/gradle/dependencies.toml @@ -0,0 +1,201 @@ +# docs https://docs.gradle.org/current/userguide/platforms.html +# TODO: update versions refs https://tangem.atlassian.net/browse/AND-3195 + +[versions] +# region Classpath +androidGradlePlugin = "7.4.2" +firebaseCrashlytics = "2.9.4" +googleServices = "4.3.10" +kotlin = "1.8.10" +# endregion Classpath + +# region AndroidX +androidxActivityCompose = "1.5.0" +androidxAppCompat = "1.5.1" +androidxBrowser = "1.4.0" +androidxConstraintLayout = "2.1.4" +androidxCore = "1.9.0" +androidxFragment = "1.5.3" +androidxLifecycle = "2.5.1" +# endregion AndroidX + +# region Compose +compose-compiler = "1.4.3" +compose-runtime = "1.3.3" +compose-foundation = "1.3.1" +compose-material = "1.3.1" +compose-constraint = "1.0.1" +compose-navigation = "2.5.3" +compose-accompanist = "0.28.0" +# endregion Compose + +# region Other libraries +amplitude = "2.36.1" +appsflyer = "6.5.1" +armadillo = "0.9.0" +coil = "2.1.0" +compose-shimmer = "1.0.3" +coroutine = "1.5.2" +desugarJdkLibs = "1.1.5" +firebase = "26.0.0" +googleMaterialComponent = "1.6.1" +googlePlayCore = "1.10.3" +googlePlayCoreKtx = "1.8.1" +googlePlayServicesWallet = "19.1.0" +hilt = "2.44" +hilt-navigation = "1.0.0" +jodatime = "2.12.1" +krateSharedPref = "2.0.0" +kotsonGsonExt = "2.5.0" +lottie = "3.4.0" +moshi = "1.12.0" +okhttp = "4.9.3" +otaliastudiosCameraView = "2.6.3" +rekotlin = "1.0.4" +retrofit = "2.8.1" +retrofitMoshiConverter = "2.6.0" +shopifyBuySdk = "12.0.0" +spongycastleCryptoCore = "1.58.0.0" +timber = "4.7.1" +viewBindingDelegate = "1.5.6" +xmlShimmer = "1.1.3" +zendeskChat = "3.3.5" +zendeskMessaging = "5.2.4" +zxingQrBarcodeScanner = "1.9.8" +zxingQrCode = "3.3.3" +mviCore = "1.3.1" +kotlinSerialization = "1.4.1" +# endregion Other libraries + +# region Tangem +tangemBlockchainSdk = "develop-174" +# tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds + +tangemCardSdk = "develop-200" +# tangemCardSgk = "0.0.1" # Keep it! - used for local builds +# endregion Tangem + +# region Tools +detektComposeRules = "1.2.2" +detekt = "1.21.0" +# endregion Tools + +# region Testing +espresso = "3.4.0" +junit = "4.13.2" +truth = "1.1.3" +junitAndroidExt = "1.1.3" +# endregion Testing + +[plugins] +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } +android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } +firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashlytics" } +google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" } +hilt-android = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } +detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } + +[libraries] +# region Classpath +# Used for plugins +gradle-android = { module = "com.android.tools.build:gradle", version.ref = "androidGradlePlugin" } +gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +gradle-detekt = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" } +gradle-firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics-gradle", version.ref = "firebaseCrashlytics" } +# end region Classpath + +# region AndroidX +androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidxActivityCompose" } +androidx-appCompat = { module = "androidx.appcompat:appcompat", version.ref = "androidxAppCompat" } +androidx-browser = { module = "androidx.browser:browser", version.ref = "androidxBrowser" } +androidx-constraintLayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "androidxConstraintLayout" } +androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidxCore" } +androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "androidxFragment" } +lifecycle-common-java8 = { module = "androidx.lifecycle:lifecycle-common-java8", version.ref = "androidxLifecycle" } +lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidxLifecycle" } +lifecycle-viewModel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidxLifecycle" } +# region AndroidX + +# region Compose +compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose-runtime" } +compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose-runtime" } +compose-animation = { module = "androidx.compose.animation:animation", version.ref = "compose-runtime" } +compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose-foundation" } +compose-material = { module = "androidx.compose.material:material", version.ref = "compose-material" } +compose-constraintLayout = { module = "androidx.constraintlayout:constraintlayout-compose", version.ref = "compose-constraint" } +compose-shimmer = { module = "com.valentinilk.shimmer:compose-shimmer", version.ref = "compose-shimmer" } +compose-coil = { module = "io.coil-kt:coil-compose", version.ref = "coil" } +compose-navigation = { module = "androidx.navigation:navigation-compose", version.ref = "compose-navigation" } +compose-navigation-hilt = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hilt-navigation" } +compose-accompanist-appCompatTheme = { module = "com.google.accompanist:accompanist-appcompat-theme", version.ref = "compose-accompanist" } +compose-accompanist-systemUiController = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "compose-accompanist" } +compose-accompanist-webView = { module = "com.google.accompanist:accompanist-webview", version.ref = "compose-accompanist" } +# endregion Compose + +# region Firebase +firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebase" } +firebase-analytics = { module = "com.google.firebase:firebase-analytics-ktx" } +firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics-ktx" } +# endregion Firebase + +# region Tangem +tangem-blockchain = { module = "com.tangem:blockchain", version.ref = "tangemBlockchainSdk" } +tangem-card-android = { module = "com.tangem.tangem-sdk-kotlin:android", version.ref = "tangemCardSdk" } +tangem-card-core = { module = "com.tangem.tangem-sdk-kotlin:core", version.ref = "tangemCardSdk" } +# endregion Tangem + +# region Detekt +detekt-compose = { module = "ru.kode:detekt-rules-compose", version.ref = "detektComposeRules" } +detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" } +# ndregion Detekt + +# region Test +test-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso" } +test-junit = { module = "junit:junit", version.ref = "junit" } +test-junit-android = { module = "androidx.test.ext:junit", version.ref = "junitAndroidExt" } +test-truth = { module = "com.google.truth:truth", version.ref = "truth" } +# endregion Test + +# region Other +amplitude = { module = "com.amplitude:android-sdk", version.ref = "amplitude" } +appsflyer = { module = "com.appsflyer:af-android-sdk", version.ref = "appsflyer" } +armadillo = { module = "at.favre.lib:armadillo", version.ref = "armadillo" } +coil = { module = "io.coil-kt:coil", version.ref = "coil" } +kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutine" } +desugar = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugarJdkLibs" } +googlePlay-core = { module = "com.google.android.play:core", version.ref = "googlePlayCore" } +googlePlay-core-ktx = { module = "com.google.android.play:core-ktx", version.ref = "googlePlayCoreKtx" } +googlePlay-services-wallet = { module = "com.google.android.gms:play-services-wallet", version.ref = "googlePlayServicesWallet" } +hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" } +hilt-core = { module = "com.google.dagger:hilt-core", version.ref = "hilt" } +hilt-kapt = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" } +hilt-navigation = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" } +jodatime = { module = "joda-time:joda-time", version.ref = "jodatime" } +krateSharedPref = { module = "hu.autsoft:krate", version.ref = "krateSharedPref" } +kotsonGson = { module = "com.github.salomonbrys.kotson:kotson", version.ref = "kotsonGsonExt" } +lottie = { module = "com.airbnb.android:lottie", version.ref = "lottie" } +material = { module = "com.google.android.material:material", version.ref = "googleMaterialComponent" } +moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" } +moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshi" } +okHttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } +okHttp-logging = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" } +otaliastudiosCameraView = { module = "com.otaliastudios:cameraview", version.ref = "otaliastudiosCameraView" } +shopify-buy = { module = "com.shopify.mobilebuysdk:buy3", version.ref = "shopifyBuySdk" } +spongecastle-core = { module = "com.madgag.spongycastle:core", version.ref = "spongycastleCryptoCore" } +reKotlin = { module = "org.rekotlin:rekotlin", version.ref = "rekotlin" } +retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } +retrofit-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofitMoshiConverter" } +timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } +viewBindingDelegate = { module = "com.github.kirich1409:viewbindingpropertydelegate-noreflection", version.ref = "viewBindingDelegate" } +xmlShimmer = { module = "com.github.skydoves:androidveil", version.ref = "xmlShimmer" } +zendesk-chat = { module = "com.zendesk:chat", version.ref = "zendeskChat" } +zendesk-messaging = { module = "com.zendesk:messaging", version.ref = "zendeskMessaging" } +zxing-qrBarcodeScanner = { module = "me.dm7.barcodescanner:zxing", version.ref = "zxingQrBarcodeScanner" } +zxing-qrCore = { module = "com.google.zxing:core", version.ref = "zxingQrCode" } +mviCore-watcher = { module = "com.github.badoo.mvicore:mvicore-diff", version.ref = "mviCore" } +kotlin-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinSerialization" } +# endregion Other diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9ee3ffb21f..ddde06c17d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Oct 21 13:51:19 MSK 2020 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +#Tue Mar 07 14:45:01 MSK 2023 +distributionBase = GRADLE_USER_HOME +distributionUrl = https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip +distributionPath = wrapper/dists +zipStorePath = wrapper/dists +zipStoreBase = GRADLE_USER_HOME diff --git a/plugins/configuration/.gitignore b/plugins/configuration/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/plugins/configuration/.gitignore @@ -0,0 +1 @@ +/build diff --git a/plugins/configuration/build.gradle.kts b/plugins/configuration/build.gradle.kts new file mode 100644 index 0000000000..c2ab7a0a54 --- /dev/null +++ b/plugins/configuration/build.gradle.kts @@ -0,0 +1,27 @@ +plugins { + `kotlin-dsl` + `java-gradle-plugin` +} + +repositories { + google() + mavenCentral() +} + +configure { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 +} + +dependencies { + implementation(deps.gradle.kotlin) + implementation(deps.gradle.android) + implementation(deps.gradle.detekt) +} + +gradlePlugin { + plugins.register("configuration") { + id = "configuration" + implementationClass = "com.tangem.plugin.configuration.ConfigurationPlugin" + } +} \ No newline at end of file diff --git a/config/detekt/detekt.yml b/plugins/configuration/detekt.yml similarity index 100% rename from config/detekt/detekt.yml rename to plugins/configuration/detekt.yml diff --git a/plugins/configuration/settings.gradle.kts b/plugins/configuration/settings.gradle.kts new file mode 100644 index 0000000000..0ed5a2e04b --- /dev/null +++ b/plugins/configuration/settings.gradle.kts @@ -0,0 +1,7 @@ +dependencyResolutionManagement { + versionCatalogs { + create("deps") { + from(files("../../gradle/dependencies.toml")) + } + } +} \ No newline at end of file diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/ConfigurationPlugin.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/ConfigurationPlugin.kt new file mode 100644 index 0000000000..53b9d53e1c --- /dev/null +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/ConfigurationPlugin.kt @@ -0,0 +1,30 @@ +package com.tangem.plugin.configuration + +import com.android.build.gradle.AppExtension +import com.android.build.gradle.LibraryExtension +import com.android.build.gradle.internal.plugins.AppPlugin +import com.android.build.gradle.internal.plugins.LibraryPlugin +import com.tangem.plugin.configuration.configurations.configure +import com.tangem.plugin.configuration.configurations.extension.configure +import org.gradle.api.Action +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure + +class ConfigurationPlugin : Plugin { + override fun apply(target: Project) { + target.plugins.all(startConfigurationAction(project = target)) + } + + private fun startConfigurationAction(project: Project) = Action> { + project.configure() + when (this) { + is AppPlugin -> { + project.configure { configure(project) } + } + is LibraryPlugin -> { + project.configure { configure(project) } + } + } + } +} \ No newline at end of file diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/DetektConfigurations.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/DetektConfigurations.kt new file mode 100644 index 0000000000..1bcf190ab5 --- /dev/null +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/DetektConfigurations.kt @@ -0,0 +1,52 @@ +package com.tangem.plugin.configuration.configurations + +import com.tangem.plugin.configuration.utils.findLibrary +import com.tangem.plugin.configuration.utils.findPlugin +import io.gitlab.arturbosch.detekt.CONFIGURATION_DETEKT +import io.gitlab.arturbosch.detekt.CONFIGURATION_DETEKT_PLUGINS +import io.gitlab.arturbosch.detekt.Detekt +import io.gitlab.arturbosch.detekt.extensions.DetektExtension +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.withType + +internal fun Project.configureDetektRules() { + plugins.apply(findPlugin(alias = CONFIGURATION_DETEKT).pluginId) + extensions.configure { configure(project) } + configureDetektPlugins() + configureDetektTask() +} + +private fun DetektExtension.configure(project: Project) { + parallel = true + ignoreFailures = false + autoCorrect = true + buildUponDefaultConfig = true + config.setFrom(project.rootProject.files("plugins/configuration/detekt.yml")) +} + +private fun Project.configureDetektPlugins() { + listOf( + findLibrary(alias = "detekt-formatting"), + findLibrary(alias = "detekt-compose"), + ).forEach { + dependencies.add(CONFIGURATION_DETEKT_PLUGINS, it) + } +} + +private fun Project.configureDetektTask() { + tasks.withType { + include("**/*.kt") + exclude("**/resources/**", "**/build/**") + reports { + sarif { + required.set(false) + } + txt { + required.set(true) + } + } + + jvmTarget = "11" + } +} \ No newline at end of file diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/KotlinConfigurations.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/KotlinConfigurations.kt new file mode 100644 index 0000000000..9d10cad98d --- /dev/null +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/KotlinConfigurations.kt @@ -0,0 +1,16 @@ +package com.tangem.plugin.configuration.configurations + +import org.gradle.api.Project +import org.gradle.kotlin.dsl.withType +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +internal fun Project.configureKotlinCompilerOptions() { + project.tasks.withType { + kotlinOptions { + jvmTarget = "11" + allWarningsAsErrors = false + // this is required to produce a unique META-INF/*.kotlin_module files + moduleName = project.path.removePrefix(":").replace(':', '-') + } + } +} \ No newline at end of file diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/ProjectConfigurations.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/ProjectConfigurations.kt new file mode 100644 index 0000000000..644b1eaead --- /dev/null +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/ProjectConfigurations.kt @@ -0,0 +1,8 @@ +package com.tangem.plugin.configuration.configurations + +import org.gradle.api.Project + +internal fun Project.configure() { + configureKotlinCompilerOptions() + configureDetektRules() +} \ No newline at end of file diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/AppExtensionConfigurations.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/AppExtensionConfigurations.kt new file mode 100644 index 0000000000..3817da1027 --- /dev/null +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/AppExtensionConfigurations.kt @@ -0,0 +1,94 @@ +package com.tangem.plugin.configuration.configurations.extension + +import com.android.build.gradle.AppExtension +import com.tangem.plugin.configuration.model.AppConfig +import com.tangem.plugin.configuration.model.BuildType +import com.tangem.plugin.configuration.utils.BuildConfigFieldFactory +import org.gradle.api.Project +import com.android.build.gradle.internal.dsl.BuildType as AndroidBuildType + +internal fun AppExtension.configure(project: Project) { + configureCompileSdk() + configureDefaultConfig(project) + configureBuildFeatures() + configureBuildTypes() + configurePackagingOptions() + configureCompose(project) + configureCompilerOptions() +} + +private fun AppExtension.configureDefaultConfig(project: Project) { + defaultConfig { + applicationId = AppConfig.packageName + minSdk = AppConfig.minSdkVersion + targetSdk = AppConfig.targetSdkVersion + + versionCode = if (project.hasProperty("versionCode")) { + (project.property("versionCode") as String).toInt() + } else { + AppConfig.versionCode + } + + versionName = if (project.hasProperty("versionName")) { + project.property("versionName") as String + } else { + AppConfig.versionName + } + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } +} + +// TODO: [REDACTED_JIRA] +private fun AppExtension.configureBuildFeatures() { + buildFeatures.apply { + viewBinding = true + } +} + +private fun AppExtension.configureBuildTypes() { + buildTypes { + BuildType.values().forEach { buildVariant -> + maybeCreate(buildVariant.id).apply { + configureBuildVariant(extension = this@configureBuildTypes, buildVariant) + + BuildConfigFieldFactory( + fields = buildVariant.configFields, + builder = ::buildConfigField, + ).create() + } + } + } +} + +private fun AndroidBuildType.configureBuildVariant(extension: AppExtension, buildType: BuildType) { + when (buildType) { + BuildType.Release -> { + isDebuggable = false + isMinifyEnabled = false + proguardFiles(extension.getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") + } + BuildType.Debug -> { + isDebuggable = true + isMinifyEnabled = false + } + BuildType.External -> { + initWith(extension.buildTypes.getByName(BuildType.Release.id)) + signingConfig = extension.signingConfigs.getByName(BuildType.Debug.id) + } + } + + versionNameSuffix = buildType.versionSuffix?.let { "-$it" } + applicationIdSuffix = buildType.appIdSuffix?.let { ".$it" } +} + +private fun AppExtension.configurePackagingOptions() { + packagingOptions { + resources { + excludes += "lib/x86_64/darwin/libscrypt.dylib" + excludes += "lib/x86_64/freebsd/libscrypt.so" + excludes += "lib/x86_64/linux/libscrypt.so" + excludes += "META-INF/gradle/incremental.annotation.processors" + } + } +} \ No newline at end of file diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/BaseExtensionConfigurations.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/BaseExtensionConfigurations.kt new file mode 100644 index 0000000000..5d0b3a45e4 --- /dev/null +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/BaseExtensionConfigurations.kt @@ -0,0 +1,33 @@ +package com.tangem.plugin.configuration.configurations.extension + +import com.android.build.gradle.BaseExtension +import com.tangem.plugin.configuration.model.AppConfig +import com.tangem.plugin.configuration.utils.findVersion +import org.gradle.api.JavaVersion +import org.gradle.api.Project + +internal fun BaseExtension.configureCompileSdk() { + compileSdkVersion(AppConfig.compileSdkVersion) +} + +internal fun BaseExtension.configureCompilerOptions() { + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } +} + +internal fun BaseExtension.configureCompose(project: Project) { + val useCompose = with(project.path) { + contains(":ui") || + contains(":presentation") || + contains(":app") || // TODO: [REDACTED_JIRA] + contains(":tester:impl") // TODO: Rename module + } + buildFeatures.compose = useCompose + if (useCompose) { + composeOptions { + kotlinCompilerExtensionVersion = project.findVersion(alias = "compose-compiler").requiredVersion + } + } +} \ No newline at end of file diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/LibraryExtensionConfigurations.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/LibraryExtensionConfigurations.kt new file mode 100644 index 0000000000..bc18afa9b9 --- /dev/null +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/LibraryExtensionConfigurations.kt @@ -0,0 +1,49 @@ +package com.tangem.plugin.configuration.configurations.extension + +import com.android.build.gradle.LibraryExtension +import com.tangem.plugin.configuration.model.AppConfig +import com.tangem.plugin.configuration.model.BuildType +import com.tangem.plugin.configuration.utils.BuildConfigFieldFactory +import org.gradle.api.Project + +internal fun LibraryExtension.configure(project: Project) { + configureCompileSdk() + configureDefaultConfig() + configureBuildTypes() + configurePackagingOptions() + configureCompose(project) + configureCompilerOptions() +} + +private fun LibraryExtension.configureDefaultConfig() { + defaultConfig { + minSdk = AppConfig.minSdkVersion + vectorDrawables { + useSupportLibrary = true + } + } +} + +private fun LibraryExtension.configureBuildTypes() { + buildTypes { + BuildType.values().forEach { buildVariant -> + maybeCreate(buildVariant.id).apply { + BuildConfigFieldFactory( + fields = buildVariant.configFields, + builder = ::buildConfigField, + ).create() + } + } + } +} + +private fun LibraryExtension.configurePackagingOptions() { + packagingOptions { + resources { + excludes += "lib/x86_64/darwin/libscrypt.dylib" + excludes += "lib/x86_64/freebsd/libscrypt.so" + excludes += "lib/x86_64/linux/libscrypt.so" + excludes += "META-INF/gradle/incremental.annotation.processors" + } + } +} \ No newline at end of file diff --git a/buildSrc/src/main/java/AppConfig.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/AppConfig.kt similarity index 75% rename from buildSrc/src/main/java/AppConfig.kt rename to plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/AppConfig.kt index 5c966326f1..7f12be0c15 100644 --- a/buildSrc/src/main/java/AppConfig.kt +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/AppConfig.kt @@ -1,4 +1,6 @@ -object AppConfig { +package com.tangem.plugin.configuration.model + +internal object AppConfig { const val packageName = "com.tangem.wallet" const val versionCode = 1 const val versionName = "1.0.0-SNAPSHOT" diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/BuildConfigField.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/BuildConfigField.kt new file mode 100644 index 0000000000..66437a1de5 --- /dev/null +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/BuildConfigField.kt @@ -0,0 +1,35 @@ +package com.tangem.plugin.configuration.model + +/** + * Build config field + * + * @property type field type + * @property name field name + * @property value field value + */ +internal sealed class BuildConfigField(val type: String, val name: String, val value: String) { + + class Environment(value: String) : BuildConfigField( + type = "String", + name = "ENVIRONMENT", + value = "\"$value\"", + ) + + class TestActionEnabled(isEnabled: Boolean) : BuildConfigField( + type = "Boolean", + name = "TEST_ACTION_ENABLED", + value = isEnabled.toString(), + ) + + class LogEnabled(isEnabled: Boolean) : BuildConfigField( + type = "Boolean", + name = "LOG_ENABLED", + value = isEnabled.toString(), + ) + + class TesterMenuAvailability(isEnabled: Boolean) : BuildConfigField( + type = "Boolean", + name = "TESTER_MENU_ENABLED", + value = isEnabled.toString(), + ) +} \ No newline at end of file diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/BuildType.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/BuildType.kt new file mode 100644 index 0000000000..16aa46325d --- /dev/null +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/BuildType.kt @@ -0,0 +1,72 @@ +package com.tangem.plugin.configuration.model + +internal enum class BuildType( + val id: String, + val appIdSuffix: String? = null, + val versionSuffix: String? = null, + val configFields: List, +) { + + /** + * Production ready build type for clients + * + * Features: + * - Env: prod + * - Signing config: release + * - Proguard + * */ + Release( + id = "release", + configFields = listOf( + BuildConfigField.Environment(value = "prod"), + BuildConfigField.TestActionEnabled(isEnabled = false), + BuildConfigField.LogEnabled(isEnabled = false), + BuildConfigField.TesterMenuAvailability(isEnabled = false), + ), + ), + + /** + * Build type for developers + * + * Features: + * - Env: dev + * - Signing config: debug + * - Debuggable + * - Logs + * - Tester menu + * - Test action + * - Traffic sniffing + * */ + Debug( + id = "debug", + appIdSuffix = "dev", + configFields = listOf( + BuildConfigField.Environment(value = "dev"), + BuildConfigField.TestActionEnabled(isEnabled = true), + BuildConfigField.LogEnabled(isEnabled = true), + BuildConfigField.TesterMenuAvailability(isEnabled = true), + ), + ), + + /** + * Build type for QA and business + * + * Features: + * - Env: prod + * - Signing config: debug + * - Tester menu + * - Test action + * - Proguard + * */ + External( + id = "debug_beta", + appIdSuffix = "debug", + versionSuffix = "debug", + configFields = listOf( + BuildConfigField.Environment(value = "prod"), + BuildConfigField.TestActionEnabled(isEnabled = true), + BuildConfigField.LogEnabled(isEnabled = false), + BuildConfigField.TesterMenuAvailability(isEnabled = true), + ), + ), +} \ No newline at end of file diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/utils/BuildConfigFieldFactory.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/utils/BuildConfigFieldFactory.kt new file mode 100644 index 0000000000..66485abb14 --- /dev/null +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/utils/BuildConfigFieldFactory.kt @@ -0,0 +1,14 @@ +package com.tangem.plugin.configuration.utils + +import com.tangem.plugin.configuration.model.BuildConfigField + +private typealias ConfigFieldBuilder = (String, String, String) -> Unit + +internal class BuildConfigFieldFactory( + private val fields: List, + private val builder: ConfigFieldBuilder, +) { + fun create() { + fields.forEach { field -> builder(field.type, field.name, field.value) } + } +} \ No newline at end of file diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/utils/VersionCatalogsUtils.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/utils/VersionCatalogsUtils.kt new file mode 100644 index 0000000000..78cb30e988 --- /dev/null +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/utils/VersionCatalogsUtils.kt @@ -0,0 +1,28 @@ +package com.tangem.plugin.configuration.utils + +import org.gradle.api.Project +import org.gradle.api.artifacts.MinimalExternalModuleDependency +import org.gradle.api.artifacts.VersionCatalog +import org.gradle.api.artifacts.VersionCatalogsExtension +import org.gradle.api.artifacts.VersionConstraint +import org.gradle.kotlin.dsl.getByType +import org.gradle.plugin.use.PluginDependency +import kotlin.jvm.optionals.getOrNull + +private val Project.depsVersionCatalog: VersionCatalog + get() = extensions.getByType().named("deps") + +internal fun Project.findVersion(alias: String): VersionConstraint { + return depsVersionCatalog.findVersion(alias).getOrNull() + ?: error("Unable to find version $alias") +} + +internal fun Project.findPlugin(alias: String): PluginDependency { + return depsVersionCatalog.findPlugin(alias).getOrNull()?.orNull + ?: error("Unable to find plugin $alias") +} + +internal fun Project.findLibrary(alias: String): MinimalExternalModuleDependency { + return depsVersionCatalog.findLibrary(alias).getOrNull()?.orNull + ?: error("Unable to find library $alias") +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 8083954d2b..0c89d3ea9f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,6 +2,8 @@ include(":app") include(":domain") include(":common") +includeBuild("includedBuild/configuration") + // region Core modules include(":core:analytics") include(":core:datasource") From 58bbe85f2987c79eddb9760a2983d7473a5402ec Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 7 Mar 2023 17:25:38 +0300 Subject: [PATCH 2/5] Updated on 2026-08-14 --- app/build.gradle.kts | 106 +----------------- common/build.gradle.kts | 9 +- core/analytics/build.gradle.kts | 33 +----- core/datasource/build.gradle.kts | 33 +----- core/featuretoggles/build.gradle.kts | 47 +------- core/res/build.gradle.kts | 32 +----- core/ui/build.gradle.kts | 41 +------ core/utils/build.gradle.kts | 9 +- domain/build.gradle.kts | 68 +---------- features/referral/data/build.gradle.kts | 34 +----- features/referral/domain/build.gradle.kts | 9 +- .../referral/presentation/build.gradle.kts | 42 +------ features/swap/data/build.gradle.kts | 34 +----- features/swap/domain/build.gradle.kts | 9 +- features/swap/presentation/build.gradle.kts | 43 +------ features/tester/impl/build.gradle.kts | 58 +--------- libs/auth/build.gradle.kts | 34 +----- libs/crypto/build.gradle.kts | 9 +- 18 files changed, 23 insertions(+), 627 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8214555305..899e3cf11f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -6,111 +6,7 @@ plugins { id("com.google.gms.google-services") id("com.google.firebase.crashlytics") id("com.google.dagger.hilt.android") -} - -android { - compileSdk = AppConfig.compileSdkVersion - - defaultConfig { - applicationId = AppConfig.packageName - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - - versionCode = if (project.hasProperty("versionCode")) { - (project.property("versionCode") as String).toInt() - } else { - AppConfig.versionCode - } - - versionName = if (project.hasProperty("versionName")) { - project.property("versionName") as String - } else { - AppConfig.versionName - } - - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } - - buildFeatures { - compose = true - viewBinding = true - } - - buildTypes { - release { - isDebuggable = false - isMinifyEnabled = false - proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") - - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("prod"), - Field.TestActionEnabled(false), - Field.LogEnabled(false), - Field.TesterMenuAvailability(false), - ), - builder = ::buildConfigField, - ).create() - } - - debug { - isDebuggable = true - isMinifyEnabled = false - applicationIdSuffix = ".dev" - - configure { - // disable mapping file uploads (default=true if minifying) - mappingFileUploadEnabled = false - } - - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("dev"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - Field.TesterMenuAvailability(true), - ), - builder = ::buildConfigField, - ).create() - } - - create("debug_beta") { - initWith(getByName("release")) - versionNameSuffix = "-beta" - applicationIdSuffix = ".debug" - signingConfig = signingConfigs.getByName("debug") - BuildConfigFieldFactory( - fields = listOf(Field.TesterMenuAvailability(true)), - builder = ::buildConfigField, - ).create() - } - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - isCoreLibraryDesugaringEnabled = false - } - - composeOptions { - kotlinCompilerExtensionVersion = Versions.compose - } - - packagingOptions { - resources.excludes += "lib/x86_64/darwin/libscrypt.dylib" - resources.excludes += "lib/x86_64/freebsd/libscrypt.so" - resources.excludes += "lib/x86_64/linux/libscrypt.so" - resources.excludes += "META-INF/gradle/incremental.annotation.processors" - } -} - -repositories { - mavenCentral() - maven(url = "https://jitpack.io") + id("configuration") } dependencies { diff --git a/common/build.gradle.kts b/common/build.gradle.kts index e8259cee84..19e39fb7b0 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -1,9 +1,4 @@ plugins { - id("java-library") - id("org.jetbrains.kotlin.jvm") -} - -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + kotlin("jvm") + id("configuration") } \ No newline at end of file diff --git a/core/analytics/build.gradle.kts b/core/analytics/build.gradle.kts index 639fbbc622..a3d80803f6 100644 --- a/core/analytics/build.gradle.kts +++ b/core/analytics/build.gradle.kts @@ -3,38 +3,7 @@ plugins { kotlin("android") kotlin("kapt") id("com.google.dagger.hilt.android") -} - -android { - defaultConfig { - compileSdk = AppConfig.compileSdkVersion - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - isCoreLibraryDesugaringEnabled = false - } - - buildTypes { - create("debug_beta") { - initWith(getByName("release")) - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("release"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - ), - builder = ::buildConfigField, - ).create() - } - } + id("configuration") } dependencies { diff --git a/core/datasource/build.gradle.kts b/core/datasource/build.gradle.kts index 1199f1f518..31f92aa978 100644 --- a/core/datasource/build.gradle.kts +++ b/core/datasource/build.gradle.kts @@ -3,38 +3,7 @@ plugins { kotlin("android") kotlin("kapt") id("com.google.dagger.hilt.android") -} - -android { - defaultConfig { - compileSdk = AppConfig.compileSdkVersion - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - isCoreLibraryDesugaringEnabled = false - } - - buildTypes { - create("debug_beta") { - initWith(getByName("release")) - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("release"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - ), - builder = ::buildConfigField, - ).create() - } - } + id("configuration") } dependencies { diff --git a/core/featuretoggles/build.gradle.kts b/core/featuretoggles/build.gradle.kts index 84a19a537f..4c74fed994 100644 --- a/core/featuretoggles/build.gradle.kts +++ b/core/featuretoggles/build.gradle.kts @@ -3,52 +3,7 @@ plugins { kotlin("android") kotlin("kapt") id("com.google.dagger.hilt.android") -} - -android { - defaultConfig { - compileSdk = AppConfig.compileSdkVersion - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - buildTypes { - release { - BuildConfigFieldFactory( - fields = listOf(Field.TesterMenuAvailability(false)), - builder = ::buildConfigField, - ).create() - } - - debug { - BuildConfigFieldFactory( - fields = listOf(Field.TesterMenuAvailability(true)), - builder = ::buildConfigField, - ).create() - } - - create("debug_beta") { - initWith(getByName("release")) - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("release"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - Field.TesterMenuAvailability(true), - ), - builder = ::buildConfigField, - ).create() - } - } + id("configuration") } dependencies { diff --git a/core/res/build.gradle.kts b/core/res/build.gradle.kts index 77151f2a46..f5ba6275ef 100644 --- a/core/res/build.gradle.kts +++ b/core/res/build.gradle.kts @@ -1,35 +1,5 @@ plugins { id("com.android.library") kotlin("android") -} - -android { - defaultConfig { - compileSdk = AppConfig.compileSdkVersion - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - buildTypes { - create("debug_beta") { - initWith(getByName("release")) - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("release"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - ), - builder = ::buildConfigField, - ).create() - } - } + id("configuration") } \ No newline at end of file diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts index 28792f7aa2..1269207e14 100644 --- a/core/ui/build.gradle.kts +++ b/core/ui/build.gradle.kts @@ -1,46 +1,7 @@ plugins { id("com.android.library") kotlin("android") -} - -android { - defaultConfig { - compileSdk = AppConfig.compileSdkVersion - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - isCoreLibraryDesugaringEnabled = false - } - - buildFeatures { - compose = true - } - - composeOptions { - kotlinCompilerExtensionVersion = Versions.compose - } - - buildTypes { - create("debug_beta") { - initWith(getByName("release")) - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("release"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - ), - builder = ::buildConfigField, - ).create() - } - } + id("configuration") } dependencies { diff --git a/core/utils/build.gradle.kts b/core/utils/build.gradle.kts index 9f88778542..89f4727b11 100644 --- a/core/utils/build.gradle.kts +++ b/core/utils/build.gradle.kts @@ -1,7 +1,7 @@ plugins { - id("java-library") - id("org.jetbrains.kotlin.jvm") + kotlin("jvm") kotlin("kapt") + id("configuration") } dependencies { @@ -12,9 +12,4 @@ dependencies { /** Coroutines */ implementation(Library.coroutine) -} - -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 } \ No newline at end of file diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts index 33ffebc8ed..849ed95c03 100644 --- a/domain/build.gradle.kts +++ b/domain/build.gradle.kts @@ -1,73 +1,7 @@ plugins { id("com.android.library") id("org.jetbrains.kotlin.android") -} - -android { - compileSdk = AppConfig.compileSdkVersion - - defaultConfig { - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - isMinifyEnabled = false - proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") - - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("prod"), - Field.TestActionEnabled(false), - Field.LogEnabled(false), - ), - builder = ::buildConfigField, - ).create() - } - - debug { - isMinifyEnabled = false - - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("prod"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - ), - builder = ::buildConfigField, - ).create() - } - - create("debug_beta") { - initWith(getByName("release")) - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("release"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - ), - builder = ::buildConfigField, - ).create() - } - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - packagingOptions { - resources.excludes += "lib/x86_64/darwin/libscrypt.dylib" - resources.excludes += "lib/x86_64/freebsd/libscrypt.so" - resources.excludes += "lib/x86_64/linux/libscrypt.so" - } + id("configuration") } dependencies { diff --git a/features/referral/data/build.gradle.kts b/features/referral/data/build.gradle.kts index 510d84817c..78aa72d048 100644 --- a/features/referral/data/build.gradle.kts +++ b/features/referral/data/build.gradle.kts @@ -3,39 +3,7 @@ plugins { kotlin("android") kotlin("kapt") id("com.google.dagger.hilt.android") -} - -android { - - defaultConfig { - compileSdk = AppConfig.compileSdkVersion - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - isCoreLibraryDesugaringEnabled = false - } - - buildTypes { - create("debug_beta") { - initWith(getByName("release")) - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("release"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - ), - builder = ::buildConfigField, - ).create() - } - } + id("configuration") } dependencies { diff --git a/features/referral/domain/build.gradle.kts b/features/referral/domain/build.gradle.kts index fe5dace957..78f29434fe 100644 --- a/features/referral/domain/build.gradle.kts +++ b/features/referral/domain/build.gradle.kts @@ -1,7 +1,7 @@ plugins { - id("java-library") - id("org.jetbrains.kotlin.jvm") + kotlin("jvm") kotlin("kapt") + id("configuration") } dependencies { @@ -16,9 +16,4 @@ dependencies { /** DI */ implementation(Library.hiltCore) kapt(Library.hiltKapt) -} - -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 } \ No newline at end of file diff --git a/features/referral/presentation/build.gradle.kts b/features/referral/presentation/build.gradle.kts index 7096e631c0..db43d24e47 100644 --- a/features/referral/presentation/build.gradle.kts +++ b/features/referral/presentation/build.gradle.kts @@ -3,47 +3,7 @@ plugins { kotlin("android") kotlin("kapt") id("com.google.dagger.hilt.android") -} - -android { - - defaultConfig { - compileSdk = AppConfig.compileSdkVersion - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - isCoreLibraryDesugaringEnabled = false - } - - buildFeatures { - compose = true - } - - composeOptions { - kotlinCompilerExtensionVersion = Versions.compose - } - - buildTypes { - create("debug_beta") { - initWith(getByName("release")) - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("release"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - ), - builder = ::buildConfigField, - ).create() - } - } + id("configuration") } dependencies { diff --git a/features/swap/data/build.gradle.kts b/features/swap/data/build.gradle.kts index 9f2c7c0c4d..07c5ef4c1d 100644 --- a/features/swap/data/build.gradle.kts +++ b/features/swap/data/build.gradle.kts @@ -3,39 +3,7 @@ plugins { kotlin("android") kotlin("kapt") id("com.google.dagger.hilt.android") -} - -android { - - defaultConfig { - compileSdk = AppConfig.compileSdkVersion - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - isCoreLibraryDesugaringEnabled = false - } - - buildTypes { - create("debug_beta") { - initWith(getByName("release")) - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("release"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - ), - builder = ::buildConfigField, - ).create() - } - } + id("configuration") } dependencies { diff --git a/features/swap/domain/build.gradle.kts b/features/swap/domain/build.gradle.kts index 87fa664521..08001ab75b 100644 --- a/features/swap/domain/build.gradle.kts +++ b/features/swap/domain/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("java-library") - id("org.jetbrains.kotlin.jvm") + kotlin("jvm") kotlin("kapt") kotlin("plugin.serialization") + id("configuration") } dependencies { @@ -16,9 +16,4 @@ dependencies { /** Other Libraries **/ implementation(Library.kotlinSerialization) -} - -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 } \ No newline at end of file diff --git a/features/swap/presentation/build.gradle.kts b/features/swap/presentation/build.gradle.kts index 287b9e6ad6..e153a75e97 100644 --- a/features/swap/presentation/build.gradle.kts +++ b/features/swap/presentation/build.gradle.kts @@ -4,47 +4,7 @@ plugins { kotlin("kapt") kotlin("plugin.serialization") id("com.google.dagger.hilt.android") -} - -android { - - defaultConfig { - compileSdk = AppConfig.compileSdkVersion - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - isCoreLibraryDesugaringEnabled = false - } - - buildTypes { - create("debug_beta") { - initWith(getByName("release")) - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("release"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - ), - builder = ::buildConfigField, - ).create() - } - } - - buildFeatures { - compose = true - } - - composeOptions { - kotlinCompilerExtensionVersion = Versions.compose - } + id("configuration") } dependencies { @@ -69,7 +29,6 @@ dependencies { /** Domain */ implementation(project(":features:swap:domain")) - implementation(project(":features:swap:data"))//todo remove, only for test /** Other libraries */ implementation(Library.composeShimmer) diff --git a/features/tester/impl/build.gradle.kts b/features/tester/impl/build.gradle.kts index 32807a6ded..bc262f1eb0 100644 --- a/features/tester/impl/build.gradle.kts +++ b/features/tester/impl/build.gradle.kts @@ -3,63 +3,7 @@ plugins { kotlin("android") kotlin("kapt") id("com.google.dagger.hilt.android") -} - -android { - defaultConfig { - compileSdk = AppConfig.compileSdkVersion - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - vectorDrawables { - useSupportLibrary = true - } - } - - kotlinOptions { - jvmTarget = "1.8" - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - buildTypes { - release { - BuildConfigFieldFactory( - fields = listOf(Field.TesterMenuAvailability(false)), - builder = ::buildConfigField, - ).create() - } - - debug { - BuildConfigFieldFactory( - fields = listOf(Field.TesterMenuAvailability(true)), - builder = ::buildConfigField, - ).create() - } - - create("debug_beta") { - initWith(getByName("release")) - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("release"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - Field.TesterMenuAvailability(true), - ), - builder = ::buildConfigField, - ).create() - } - } - - buildFeatures { - compose = true - } - - composeOptions { - kotlinCompilerExtensionVersion = Versions.compose - } + id("configuration") } dependencies { diff --git a/libs/auth/build.gradle.kts b/libs/auth/build.gradle.kts index b8dd6f840d..f5ba6275ef 100644 --- a/libs/auth/build.gradle.kts +++ b/libs/auth/build.gradle.kts @@ -1,37 +1,5 @@ plugins { id("com.android.library") kotlin("android") -} - -android { - - defaultConfig { - compileSdk = AppConfig.compileSdkVersion - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - isCoreLibraryDesugaringEnabled = false - } - - buildTypes { - create("debug_beta") { - initWith(getByName("release")) - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("release"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - ), - builder = ::buildConfigField, - ).create() - } - } + id("configuration") } \ No newline at end of file diff --git a/libs/crypto/build.gradle.kts b/libs/crypto/build.gradle.kts index de1a6876a4..a39e3425bf 100644 --- a/libs/crypto/build.gradle.kts +++ b/libs/crypto/build.gradle.kts @@ -1,15 +1,10 @@ plugins { - id("java-library") - id("org.jetbrains.kotlin.jvm") + kotlin("jvm") + id("configuration") } dependencies { /** Coroutines */ implementation(Library.coroutine) -} - -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 } \ No newline at end of file From 3466a64574acb7f6c9fdb3c6e3f1e3c09dc0bfa3 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 7 Mar 2023 17:30:28 +0300 Subject: [PATCH 3/5] Updated on 2026-08-14 --- app/build.gradle.kts | 139 +++++++++--------- build.gradle.kts | 42 ++---- common/build.gradle.kts | 2 +- core/analytics/build.gradle.kts | 12 +- core/datasource/build.gradle.kts | 38 ++--- core/featuretoggles/build.gradle.kts | 18 +-- core/res/build.gradle.kts | 4 +- core/ui/build.gradle.kts | 18 +-- core/utils/build.gradle.kts | 10 +- domain/build.gradle.kts | 34 ++--- features/referral/data/build.gradle.kts | 14 +- features/referral/domain/build.gradle.kts | 10 +- .../referral/presentation/build.gradle.kts | 30 ++-- features/swap/data/build.gradle.kts | 14 +- features/swap/domain/build.gradle.kts | 12 +- features/swap/presentation/build.gradle.kts | 40 ++--- features/tester/api/build.gradle.kts | 37 +---- features/tester/impl/build.gradle.kts | 28 ++-- libs/auth/build.gradle.kts | 4 +- libs/crypto/build.gradle.kts | 4 +- settings.gradle.kts | 31 +++- 21 files changed, 256 insertions(+), 285 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 899e3cf11f..e504d7d5c7 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,16 +1,16 @@ plugins { - id("com.android.application") - kotlin("android") - kotlin("kapt") - kotlin("plugin.serialization") - id("com.google.gms.google-services") - id("com.google.firebase.crashlytics") - id("com.google.dagger.hilt.android") + alias(deps.plugins.android.application) + alias(deps.plugins.kotlin.android) + alias(deps.plugins.kotlin.kapt) + alias(deps.plugins.kotlin.serialization) + alias(deps.plugins.google.services) + alias(deps.plugins.hilt.android) + alias(deps.plugins.firebase.crashlytics) id("configuration") } dependencies { - implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar")))) + implementation(files("libs/walletconnect-1.5.6.aar")) implementation(project(":domain")) implementation(project(":common")) implementation(project(":core:analytics")) @@ -33,86 +33,85 @@ dependencies { implementation(project(":features:tester:impl")) /** AndroidX libraries */ - implementation(AndroidX.coreKtx) - implementation(AndroidX.appCompat) - implementation(AndroidX.fragmentKtx) - implementation(AndroidX.constraintLayout) - implementation(AndroidX.browser) - implementation(AndroidX.lifecycleRuntimeKtx) - implementation(AndroidX.lifecycleCommonJava8) - implementation(AndroidX.lifecycleViewModelKtx) - implementation(AndroidX.lifecycleLiveDataKtx) - implementation(AndroidX.activityCompose) + implementation(deps.androidx.core.ktx) + implementation(deps.androidx.appCompat) + implementation(deps.androidx.fragment.ktx) + implementation(deps.androidx.constraintLayout) + implementation(deps.androidx.activity.compose) + implementation(deps.androidx.browser) + implementation(deps.lifecycle.runtime.ktx) + implementation(deps.lifecycle.common.java8) + implementation(deps.lifecycle.viewModel.ktx) /** Compose libraries */ - implementation(Compose.material) - implementation(Compose.animation) - implementation(Compose.foundation) - implementation(Compose.ui) - implementation(Compose.uiTooling) - implementation(Compose.coil) + implementation(deps.compose.material) + implementation(deps.compose.animation) + implementation(deps.compose.foundation) + implementation(deps.compose.ui) + implementation(deps.compose.ui.tooling) + implementation(deps.compose.coil) + implementation(deps.compose.shimmer) /** Firebase libraries */ - implementation(platform(Firebase.bom)) - implementation(Firebase.firebaseAnalytics) - implementation(Firebase.firebaseCrashlytics) + implementation(platform(deps.firebase.bom)) + implementation(deps.firebase.analytics) + implementation(deps.firebase.crashlytics) /** Tangem libraries */ - implementation(Tangem.blockchain) { + implementation(deps.tangem.blockchain) { exclude(module = "joda-time") } - implementation(Tangem.cardCore) - implementation(Tangem.cardAndroid) { + implementation(deps.tangem.card.core) + implementation(deps.tangem.card.android) { exclude(module = "joda-time") } /** DI */ - implementation(Library.hilt) - kapt(Library.hiltKapt) + implementation(deps.hilt.android) + kapt(deps.hilt.kapt) /** Other libraries */ - implementation(Library.materialComponent) - implementation(Library.googlePlayCore) - implementation(Library.googlePlayCoreKtx) - coreLibraryDesugaring(Library.desugarJdkLibs) - implementation(Library.timber) - implementation(Library.reKotlin) - implementation(Library.zxingQrCore) - implementation(Library.zxingQrBarcodeScanner) - implementation(Library.otaliastudiosCameraView) - implementation(Library.coil) - implementation(Library.appsflyer) - implementation(Library.amplitude) - implementation(Library.kotsonGsonExt) + implementation(deps.material) + implementation(deps.googlePlay.core) + implementation(deps.googlePlay.core.ktx) + implementation(deps.googlePlay.services.wallet) + coreLibraryDesugaring(deps.desugar) + implementation(deps.timber) + implementation(deps.reKotlin) + implementation(deps.zxing.qrCore) + implementation(deps.zxing.qrBarcodeScanner) + implementation(deps.otaliastudiosCameraView) + implementation(deps.coil) + implementation(deps.appsflyer) + implementation(deps.amplitude) + implementation(deps.kotsonGson) //TODO: refactoring: remove it when all network services moved to the datasource module - implementation(Library.retrofit) - implementation(Library.retrofitMoshiConverter) - implementation(Library.moshi) - implementation(Library.moshiKotlin) - implementation(Library.okHttp) - implementation(Library.okHttpLogging) - implementation(Library.zendeskChat) - implementation(Library.zendeskMessaging) - implementation(Library.spongecastleCryptoCore) - implementation(Library.lottie) - implementation(Library.shopifyBuySdk) { + implementation(deps.retrofit) + implementation(deps.retrofit.moshi) + implementation(deps.moshi) + implementation(deps.moshi.kotlin) + implementation(deps.okHttp) + implementation(deps.okHttp.logging) + implementation(deps.zendesk.chat) + implementation(deps.zendesk.messaging) + implementation(deps.spongecastle.core) + implementation(deps.lottie) + implementation(deps.shopify.buy) { exclude(group = "com.shopify.graphql.support") exclude(module = "joda-time") } - implementation(Library.accompanistAppCompatTheme) - implementation(Library.accompanistSystemUiController) - implementation(Library.accompanistWebView) - implementation(Library.xmlShimmer) - implementation(Library.viewBindingDelegate) - implementation(Library.armadillo) - implementation(Library.googlePlayServicesWallet) - implementation(Library.composeShimmer) - implementation(Library.mviCoreWatcher) - implementation(Library.kotlinSerialization) + implementation(deps.compose.accompanist.appCompatTheme) + implementation(deps.compose.accompanist.systemUiController) + implementation(deps.compose.accompanist.webView) + implementation(deps.xmlShimmer) + implementation(deps.viewBindingDelegate) + implementation(deps.armadillo) + implementation(deps.mviCore.watcher) + implementation(deps.kotlin.serialization) /** Testing libraries */ - testImplementation(Test.junit) - testImplementation(Test.truth) - androidTestImplementation(Test.junitAndroidExt) - androidTestImplementation(Test.espresso) + testImplementation(deps.test.junit) + testImplementation(deps.test.truth) + androidTestImplementation(deps.test.junit.android) + androidTestImplementation(deps.test.espresso) } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index f71b201932..aa62254f1d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,37 +1,13 @@ -buildscript { - repositories { - google() - mavenCentral() - maven(url = "https://maven.fabric.io/public") - } - - dependencies { - classpath(ClasspathDependency.AndroidGradlePlugin) - classpath(ClasspathDependency.KotlinGradlePlugin) - classpath(ClasspathDependency.AndroidMavenGradlePlugin) - classpath(ClasspathDependency.GoogleServices) - classpath(ClasspathDependency.GoogleFirebaseCrashlytics) - } -} - plugins { - id("com.google.dagger.hilt.android") version "2.44" apply false - kotlin("plugin.serialization") version Versions.kotlin apply false -} - -allprojects { - repositories { - google() - jcenter() // unable to replace with mavenCentral() due to rekotlin and com.otaliastudios:cameraview - mavenLocal() - maven("https://nexus.tangem-tech.com/repository/maven-releases/") - maven("https://jitpack.io") - maven("https://zendesk.jfrog.io/zendesk/repo") - } -} - -subprojects { - apply(plugin = "detekt-convention") + alias(deps.plugins.kotlin.android) apply false + alias(deps.plugins.kotlin.jvm) apply false + alias(deps.plugins.kotlin.serialization) apply false + alias(deps.plugins.kotlin.kapt) apply false + alias(deps.plugins.android.application) apply false + alias(deps.plugins.android.library) apply false + alias(deps.plugins.hilt.android) apply false + alias(deps.plugins.google.services) apply false + alias(deps.plugins.firebase.crashlytics) apply false } tasks.register("clean", Delete::class) { diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 19e39fb7b0..7ff7fb7522 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -1,4 +1,4 @@ plugins { - kotlin("jvm") + alias(deps.plugins.kotlin.jvm) id("configuration") } \ No newline at end of file diff --git a/core/analytics/build.gradle.kts b/core/analytics/build.gradle.kts index a3d80803f6..e1fb463a41 100644 --- a/core/analytics/build.gradle.kts +++ b/core/analytics/build.gradle.kts @@ -1,16 +1,16 @@ plugins { - id("com.android.library") - kotlin("android") - kotlin("kapt") - id("com.google.dagger.hilt.android") + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + alias(deps.plugins.kotlin.kapt) + alias(deps.plugins.hilt.android) id("configuration") } dependencies { /** DI */ - implementation(Library.hilt) - kapt(Library.hiltKapt) + implementation(deps.hilt.android) + kapt(deps.hilt.kapt) /** Core shouldn't depends on core, but in case with utils and logging its necessary */ implementation(project(":core:utils")) diff --git a/core/datasource/build.gradle.kts b/core/datasource/build.gradle.kts index 31f92aa978..36c8fda7a2 100644 --- a/core/datasource/build.gradle.kts +++ b/core/datasource/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("com.android.library") - kotlin("android") - kotlin("kapt") - id("com.google.dagger.hilt.android") + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + alias(deps.plugins.kotlin.kapt) + alias(deps.plugins.hilt.android) id("configuration") } @@ -13,31 +13,31 @@ dependencies { implementation(project(":libs:auth")) /** Tangem libraries */ - implementation(Tangem.blockchain) - implementation(Tangem.cardCore) + implementation(deps.tangem.blockchain) + implementation(deps.tangem.card.core) /** DI */ - implementation(Library.hilt) - kapt(Library.hiltKapt) + implementation(deps.hilt.android) + kapt(deps.hilt.kapt) /** Coroutines */ - implementation(Library.coroutine) + implementation(deps.kotlin.coroutines) /** Logging */ - implementation(Library.timber) + implementation(deps.timber) /** Network */ - implementation(Library.krateSharedPref) - implementation(Library.moshi) - implementation(Library.moshiKotlin) - implementation(Library.okHttp) - implementation(Library.okHttpLogging) - implementation(Library.retrofit) - implementation(Library.retrofitMoshiConverter) + implementation(deps.krateSharedPref) + implementation(deps.moshi) + implementation(deps.moshi.kotlin) + implementation(deps.okHttp) + implementation(deps.okHttp.logging) + implementation(deps.retrofit) + implementation(deps.retrofit.moshi) /** Time */ - implementation(Library.jodatime) + implementation(deps.jodatime) /** Security */ - implementation(Library.spongecastleCryptoCore) + implementation(deps.spongecastle.core) } \ No newline at end of file diff --git a/core/featuretoggles/build.gradle.kts b/core/featuretoggles/build.gradle.kts index 4c74fed994..f32b3b74cd 100644 --- a/core/featuretoggles/build.gradle.kts +++ b/core/featuretoggles/build.gradle.kts @@ -1,17 +1,17 @@ plugins { - id("com.android.library") - kotlin("android") - kotlin("kapt") - id("com.google.dagger.hilt.android") + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + alias(deps.plugins.kotlin.kapt) + alias(deps.plugins.hilt.android) id("configuration") } dependencies { - implementation(Library.moshi) - implementation(Library.moshiKotlin) - implementation(Library.hilt) - kapt(Library.hiltKapt) - implementation(Library.timber) + implementation(deps.moshi) + implementation(deps.moshi.kotlin) + implementation(deps.hilt.android) + kapt(deps.hilt.kapt) + implementation(deps.timber) implementation(project(":core:datasource")) } \ No newline at end of file diff --git a/core/res/build.gradle.kts b/core/res/build.gradle.kts index f5ba6275ef..1fbece85d5 100644 --- a/core/res/build.gradle.kts +++ b/core/res/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("com.android.library") - kotlin("android") + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) id("configuration") } \ No newline at end of file diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts index 1269207e14..20f1a9f4b7 100644 --- a/core/ui/build.gradle.kts +++ b/core/ui/build.gradle.kts @@ -1,22 +1,22 @@ plugins { - id("com.android.library") - kotlin("android") + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) id("configuration") } dependencies { /** AndroidX libraries */ - implementation(AndroidX.fragmentKtx) + implementation(deps.androidx.fragment.ktx) /** Compose */ - implementation(Compose.foundation) - implementation(Compose.material) - implementation(Compose.uiTooling) + implementation(deps.compose.foundation) + implementation(deps.compose.material) + implementation(deps.compose.ui.tooling) /** Other libraries */ - implementation(Library.accompanistSystemUiController) - implementation(Library.materialComponent) - implementation(Library.composeShimmer) + implementation(deps.compose.accompanist.systemUiController) + implementation(deps.material) + implementation(deps.compose.shimmer) implementation(project(":core:res")) } \ No newline at end of file diff --git a/core/utils/build.gradle.kts b/core/utils/build.gradle.kts index 89f4727b11..1e8960ce77 100644 --- a/core/utils/build.gradle.kts +++ b/core/utils/build.gradle.kts @@ -1,15 +1,15 @@ plugins { - kotlin("jvm") - kotlin("kapt") + alias(deps.plugins.kotlin.jvm) + alias(deps.plugins.kotlin.kapt) id("configuration") } dependencies { /** DI */ - implementation(Library.hiltCore) - kapt(Library.hiltKapt) + implementation(deps.hilt.core) + kapt(deps.hilt.kapt) /** Coroutines */ - implementation(Library.coroutine) + implementation(deps.kotlin.coroutines) } \ No newline at end of file diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts index 849ed95c03..6ea5884226 100644 --- a/domain/build.gradle.kts +++ b/domain/build.gradle.kts @@ -1,6 +1,6 @@ plugins { - id("com.android.library") - id("org.jetbrains.kotlin.android") + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) id("configuration") } @@ -11,28 +11,28 @@ dependencies { implementation(project(":libs:auth")) /** Tangem libraries */ - implementation(Tangem.blockchain) { + implementation(deps.tangem.blockchain) { exclude(module = "joda-time") } - implementation(Tangem.cardCore) - implementation(Tangem.cardAndroid) { + implementation(deps.tangem.card.core) + implementation(deps.tangem.card.android) { exclude(module = "joda-time") } /** Other libraries */ - implementation(Library.reKotlin) + implementation(deps.reKotlin) //TODO: refactoring: remove it when all network services moved to the datasource module - implementation(Library.retrofit) - implementation(Library.retrofitMoshiConverter) - implementation(Library.moshi) - implementation(Library.moshiKotlin) - implementation(Library.okHttpLogging) - implementation(Library.timber) - implementation(Library.coroutine) + implementation(deps.retrofit) + implementation(deps.retrofit.moshi) + implementation(deps.moshi) + implementation(deps.moshi.kotlin) + implementation(deps.okHttp.logging) + implementation(deps.timber) + implementation(deps.kotlin.coroutines) /** Testing libraries */ - testImplementation(Test.junit) - testImplementation(Test.truth) - androidTestImplementation(Test.junitAndroidExt) - androidTestImplementation(Test.espresso) + testImplementation(deps.test.junit) + testImplementation(deps.test.truth) + androidTestImplementation(deps.test.junit.android) + androidTestImplementation(deps.test.espresso) } \ No newline at end of file diff --git a/features/referral/data/build.gradle.kts b/features/referral/data/build.gradle.kts index 78aa72d048..ab23b2ba7a 100644 --- a/features/referral/data/build.gradle.kts +++ b/features/referral/data/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("com.android.library") - kotlin("android") - kotlin("kapt") - id("com.google.dagger.hilt.android") + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + alias(deps.plugins.kotlin.kapt) + alias(deps.plugins.hilt.android) id("configuration") } @@ -14,9 +14,9 @@ dependencies { implementation(project(":features:referral:domain")) /** Time */ - implementation(Library.jodatime) + implementation(deps.jodatime) /** DI */ - implementation(Library.hilt) - kapt(Library.hiltKapt) + implementation(deps.hilt.android) + kapt(deps.hilt.kapt) } \ No newline at end of file diff --git a/features/referral/domain/build.gradle.kts b/features/referral/domain/build.gradle.kts index 78f29434fe..6f335c1221 100644 --- a/features/referral/domain/build.gradle.kts +++ b/features/referral/domain/build.gradle.kts @@ -1,6 +1,6 @@ plugins { - kotlin("jvm") - kotlin("kapt") + alias(deps.plugins.kotlin.jvm) + alias(deps.plugins.kotlin.kapt) id("configuration") } @@ -11,9 +11,9 @@ dependencies { implementation(project(":libs:crypto")) /** Time */ - implementation(Library.jodatime) + implementation(deps.jodatime) /** DI */ - implementation(Library.hiltCore) - kapt(Library.hiltKapt) + implementation(deps.hilt.core) + kapt(deps.hilt.kapt) } \ No newline at end of file diff --git a/features/referral/presentation/build.gradle.kts b/features/referral/presentation/build.gradle.kts index db43d24e47..46f4b5007c 100644 --- a/features/referral/presentation/build.gradle.kts +++ b/features/referral/presentation/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("com.android.library") - kotlin("android") - kotlin("kapt") - id("com.google.dagger.hilt.android") + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + alias(deps.plugins.kotlin.kapt) + alias(deps.plugins.hilt.android) id("configuration") } @@ -14,24 +14,24 @@ dependencies { implementation(project(":core:ui")) /** AndroidX */ - implementation(AndroidX.appCompat) - implementation(AndroidX.fragmentKtx) - implementation(AndroidX.lifecycleViewModelKtx) - implementation(Library.materialComponent) + implementation(deps.androidx.appCompat) + implementation(deps.androidx.fragment.ktx) + implementation(deps.lifecycle.viewModel.ktx) + implementation(deps.material) /** Compose */ - implementation(Compose.foundation) - implementation(Compose.material) - implementation(Compose.uiTooling) + implementation(deps.compose.foundation) + implementation(deps.compose.material) + implementation(deps.compose.ui.tooling) /** Domain */ implementation(project(":features:referral:domain")) /** Other libraries */ - implementation(Library.composeShimmer) - implementation(Library.accompanistWebView) + implementation(deps.compose.shimmer) + implementation(deps.compose.accompanist.webView) /** DI */ - implementation(Library.hilt) - kapt(Library.hiltKapt) + implementation(deps.hilt.android) + kapt(deps.hilt.kapt) } \ No newline at end of file diff --git a/features/swap/data/build.gradle.kts b/features/swap/data/build.gradle.kts index 07c5ef4c1d..87bb14fe6b 100644 --- a/features/swap/data/build.gradle.kts +++ b/features/swap/data/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("com.android.library") - kotlin("android") - kotlin("kapt") - id("com.google.dagger.hilt.android") + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + alias(deps.plugins.kotlin.kapt) + alias(deps.plugins.hilt.android) id("configuration") } @@ -14,9 +14,9 @@ dependencies { implementation(project(":features:swap:domain")) /** Network */ - implementation(Library.retrofit) + implementation(deps.retrofit) /** DI */ - implementation(Library.hilt) - kapt(Library.hiltKapt) + implementation(deps.hilt.android) + kapt(deps.hilt.kapt) } \ No newline at end of file diff --git a/features/swap/domain/build.gradle.kts b/features/swap/domain/build.gradle.kts index 08001ab75b..d5dec7c6d0 100644 --- a/features/swap/domain/build.gradle.kts +++ b/features/swap/domain/build.gradle.kts @@ -1,7 +1,7 @@ plugins { - kotlin("jvm") - kotlin("kapt") - kotlin("plugin.serialization") + alias(deps.plugins.kotlin.jvm) + alias(deps.plugins.kotlin.kapt) + alias(deps.plugins.kotlin.serialization) id("configuration") } @@ -11,9 +11,9 @@ dependencies { implementation(project(":core:utils")) /** DI */ - implementation(Library.hiltCore) - kapt(Library.hiltKapt) + implementation(deps.hilt.core) + kapt(deps.hilt.kapt) /** Other Libraries **/ - implementation(Library.kotlinSerialization) + implementation(deps.kotlin.serialization) } \ No newline at end of file diff --git a/features/swap/presentation/build.gradle.kts b/features/swap/presentation/build.gradle.kts index e153a75e97..2622155859 100644 --- a/features/swap/presentation/build.gradle.kts +++ b/features/swap/presentation/build.gradle.kts @@ -1,9 +1,9 @@ plugins { - id("com.android.library") - kotlin("android") - kotlin("kapt") - kotlin("plugin.serialization") - id("com.google.dagger.hilt.android") + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + alias(deps.plugins.kotlin.kapt) + alias(deps.plugins.kotlin.serialization) + alias(deps.plugins.hilt.android) id("configuration") } @@ -14,28 +14,28 @@ dependencies { implementation(project(":core:ui")) /** AndroidX */ - implementation(AndroidX.activityCompose) - implementation(AndroidX.appCompat) - implementation(AndroidX.fragmentKtx) - implementation(AndroidX.lifecycleViewModelKtx) - implementation(AndroidX.browser) + implementation(deps.androidx.activity.compose) + implementation(deps.androidx.appCompat) + implementation(deps.androidx.fragment.ktx) + implementation(deps.lifecycle.viewModel.ktx) + implementation(deps.androidx.browser) /** Compose */ - implementation(Compose.foundation) - implementation(Compose.material) - implementation(Compose.uiTooling) - implementation(Compose.coil) - implementation(Compose.constraintLayout) + implementation(deps.compose.foundation) + implementation(deps.compose.material) + implementation(deps.compose.ui.tooling) + implementation(deps.compose.coil) + implementation(deps.compose.constraintLayout) /** Domain */ implementation(project(":features:swap:domain")) /** Other libraries */ - implementation(Library.composeShimmer) - implementation(Library.kotlinSerialization) - implementation(Library.timber) + implementation(deps.compose.shimmer) + implementation(deps.kotlin.serialization) + implementation(deps.timber) /** DI */ - implementation(Library.hilt) - kapt(Library.hiltKapt) + implementation(deps.hilt.android) + kapt(deps.hilt.kapt) } \ No newline at end of file diff --git a/features/tester/api/build.gradle.kts b/features/tester/api/build.gradle.kts index 12beb12279..1fbece85d5 100644 --- a/features/tester/api/build.gradle.kts +++ b/features/tester/api/build.gradle.kts @@ -1,36 +1,5 @@ plugins { - id("com.android.library") - kotlin("android") -} - -android { - - defaultConfig { - compileSdk = AppConfig.compileSdkVersion - minSdk = AppConfig.minSdkVersion - targetSdk = AppConfig.targetSdkVersion - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - buildTypes { - create("debug_beta") { - initWith(getByName("release")) - BuildConfigFieldFactory( - fields = listOf( - Field.Environment("release"), - Field.TestActionEnabled(true), - Field.LogEnabled(true), - ), - builder = ::buildConfigField, - ).create() - } - } + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + id("configuration") } \ No newline at end of file diff --git a/features/tester/impl/build.gradle.kts b/features/tester/impl/build.gradle.kts index bc262f1eb0..774c318817 100644 --- a/features/tester/impl/build.gradle.kts +++ b/features/tester/impl/build.gradle.kts @@ -1,27 +1,27 @@ plugins { - id("com.android.library") - kotlin("android") - kotlin("kapt") - id("com.google.dagger.hilt.android") + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + alias(deps.plugins.kotlin.kapt) + alias(deps.plugins.hilt.android) id("configuration") } dependencies { /** AndroidX */ - implementation(AndroidX.activityCompose) + implementation(deps.androidx.activity.compose) /** Compose */ - implementation(Compose.foundation) - implementation(Compose.hiltNavigation) - implementation(Compose.material) - implementation(Compose.navigation) - implementation(Compose.ui) - implementation(Compose.uiTooling) + implementation(deps.compose.material) + implementation(deps.compose.foundation) + implementation(deps.compose.navigation) + implementation(deps.compose.navigation.hilt) + implementation(deps.compose.ui) + implementation(deps.compose.ui.tooling) + implementation(deps.compose.accompanist.systemUiController) /** DI */ - implementation(Library.accompanistSystemUiController) - implementation(Library.hilt) - kapt(Library.hiltKapt) + implementation(deps.hilt.android) + kapt(deps.hilt.kapt) /** Core modules */ implementation(project(":core:featuretoggles")) diff --git a/libs/auth/build.gradle.kts b/libs/auth/build.gradle.kts index f5ba6275ef..1fbece85d5 100644 --- a/libs/auth/build.gradle.kts +++ b/libs/auth/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("com.android.library") - kotlin("android") + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) id("configuration") } \ No newline at end of file diff --git a/libs/crypto/build.gradle.kts b/libs/crypto/build.gradle.kts index a39e3425bf..248cc20bd1 100644 --- a/libs/crypto/build.gradle.kts +++ b/libs/crypto/build.gradle.kts @@ -1,10 +1,10 @@ plugins { - kotlin("jvm") + alias(deps.plugins.kotlin.jvm) id("configuration") } dependencies { /** Coroutines */ - implementation(Library.coroutine) + implementation(deps.kotlin.coroutines) } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 0c89d3ea9f..51748a3c8e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,9 +1,36 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } + + includeBuild("plugins/configuration") +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + + repositories { + google() + mavenCentral() + jcenter() // unable to replace with mavenCentral() due to rekotlin and com.otaliastudios:cameraview + maven("https://nexus.tangem-tech.com/repository/maven-releases/") + maven("https://jitpack.io") + maven("https://zendesk.jfrog.io/zendesk/repo") + } + + versionCatalogs { + create("deps") { + from(files("gradle/dependencies.toml")) + } + } +} + include(":app") include(":domain") include(":common") -includeBuild("includedBuild/configuration") - // region Core modules include(":core:analytics") include(":core:datasource") From e52101cf2797623f5b7aa9343442b8a5601e5b70 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 7 Mar 2023 17:31:58 +0300 Subject: [PATCH 4/5] Updated on 2026-08-14 --- .gitignore | 1 - buildSrc/build.gradle.kts | 16 ---- buildSrc/src/main/java/ClasspathDependency.kt | 9 -- buildSrc/src/main/java/Dependency.kt | 94 ------------------- buildSrc/src/main/java/Versions.kt | 85 ----------------- .../main/java/detekt-convention.gradle.kts | 33 ------- 6 files changed, 238 deletions(-) delete mode 100644 buildSrc/build.gradle.kts delete mode 100644 buildSrc/src/main/java/ClasspathDependency.kt delete mode 100644 buildSrc/src/main/java/Dependency.kt delete mode 100644 buildSrc/src/main/java/Versions.kt delete mode 100644 buildSrc/src/main/java/detekt-convention.gradle.kts diff --git a/.gitignore b/.gitignore index dcdbe5fc57..25c98d5d1f 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,3 @@ local.properties **/fastlane/Preview.html **/fastlane/screenshots **/fastlane/test_output -/buildSrc/build/ diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index af3fd561b4..0000000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - `kotlin-dsl` -} - -repositories { - google() - mavenCentral() -} - -dependencies { - implementation("com.android.tools.build:gradle:7.1.3") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10") - //TODO("Upgrade version to 1.22.0 after upgrading kotlin version to 1.7.21") - implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.21.0") - implementation("com.squareup:javapoet:1.13.0") -} \ No newline at end of file diff --git a/buildSrc/src/main/java/ClasspathDependency.kt b/buildSrc/src/main/java/ClasspathDependency.kt deleted file mode 100644 index 23fcf71450..0000000000 --- a/buildSrc/src/main/java/ClasspathDependency.kt +++ /dev/null @@ -1,9 +0,0 @@ -object ClasspathDependency { - const val AndroidGradlePlugin = "com.android.tools.build:gradle:" + Versions.androidGradlePlugin - const val AndroidMavenGradlePlugin = "com.github.dcendents:android-maven-gradle-plugin:" + - Versions.androidMavenGradlePlugin - const val GoogleFirebaseCrashlytics = "com.google.firebase:firebase-crashlytics-gradle:" + - Versions.googleFirebaseCrashlytics - const val GoogleServices = "com.google.gms:google-services:" + Versions.googleServices - const val KotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:" + Versions.kotlin -} \ No newline at end of file diff --git a/buildSrc/src/main/java/Dependency.kt b/buildSrc/src/main/java/Dependency.kt deleted file mode 100644 index 14999b1c51..0000000000 --- a/buildSrc/src/main/java/Dependency.kt +++ /dev/null @@ -1,94 +0,0 @@ -object AndroidX { - const val activityCompose = "androidx.activity:activity-compose:" + Versions.androidxActivityCompose - const val appCompat = "androidx.appcompat:appcompat:" + Versions.androidxAppCompat - const val browser = "androidx.browser:browser:" + Versions.androidxBrowser - const val constraintLayout = "androidx.constraintlayout:constraintlayout:" + Versions.androidxConstraintLayout - const val coreKtx = "androidx.core:core-ktx:" + Versions.androidxCore - const val fragmentKtx = "androidx.fragment:fragment-ktx:" + Versions.androidxFragment - const val lifecycleCommonJava8 = "androidx.lifecycle:lifecycle-common-java8:" + Versions.androidxLifecycle - const val lifecycleLiveDataKtx = "androidx.lifecycle:lifecycle-livedata-ktx:" + Versions.androidxLifecycle - const val lifecycleRuntimeKtx = "androidx.lifecycle:lifecycle-runtime-ktx:" + Versions.androidxLifecycle - const val lifecycleViewModelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:" + Versions.androidxLifecycle -} - -object Compose { - const val animation = "androidx.compose.animation:animation:" + Versions.compose - const val coil = "io.coil-kt:coil-compose:" + Versions.coil - const val foundation = "androidx.compose.foundation:foundation:" + Versions.composeFoundation - const val hiltNavigation = "androidx.hilt:hilt-navigation-compose:" + Versions.composeHiltNavigation - const val material = "androidx.compose.material:material:" + Versions.compose - const val navigation = "androidx.navigation:navigation-compose:" + Versions.composeNavigation - const val ui = "androidx.compose.ui:ui:" + Versions.compose - const val uiTooling = "androidx.compose.ui:ui-tooling:" + Versions.compose - const val constraintLayout = "androidx.constraintlayout:constraintlayout-compose:" + Versions.composeConstraint -} - -object Firebase { - const val bom = "com.google.firebase:firebase-bom:" + Versions.firebase - const val firebaseAnalytics = "com.google.firebase:firebase-analytics-ktx" - const val firebaseCrashlytics = "com.google.firebase:firebase-crashlytics-ktx" -} - -object Library { - const val accompanistAppCompatTheme = "com.google.accompanist:accompanist-appcompat-theme:" + Versions.accompanist - const val accompanistSystemUiController = - "com.google.accompanist:accompanist-systemuicontroller:" + Versions.accompanist - const val accompanistWebView = "com.google.accompanist:accompanist-webview:" + Versions.accompanist - const val amplitude = "com.amplitude:android-sdk:" + Versions.amplitude - const val appsflyer = "com.appsflyer:af-android-sdk:" + Versions.appsflyer - const val armadillo = "at.favre.lib:armadillo:" + Versions.armadillo - const val coil = "io.coil-kt:coil:" + Versions.coil - const val composeShimmer = "com.valentinilk.shimmer:compose-shimmer:" + Versions.composeShimmer - const val coroutine = "org.jetbrains.kotlinx:kotlinx-coroutines-core:" + Versions.coroutine - const val desugarJdkLibs = "com.android.tools:desugar_jdk_libs:" + Versions.desugarJdkLibs - const val googlePlayCore = "com.google.android.play:core:" + Versions.googlePlayCore - const val googlePlayCoreKtx = "com.google.android.play:core-ktx:" + Versions.googlePlayCoreKtx - const val googlePlayServicesWallet = - "com.google.android.gms:play-services-wallet:" + Versions.googlePlayServicesWallet - const val hilt = "com.google.dagger:hilt-android:" + Versions.hilt - const val hiltCore = "com.google.dagger:hilt-core:" + Versions.hilt - const val hiltKapt = "com.google.dagger:hilt-compiler:" + Versions.hilt - const val jodatime = "joda-time:joda-time:" + Versions.jodatime - const val krateSharedPref = "hu.autsoft:krate:" + Versions.krateSharedPref - const val kotsonGsonExt = "com.github.salomonbrys.kotson:kotson:" + Versions.kotsonGsonExt - const val lottie = "com.airbnb.android:lottie:" + Versions.lottie - const val materialComponent = "com.google.android.material:material:" + Versions.googleMaterialComponent - const val moshi = "com.squareup.moshi:moshi:" + Versions.moshi - const val moshiKotlin = "com.squareup.moshi:moshi-kotlin:" + Versions.moshi - const val okHttp = "com.squareup.okhttp3:okhttp:" + Versions.okhttp - const val okHttpLogging = "com.squareup.okhttp3:logging-interceptor:" + Versions.okhttp - const val otaliastudiosCameraView = "com.otaliastudios:cameraview:" + Versions.otaliastudiosCameraView - const val shopifyBuySdk = "com.shopify.mobilebuysdk:buy3:" + Versions.shopifyBuySdk - const val spongecastleCryptoCore = "com.madgag.spongycastle:core:" + Versions.spongycastleCryptoCore - const val reKotlin = "org.rekotlin:rekotlin:" + Versions.rekotlin - const val retrofit = "com.squareup.retrofit2:retrofit:" + Versions.retrofit - const val retrofitMoshiConverter = "com.squareup.retrofit2:converter-moshi:" + Versions.retrofitMoshiConverter - const val timber = "com.jakewharton.timber:timber:" + Versions.timber - const val viewBindingDelegate = - "com.github.kirich1409:viewbindingpropertydelegate-noreflection:" + Versions.viewBindingDelegate - const val xmlShimmer = "com.github.skydoves:androidveil:" + Versions.xmlShimmer - const val zendeskChat = "com.zendesk:chat:" + Versions.zendeskChat - const val zendeskMessaging = "com.zendesk:messaging:" + Versions.zendeskMessaging - const val zxingQrBarcodeScanner = "me.dm7.barcodescanner:zxing:" + Versions.zxingQrBarcodeScanner - const val zxingQrCore = "com.google.zxing:core:" + Versions.zxingQrCode - const val mviCoreWatcher = "com.github.badoo.mvicore:mvicore-diff:" + Versions.mviCore - const val kotlinSerialization = "org.jetbrains.kotlinx:kotlinx-serialization-json:" + Versions.kotlinSerialization -} - -object Tangem { - const val blockchain = "com.tangem:blockchain:" + Versions.tangemBlockchainSdk - const val cardAndroid = "com.tangem.tangem-sdk-kotlin:android:" + Versions.tangemCardSdk - const val cardCore = "com.tangem.tangem-sdk-kotlin:core:" + Versions.tangemCardSdk -} - -object Tools { - const val composeDetektRules = "ru.kode:detekt-rules-compose:" + Versions.composeDetektRules - const val formattingDetektRules = "io.gitlab.arturbosch.detekt:detekt-formatting:" + Versions.formattingDetektRules -} - -object Test { - const val espresso = "androidx.test.espresso:espresso-core:" + Versions.espresso - const val junit = "junit:junit:" + Versions.junit - const val junitAndroidExt = "androidx.test.ext:junit:" + Versions.junitAndroidExt - const val truth = "com.google.truth:truth:" + Versions.truth -} \ No newline at end of file diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt deleted file mode 100644 index b7683f0a01..0000000000 --- a/buildSrc/src/main/java/Versions.kt +++ /dev/null @@ -1,85 +0,0 @@ -object Versions { - // region Classpath - const val androidGradlePlugin = "7.1.3" - const val androidMavenGradlePlugin = "2.1" - const val googleFirebaseCrashlytics = "2.7.1" - const val googleServices = "4.3.10" - const val kotlin = "1.7.10" - // endregion Classpath - - // region AndroidX - const val androidxActivityCompose = "1.5.0" - const val androidxAppCompat = "1.5.1" - const val androidxBrowser = "1.4.0" - const val androidxConstraintLayout = "2.1.4" - const val androidxCore = "1.9.0" - const val androidxFragment = "1.5.3" - const val androidxLifecycle = "2.5.1" - // endregion AndroidX - - // region Compose - const val compose = "1.3.1" - const val composeFoundation = "1.3.1" - const val composeHiltNavigation = "1.0.0" - const val composeNavigation = "2.5.1" - const val composeConstraint = "1.0.1" - // endregion Compose - - // region Other libraries - const val accompanist = "0.28.0" - const val amplitude = "2.36.1" - const val appsflyer = "6.5.1" - const val armadillo = "0.9.0" - const val coil = "2.1.0" - const val composeShimmer = "1.0.3" - const val coroutine = "1.5.2" - const val desugarJdkLibs = "1.1.5" - const val firebase = "26.0.0" - const val googleMaterialComponent = "1.6.1" - const val googlePlayCore = "1.10.3" - const val googlePlayCoreKtx = "1.8.1" - const val googlePlayServicesWallet = "19.1.0" - const val hilt = "2.44" - const val jodatime = "2.12.1" - const val krateSharedPref = "2.0.0" - const val kotsonGsonExt = "2.5.0" - const val lottie = "3.4.0" - const val moshi = "1.12.0" - const val okhttp = "4.9.3" - const val otaliastudiosCameraView = "2.6.3" - const val rekotlin = "1.0.4" - const val retrofit = "2.8.1" - const val retrofitMoshiConverter = "2.6.0" - const val shopifyBuySdk = "12.0.0" - const val spongycastleCryptoCore = "1.58.0.0" - const val timber = "4.7.1" - const val viewBindingDelegate = "1.5.6" - const val xmlShimmer = "1.1.3" - const val zendeskChat = "3.3.5" - const val zendeskMessaging = "5.2.4" - const val zxingQrBarcodeScanner = "1.9.8" - const val zxingQrCode = "3.3.3" - const val mviCore = "1.3.1" - const val kotlinSerialization = "1.4.1" - // endregion Other libraries - - // region Tangem - const val tangemBlockchainSdk = "develop-174" - // const val tangemBlockchainSdk = "0.0.1" // Keep it! - used for local builds - - const val tangemCardSdk = "develop-200" - // const val tangemCardSdk = "0.0.1" // Keep it! - used for local builds - // endregion Tangem - - // region Tools - const val composeDetektRules = "1.2.2" - const val formattingDetektRules = "1.21.0" - // endregion Tools - - // region Testing - const val espresso = "3.4.0" - const val junit = "4.13.2" - const val truth = "1.1.3" - const val junitAndroidExt = "1.1.3" - // endregion Testing -} \ No newline at end of file diff --git a/buildSrc/src/main/java/detekt-convention.gradle.kts b/buildSrc/src/main/java/detekt-convention.gradle.kts deleted file mode 100644 index c78ee08e8e..0000000000 --- a/buildSrc/src/main/java/detekt-convention.gradle.kts +++ /dev/null @@ -1,33 +0,0 @@ -import io.gitlab.arturbosch.detekt.Detekt - -plugins { - id("io.gitlab.arturbosch.detekt") -} - -detekt { - parallel = true - ignoreFailures = false - autoCorrect = true - buildUponDefaultConfig = true - config.setFrom(rootProject.files("config/detekt/detekt.yml")) -} - -tasks.withType { - include("**/*.kt") - exclude("**/resources/**", "**/build/**") - reports { - sarif { - required.set(false) - } - txt { - required.set(true) - } - } - - jvmTarget = "1.8" -} - -dependencies { - detektPlugins(Tools.composeDetektRules) - detektPlugins(Tools.formattingDetektRules) -} \ No newline at end of file From ef5c599fbfda98e9b87964762dc29d14b7da0b38 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 7 Mar 2023 17:34:36 +0300 Subject: [PATCH 5/5] Updated on 2026-08-14 --- gradle.properties | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 52a563ad69..e3a622a5ef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,11 +6,12 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +org.gradle.jvmargs = -Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -org.gradle.parallel=true -org.gradle.daemon=true -android.useAndroidX=true -android.enableJetifier=true +org.gradle.parallel = true +org.gradle.daemon = true +android.useAndroidX = true +android.enableJetifier = true +org.gradle.unsafe.configuration-cache = true