From a6e04a43443f402f4aafea96ee9824164be28665 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 11 Nov 2022 13:54:04 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .gitignore | 1 + app/build.gradle | 187 ------------------ app/build.gradle.kts | 182 +++++++++++++++++ app/proguard-rules.pro | 2 +- build.gradle | 31 --- build.gradle.kts | 30 +++ buildSrc/build.gradle.kts | 7 + buildSrc/src/main/java/AppConfig.kt | 8 + buildSrc/src/main/java/ClasspathDependency.kt | 9 + buildSrc/src/main/java/ConfigFieldBuilder.kt | 26 +++ buildSrc/src/main/java/Dependency.kt | 77 ++++++++ buildSrc/src/main/java/Versions.kt | 68 +++++++ common/{build.gradle => build.gradle.kts} | 4 +- dependencies.gradle | 14 -- domain/build.gradle | 88 --------- domain/build.gradle.kts | 98 +++++++++ domain/proguard-rules.pro | 2 +- network/build.gradle | 31 --- network/build.gradle.kts | 26 +++ settings.gradle | 4 - settings.gradle.kts | 4 + 21 files changed, 540 insertions(+), 359 deletions(-) delete mode 100644 app/build.gradle create mode 100644 app/build.gradle.kts delete mode 100644 build.gradle create mode 100644 build.gradle.kts create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/src/main/java/AppConfig.kt create mode 100644 buildSrc/src/main/java/ClasspathDependency.kt create mode 100644 buildSrc/src/main/java/ConfigFieldBuilder.kt create mode 100644 buildSrc/src/main/java/Dependency.kt create mode 100644 buildSrc/src/main/java/Versions.kt rename common/{build.gradle => build.gradle.kts} (67%) delete mode 100644 dependencies.gradle delete mode 100644 domain/build.gradle create mode 100644 domain/build.gradle.kts delete mode 100644 network/build.gradle create mode 100644 network/build.gradle.kts delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/.gitignore b/.gitignore index dd64e70b22..dd33a7dab3 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ local.properties **/fastlane/Preview.html **/fastlane/screenshots **/fastlane/test_output +/buildSrc/build/ diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 70b6edcebd..0000000000 --- a/app/build.gradle +++ /dev/null @@ -1,187 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' -apply plugin: 'com.google.gms.google-services' -apply plugin: 'com.google.firebase.crashlytics' -apply from: '../dependencies.gradle' - -android { - compileSdkVersion 33 - defaultConfig { - applicationId "com.tangem.wallet" - versionCode project.hasProperty('versionCode') ? project.property('versionCode') as int : 1 - versionName project.hasProperty('versionName') ? project.property('versionName') : "1.0.0.-SNAPSHOT" - minSdkVersion 21 - targetSdkVersion 33 - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - - buildConfigField 'Boolean', environmentConfig.testActionEnabled, 'false' - buildConfigField 'Boolean', environmentConfig.logEnabled, 'false' - } - buildFeatures { - compose true - viewBinding true - } - buildTypes { - release { - debuggable false - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.debug - buildConfigField 'String', environmentConfig.environment, '\"prod\"' - buildConfigField 'Boolean', environmentConfig.testActionEnabled, 'false' - buildConfigField 'Boolean', environmentConfig.logEnabled, 'false' - } - debug { - debuggable true - minifyEnabled false - applicationIdSuffix ".dev" - signingConfig signingConfigs.debug - firebaseCrashlytics { - mappingFileUploadEnabled false - } - buildConfigField 'String', environmentConfig.environment, '\"dev\"' - buildConfigField 'Boolean', environmentConfig.testActionEnabled, 'true' - buildConfigField 'Boolean', environmentConfig.logEnabled, 'true' - } - debug_beta { - initWith release - debuggable false - versionNameSuffix "-beta" - applicationIdSuffix ".debug" - buildConfigField 'String', environmentConfig.environment, '\"prod\"' - buildConfigField 'Boolean', environmentConfig.testActionEnabled, 'false' - buildConfigField 'Boolean', environmentConfig.logEnabled, 'false' - } - - } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - coreLibraryDesugaringEnabled false - } - composeOptions { - kotlinCompilerExtensionVersion '1.1.0' - } - packagingOptions { - exclude 'lib/x86_64/darwin/libscrypt.dylib' - exclude 'lib/x86_64/freebsd/libscrypt.so' - exclude 'lib/x86_64/linux/libscrypt.so' - } -} - -repositories { - maven { url "https://jitpack.io" } -} - -dependencies { - implementation fileTree(include: ['*.aar'], dir: 'libs') - implementation implementation(project(path: ':domain')) - implementation implementation(project(path: ':network')) - implementation implementation(project(path: ':common')) - - implementation 'androidx.core:core-ktx:1.9.0' - implementation 'androidx.appcompat:appcompat:1.5.1' - implementation 'androidx.fragment:fragment-ktx:1.5.3' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'com.google.android.material:material:1.6.1' - implementation 'com.google.android.play:core:1.10.3' - implementation 'com.google.android.play:core-ktx:1.8.1' - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' - - implementation "com.tangem:blockchain:${versions.tangem_blockchain_sdk}" - implementation "com.tangem.tangem-sdk-kotlin:core:${versions.tangem_card_sdk}" - implementation "com.tangem.tangem-sdk-kotlin:android:${versions.tangem_card_sdk}" - - // WebView - implementation "androidx.browser:browser:1.4.0" - - implementation 'com.jakewharton.timber:timber:4.7.1' - - //lifecycle - implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1" - implementation "androidx.lifecycle:lifecycle-common-java8:2.5.1" - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1" - - implementation "org.rekotlin:rekotlin:1.0.4" - - // QR - implementation 'com.google.zxing:core:3.3.3' - implementation 'me.dm7.barcodescanner:zxing:1.9.8' - - // Camera - implementation 'com.otaliastudios:cameraview:2.6.3' - - // Image Loading - implementation 'io.coil-kt:coil:2.1.0' - implementation 'io.coil-kt:coil-compose:2.1.0' - - // Firebase - implementation platform('com.google.firebase:firebase-bom:26.0.0') - implementation 'com.google.firebase:firebase-analytics-ktx' - implementation 'com.google.firebase:firebase-crashlytics-ktx' - - // Analytics - implementation 'com.appsflyer:af-android-sdk:6.5.1' - implementation 'com.amplitude:android-sdk:2.36.1' - - // WalletConnect - implementation 'com.github.salomonbrys.kotson:kotson:2.5.0' - - // Network and Json - //TODO: refactoring: remove it when all network services moved to the network module - implementation 'com.squareup.retrofit2:retrofit:2.8.1' - implementation 'com.squareup.retrofit2:converter-moshi:2.6.0' - implementation 'com.squareup.moshi:moshi:1.12.0' - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - - implementation(platform("com.squareup.okhttp3:okhttp-bom:4.9.3")) - implementation("com.squareup.okhttp3:okhttp") - implementation("com.squareup.okhttp3:logging-interceptor") - - // Support - implementation("com.zendesk:chat:3.3.5") - implementation("com.zendesk:messaging:5.2.4") - - //Crypto - implementation "com.madgag.spongycastle:core:1.58.0.0" - - // animation - implementation "com.airbnb.android:lottie:3.4.0" - - // Shopify - implementation('com.shopify.mobilebuysdk:buy3:12.0.0') { - exclude group: "com.shopify.graphql.support" - exclude module: 'joda-time' - } - - // Google Pay - implementation 'com.google.android.gms:play-services-wallet:19.1.0' - - //Compose - implementation 'androidx.activity:activity-compose:1.5.0' - implementation 'androidx.compose.material:material:1.1.1' - implementation 'androidx.compose.animation:animation:1.1.1' - implementation 'androidx.compose.foundation:foundation:1.2.0-rc03' - implementation 'androidx.compose.ui:ui:1.1.1' - implementation 'androidx.compose.ui:ui-tooling:1.1.1' - implementation "com.google.accompanist:accompanist-appcompat-theme:0.23.0" - implementation "com.google.accompanist:accompanist-systemuicontroller:0.23.0" - - implementation "com.github.skydoves:androidveil:1.1.2" - - implementation 'com.github.kirich1409:viewbindingpropertydelegate-noreflection:1.5.6' - - // Shared preferences (encrypted) - implementation 'at.favre.lib:armadillo:0.9.0' - - testImplementation 'junit:junit:4.13.2' - testImplementation "com.google.truth:truth:1.1.3" - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000000..218986fc34 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,182 @@ +plugins { + id("com.android.application") + kotlin("android") + kotlin("kapt") + id("com.google.gms.google-services") + id("com.google.firebase.crashlytics") +} + +android { + compileSdk = AppConfig.compileSdkVersion + + defaultConfig { + applicationId = AppConfig.packageName + minSdk = AppConfig.minSdkVersion + targetSdk = AppConfig.targetSdkVersion + + versionCode = if (project.hasProperty("versionCode")) { + project.property("versionCode") as Int + } 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), + ), + 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), + ), + builder = ::buildConfigField, + ).create() + } + + create("debug_beta") { + initWith(getByName("release")) + versionNameSuffix = "-beta" + applicationIdSuffix = ".debug" + } + } + + 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" + } +} + +repositories { + maven(url = "https://jitpack.io") +} + +dependencies { + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar")))) + implementation(project(":domain")) + implementation(project(":network")) + implementation(project(":common")) + + /** 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) + + /** Compose libraries */ + implementation(Compose.material) + implementation(Compose.animation) + implementation(Compose.foundation) + implementation(Compose.ui) + implementation(Compose.uiTooling) + implementation(Compose.coil) + + /** Firebase libraries */ + implementation(platform(Firebase.bom)) + implementation(Firebase.firebaseAnalytics) + implementation(Firebase.firebaseCrashlytics) + + /** Tangem libraries */ + implementation(Tangem.blockchain) + implementation(Tangem.cardCore) + implementation(Tangem.cardAndroid) + + /** 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) + //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) { + exclude(group = "com.shopify.graphql.support") + exclude(module = "joda-time") + } + implementation(Library.accompanistAppCompatTheme) + implementation(Library.accompanistSystemUiController) + implementation(Library.skydovesVeil) + implementation(Library.viewBindingDelegate) + implementation(Library.armadillo) + implementation(Library.googlePlayServicesWallet) + + /** Testing libraries */ + testImplementation(Test.junit) + testImplementation(Test.truth) + androidTestImplementation(Test.junitAndroidExt) + androidTestImplementation(Test.espresso) +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index f1b424510d..2f9dc5a47e 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,6 +1,6 @@ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. +# proguardFiles setting in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 64f57c2248..0000000000 --- a/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -buildscript { - apply from: 'dependencies.gradle' - - repositories { - google() - jcenter() - maven { url 'https://maven.fabric.io/public' } - } - dependencies { - classpath "com.android.tools.build:gradle:${versions.build_gradle}" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin" - classpath "com.github.dcendents:android-maven-gradle-plugin:2.1" - classpath 'com.google.gms:google-services:4.3.10' - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1' - } -} - -allprojects { - repositories { - google() - jcenter() - mavenLocal() - maven { url "https://nexus.tangem-tech.com/repository/maven-releases/" } - maven { url 'https://jitpack.io' } - maven { url 'https://zendesk.jfrog.io/zendesk/repo' } - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000000..0cc8e9c419 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,30 @@ +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) + } +} + +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") + } +} + +tasks.register("clean", Delete::class) { + delete(rootProject.buildDir) +} \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 0000000000..b22ed732fd --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + `kotlin-dsl` +} + +repositories { + mavenCentral() +} \ No newline at end of file diff --git a/buildSrc/src/main/java/AppConfig.kt b/buildSrc/src/main/java/AppConfig.kt new file mode 100644 index 0000000000..9a7e91768d --- /dev/null +++ b/buildSrc/src/main/java/AppConfig.kt @@ -0,0 +1,8 @@ +object AppConfig { + const val packageName = "com.tangem.wallet" + const val versionCode = 1 + const val versionName = "1.0.0.-SNAPSHOT" + const val minSdkVersion = 21 + const val targetSdkVersion = 33 + const val compileSdkVersion = 33 +} \ No newline at end of file diff --git a/buildSrc/src/main/java/ClasspathDependency.kt b/buildSrc/src/main/java/ClasspathDependency.kt new file mode 100644 index 0000000000..23fcf71450 --- /dev/null +++ b/buildSrc/src/main/java/ClasspathDependency.kt @@ -0,0 +1,9 @@ +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/ConfigFieldBuilder.kt b/buildSrc/src/main/java/ConfigFieldBuilder.kt new file mode 100644 index 0000000000..42c1f16c56 --- /dev/null +++ b/buildSrc/src/main/java/ConfigFieldBuilder.kt @@ -0,0 +1,26 @@ +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("String", "ENVIRONMENT", "\"$value\"") + + class TestActionEnabled(isEnabled: Boolean) : Field("Boolean","TEST_ACTION_ENABLED", isEnabled.toString()) + + class LogEnabled(isEnabled: Boolean) : Field("Boolean","LOG_ENABLED", isEnabled.toString()) +} \ No newline at end of file diff --git a/buildSrc/src/main/java/Dependency.kt b/buildSrc/src/main/java/Dependency.kt new file mode 100644 index 0000000000..25c0e3787a --- /dev/null +++ b/buildSrc/src/main/java/Dependency.kt @@ -0,0 +1,77 @@ +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 material = "androidx.compose.material:material:" + Versions.compose + const val ui = "androidx.compose.ui:ui:" + Versions.compose + const val uiTooling = "androidx.compose.ui:ui-tooling:" + Versions.compose +} + +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 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 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 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 skydovesVeil = "com.github.skydoves:androidveil:" + Versions.skydovesAndroidVeil + 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 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 +} + +object Tangem { + const val blockchain = "com.tangem:blockchain:" + Versions.tangemBlockchainSdk + const val cardAndroid = "com.tangem.tangem-sdk-kotlin:android:" + Versions.tangemCardSgk + const val cardCore = "com.tangem.tangem-sdk-kotlin:core:" + Versions.tangemCardSgk +} + +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 new file mode 100644 index 0000000000..d7d89a1fcd --- /dev/null +++ b/buildSrc/src/main/java/Versions.kt @@ -0,0 +1,68 @@ +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.6.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.1.0" + const val composeFoundation = "1.2.0-rc03" + // endregion Compose + + // region Other libraries + const val accompanist = "0.23.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 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 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 skydovesAndroidVeil = "1.1.2" + const val spongycastleCryptoCore = "1.58.0.0" + const val timber = "4.7.1" + const val viewBindingDelegate = "1.5.6" + const val zendeskChat = "3.3.5" + const val zendeskMessaging = "5.2.4" + const val zxingQrBarcodeScanner = "1.9.8" + const val zxingQrCode = "3.3.3" + // endregion Other libraries + + // region Tangem + const val tangemBlockchainSdk = "develop-133" + const val tangemCardSgk = "develop-165" + // endregion Tangem + + // 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/common/build.gradle b/common/build.gradle.kts similarity index 67% rename from common/build.gradle rename to common/build.gradle.kts index 0412225730..e8259cee84 100644 --- a/common/build.gradle +++ b/common/build.gradle.kts @@ -1,6 +1,6 @@ plugins { - id 'java-library' - id 'org.jetbrains.kotlin.jvm' + id("java-library") + id("org.jetbrains.kotlin.jvm") } java { diff --git a/dependencies.gradle b/dependencies.gradle deleted file mode 100644 index ba7e3c39b6..0000000000 --- a/dependencies.gradle +++ /dev/null @@ -1,14 +0,0 @@ -ext.versions = [ - kotlin : '1.6.10', - build_gradle : '7.1.3', - tangem_card_sdk : 'develop-165', - // tangem_card_sdk : '0.0.1', - tangem_blockchain_sdk: 'develop-133', - // tangem_blockchain_sdk: '0.0.1', -] - -ext.environmentConfig = [ - environment : "ENVIRONMENT", - testActionEnabled: "TEST_ACTION_ENABLED", - logEnabled : "LOG_ENABLED", -] diff --git a/domain/build.gradle b/domain/build.gradle deleted file mode 100644 index 83c9fe6ff1..0000000000 --- a/domain/build.gradle +++ /dev/null @@ -1,88 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' -} - -apply from: '../dependencies.gradle' - -android { - compileSdk 31 - - defaultConfig { - minSdk 21 - targetSdk 31 - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles "consumer-rules.pro" - buildConfigField 'Boolean', environmentConfig.testActionEnabled, 'false' - buildConfigField 'Boolean', environmentConfig.logEnabled, 'false' - } - - buildTypes { - release { - debuggable false - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - buildConfigField 'Boolean', environmentConfig.testActionEnabled, 'false' - buildConfigField 'Boolean', environmentConfig.logEnabled, 'false' - } - debug { - debuggable true - minifyEnabled false - buildConfigField 'Boolean', environmentConfig.testActionEnabled, 'true' - buildConfigField 'Boolean', environmentConfig.logEnabled, 'true' - } - debug_beta { - initWith release - buildConfigField 'Boolean', environmentConfig.testActionEnabled, 'true' - buildConfigField 'Boolean', environmentConfig.logEnabled, 'true' - } - } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -// composeOptions { -// kotlinCompilerExtensionVersion '1.1.0' -// } - packagingOptions { - exclude 'lib/x86_64/darwin/libscrypt.dylib' - exclude 'lib/x86_64/freebsd/libscrypt.so' - exclude 'lib/x86_64/linux/libscrypt.so' - } -} - -dependencies { - implementation implementation(project(path: ':network')) - implementation implementation(project(path: ':common')) - - implementation "com.tangem:blockchain:${versions.tangem_blockchain_sdk}" - implementation "com.tangem.tangem-sdk-kotlin:core:${versions.tangem_card_sdk}" - implementation "com.tangem.tangem-sdk-kotlin:android:${versions.tangem_card_sdk}" - - // Kotlin coroutines - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2' - - // State management - implementation "org.rekotlin:rekotlin:1.0.4" - - // Network - //TODO: it must depends from network module - implementation 'com.squareup.retrofit2:retrofit:2.8.1' - implementation 'com.squareup.retrofit2:converter-moshi:2.6.0' - implementation 'com.squareup.moshi:moshi:1.12.0' - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2' - - // Logs - implementation 'com.jakewharton.timber:timber:4.7.1' - - // Tests - testImplementation 'junit:junit:4.13.2' - testImplementation "com.google.truth:truth:1.1.3" - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' -} \ No newline at end of file diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts new file mode 100644 index 0000000000..6e1c48864e --- /dev/null +++ b/domain/build.gradle.kts @@ -0,0 +1,98 @@ +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" + } +} + +dependencies { + implementation(project(":network")) + implementation(project(":common")) + + /** Tangem libraries */ + implementation(Tangem.blockchain) + implementation(Tangem.cardCore) + implementation(Tangem.cardAndroid) + + /** Other libraries */ + implementation(Library.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) + + /** Testing libraries */ + testImplementation(Test.junit) + testImplementation(Test.truth) + androidTestImplementation(Test.junitAndroidExt) + androidTestImplementation(Test.espresso) +} \ No newline at end of file diff --git a/domain/proguard-rules.pro b/domain/proguard-rules.pro index 481bb43481..ff59496d81 100644 --- a/domain/proguard-rules.pro +++ b/domain/proguard-rules.pro @@ -1,6 +1,6 @@ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. +# proguardFiles setting in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/network/build.gradle b/network/build.gradle deleted file mode 100644 index e7fccceda6..0000000000 --- a/network/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -plugins { - id 'java-library' - id 'org.jetbrains.kotlin.jvm' -} - -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 -} - -dependencies { - implementation implementation(project(path: ':common')) - - // Tangem sdk's - implementation "com.tangem.tangem-sdk-kotlin:core:${versions.tangem_card_sdk}" - - // Kotlin coroutines - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2' - - // Logs - implementation 'com.jakewharton.timber:timber:4.7.1' - - // Network - implementation(platform("com.squareup.okhttp3:okhttp-bom:4.9.3")) - implementation("com.squareup.okhttp3:okhttp") - implementation("com.squareup.okhttp3:logging-interceptor") - implementation 'com.squareup.retrofit2:retrofit:2.8.1' - implementation 'com.squareup.retrofit2:converter-moshi:2.6.0' - implementation 'com.squareup.moshi:moshi:1.13.0' - implementation "com.squareup.moshi:moshi-kotlin:1.13.0" -} \ No newline at end of file diff --git a/network/build.gradle.kts b/network/build.gradle.kts new file mode 100644 index 0000000000..0c82757e05 --- /dev/null +++ b/network/build.gradle.kts @@ -0,0 +1,26 @@ +plugins { + id("java-library") + id("org.jetbrains.kotlin.jvm") +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +dependencies { + implementation(project(":common")) + + /** Tangem libraries */ + implementation(Tangem.cardCore) + + /** Other libraries */ + implementation(Library.retrofit) + implementation(Library.retrofitMoshiConverter) + implementation(Library.moshi) + implementation(Library.moshiKotlin) + implementation(Library.okHttp) + implementation(Library.okHttpLogging) + implementation(Library.timber) + implementation(Library.coroutine) +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 9b33b9462c..0000000000 --- a/settings.gradle +++ /dev/null @@ -1,4 +0,0 @@ -include ':app' -include ':domain' -include ':network' -include ':common' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000000..5e820bbbfc --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,4 @@ +include(":app") +include(":domain") +include(":network") +include(":common") \ No newline at end of file