From 1afa2934ac3fba12e92416dc4aa6afbd7c6c4d9b Mon Sep 17 00:00:00 2001 From: ibrahimcanaydogan Date: Mon, 2 Dec 2024 02:40:00 +0300 Subject: [PATCH] stream-chat-android-compose-sample build.gradle converted kts. --- .../build.gradle | 164 ------------------ .../build.gradle.kts | 163 +++++++++++++++++ .../proguard-rules.pro | 2 +- 3 files changed, 164 insertions(+), 165 deletions(-) delete mode 100644 stream-chat-android-compose-sample/build.gradle create mode 100644 stream-chat-android-compose-sample/build.gradle.kts diff --git a/stream-chat-android-compose-sample/build.gradle b/stream-chat-android-compose-sample/build.gradle deleted file mode 100644 index 0d42b60eb9b..00000000000 --- a/stream-chat-android-compose-sample/build.gradle +++ /dev/null @@ -1,164 +0,0 @@ -import io.getstream.chat.android.Dependencies - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'org.jetbrains.kotlin.plugin.compose' -apply plugin: 'com.google.gms.google-services' -apply plugin: 'com.google.firebase.crashlytics' -apply plugin: 'androidx.baselineprofile' - -apply from: "${rootDir}/scripts/android.gradle" -apply from: "${rootDir}/scripts/detekt-compose.gradle" - -android { - namespace "io.getstream.chat.android.compose.sample" - defaultConfig { - targetSdk io.getstream.chat.android.Configuration.sampleTargetSdk - applicationId "io.getstream.chat.android.compose.sample" - versionCode sampleAppVersionCode - versionName sampleAppVersionName - testInstrumentationRunner = "io.qameta.allure.android.runners.AllureAndroidJUnitRunner" - testInstrumentationRunnerArguments["clearPackageData"] = "true" - } - - testOptions { - execution 'ANDROIDX_TEST_ORCHESTRATOR' - } - - File signFile = rootProject.file('.sign/keystore.properties') - if (signFile.exists()) { - Properties properties = new Properties() - properties.load(new FileInputStream(signFile)) - signingConfigs { - release { - storeFile rootProject.file(properties['keystore']) - storePassword properties['storePassword'] - keyAlias properties['keyAlias'] - keyPassword properties['keyPassword'] - } - } - } else { - signingConfigs { - release { - storeFile rootProject.file('.sign/debug.keystore') - storePassword 'android' - keyAlias 'androiddebugkey' - keyPassword 'android' - } - } - } - - signingConfigs.debug { - storeFile rootProject.file('.sign/debug.keystore') - storePassword 'android' - keyAlias 'androiddebugkey' - keyPassword 'android' - } - - buildTypes { - debug { - versionNameSuffix "-DEBUG" - applicationIdSuffix ".debug" - debuggable true - minifyEnabled false - shrinkResources false - signingConfig signingConfigs.debug - buildConfigField "Boolean", "BENCHMARK", "false" - } - benchmark { - debuggable false - signingConfig signingConfigs.debug - matchingFallbacks = ['release'] - proguardFiles 'benchmark-rules.pro' - buildConfigField "Boolean", "BENCHMARK", "true" - } - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.release - buildConfigField "Boolean", "BENCHMARK", "false" - } - } - - flavorDimensions "version" - productFlavors { - demo { - dimension "version" - } - e2e { - dimension "version" - applicationIdSuffix ".e2etest" - } - } - - variantFilter { variant -> - def names = variant.flavors*.name - if (buildType.name != "debug" && names.contains("e2e")) { - setIgnore(true) - } - } - - buildFeatures { - compose true - buildConfig true - } - - lintOptions { - disable 'MissingTranslation' - } -} - -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - freeCompilerArgs += [ - '-opt-in=kotlin.RequiresOptIn', - ] - } -} - -dependencies { - implementation project(':stream-chat-android-compose') - implementation project(":stream-chat-android-offline") - - implementation Dependencies.androidxCoreKtx - implementation Dependencies.androidxAppCompat - implementation Dependencies.materialComponents - implementation Dependencies.streamPushFirebase - implementation Dependencies.streamLog - - // Compose - implementation Dependencies.composeUi - implementation Dependencies.composeUiTooling - implementation Dependencies.composeFoundation - implementation Dependencies.composeMaterial - implementation Dependencies.composeMaterialIcons - - implementation Dependencies.composeActivity - implementation Dependencies.composeAndroidLifecycle - implementation Dependencies.composeViewModel - implementation Dependencies.composeAccompanistPermissions - implementation Dependencies.composeAccompanistPager - - // Coil - implementation Dependencies.composeLandscapistCoil - - // Firebase - implementation Dependencies.firebaseAnalytics - implementation Dependencies.firebaseCrashlytics - - // Instrumentation tests - androidTestImplementation(Dependencies.androidxTestRunner) - androidTestImplementation(Dependencies.androidxUiAutomator) - androidTestImplementation(Dependencies.androidxTestJunitKtx) - androidTestImplementation(Dependencies.androidxTestMonitor) - androidTestUtil(Dependencies.androidxTestOrchestrator) - androidTestImplementation(Dependencies.allureKotlinModel) - androidTestImplementation(Dependencies.allureKotlinJunit) - androidTestImplementation(Dependencies.allureKotlinCommons) - androidTestImplementation(Dependencies.allureKotlinAndroid) - androidTestImplementation(project(":stream-chat-android-e2e-test")) - - detektPlugins(Dependencies.detektFormatting) - - baselineProfile(project(":stream-chat-android-benchmark")) -} diff --git a/stream-chat-android-compose-sample/build.gradle.kts b/stream-chat-android-compose-sample/build.gradle.kts new file mode 100644 index 00000000000..913dab85dc8 --- /dev/null +++ b/stream-chat-android-compose-sample/build.gradle.kts @@ -0,0 +1,163 @@ +import io.getstream.chat.android.Dependencies +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import java.util.Properties +import java.io.FileInputStream + +plugins { + id("com.android.application") + id("kotlin-android") + id("org.jetbrains.kotlin.plugin.compose") + id("com.google.gms.google-services") + id("com.google.firebase.crashlytics") + id("androidx.baselineprofile") +} + +apply(from = "${rootDir}/scripts/android.gradle") +apply(from = "${rootDir}/scripts/detekt-compose.gradle") + +android { + namespace = "io.getstream.chat.android.compose.sample" + defaultConfig { + targetSdk = io.getstream.chat.android.Configuration.sampleTargetSdk + applicationId = "io.getstream.chat.android.compose.sample" + versionCode = 1 // sampleAppVersionCode + versionName = "1.0.0" // sampleAppVersionName + testInstrumentationRunner = "io.qameta.allure.android.runners.AllureAndroidJUnitRunner" + testInstrumentationRunnerArguments["clearPackageData"] = "true" + } + + testOptions.execution = "ANDROIDX_TEST_ORCHESTRATOR" + + val signFile = rootProject.file(".sign/keystore.properties") + signingConfigs { + getByName("debug") { + storeFile = rootProject.file(".sign/debug.keystore") + storePassword = "android" + keyAlias = "androiddebugkey" + keyPassword = "android" + } + + create("release") { + if (signFile.exists()) { + val properties = Properties().apply { + load(FileInputStream(signFile)) + } + storeFile = rootProject.file(properties["keystore"] as String) + storePassword = properties["storePassword"] as String + keyAlias = properties["keyAlias"] as String + keyPassword = properties["keyPassword"] as String + } else { + storeFile = rootProject.file(".sign/debug.keystore") + storePassword = "android" + keyAlias = "androiddebugkey" + keyPassword = "android" + } + } + } + + buildTypes { + getByName("debug") { + versionNameSuffix = "-DEBUG" + applicationIdSuffix = ".debug" + isDebuggable = true + isMinifyEnabled = false + isShrinkResources = false + signingConfig = signingConfigs.getByName("debug") + buildConfigField("Boolean", "BENCHMARK", "false") + } + create("benchmark") { + isDebuggable = false + signingConfig = signingConfigs.getByName("debug") + matchingFallbacks.add("release") + proguardFiles("benchmark-rules.pro") + buildConfigField("Boolean", "BENCHMARK", "true") + } + getByName("release") { + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + signingConfig = signingConfigs.getByName("release") + buildConfigField("Boolean", "BENCHMARK", "false") + } + } + + flavorDimensions.add("version") + productFlavors { + create("demo") { + dimension = "version" + } + create("e2e") { + dimension = "version" + applicationIdSuffix = ".e2etest" + } + } + + androidComponents { + beforeVariants { variantBuilder -> + if (variantBuilder.buildType != "debug" && variantBuilder.productFlavors.any { it.second == "e2e" }) { + variantBuilder.enable = false + } + } + } + + buildFeatures { + compose = true + buildConfig = true + } + + lint { + disable.add("MissingTranslation") + } +} + +tasks.withType().configureEach { + compilerOptions { + freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn") + } +} + +dependencies { + implementation(project(":stream-chat-android-compose")) + implementation(project(":stream-chat-android-offline")) + + implementation(Dependencies.androidxCoreKtx) + implementation(Dependencies.androidxAppCompat) + implementation(Dependencies.materialComponents) + implementation(Dependencies.streamPushFirebase) + implementation(Dependencies.streamLog) + + // Compose + implementation(Dependencies.composeUi) + implementation(Dependencies.composeUiTooling) + implementation(Dependencies.composeFoundation) + implementation(Dependencies.composeMaterial) + implementation(Dependencies.composeMaterialIcons) + + implementation(Dependencies.composeActivity) + implementation(Dependencies.composeAndroidLifecycle) + implementation(Dependencies.composeViewModel) + implementation(Dependencies.composeAccompanistPermissions) + implementation(Dependencies.composeAccompanistPager) + + // Coil + implementation(Dependencies.composeLandscapistCoil) + + // Firebase + implementation(Dependencies.firebaseAnalytics) + implementation(Dependencies.firebaseCrashlytics) + + // Instrumentation tests + androidTestImplementation(Dependencies.androidxTestRunner) + androidTestImplementation(Dependencies.androidxUiAutomator) + androidTestImplementation(Dependencies.androidxTestJunitKtx) + androidTestImplementation(Dependencies.androidxTestMonitor) + androidTestUtil(Dependencies.androidxTestOrchestrator) + androidTestImplementation(Dependencies.allureKotlinModel) + androidTestImplementation(Dependencies.allureKotlinJunit) + androidTestImplementation(Dependencies.allureKotlinCommons) + androidTestImplementation(Dependencies.allureKotlinAndroid) + androidTestImplementation(project(":stream-chat-android-e2e-test")) + + detektPlugins(Dependencies.detektFormatting) + + baselineProfile(project(":stream-chat-android-benchmark")) +} \ No newline at end of file diff --git a/stream-chat-android-compose-sample/proguard-rules.pro b/stream-chat-android-compose-sample/proguard-rules.pro index 481bb434814..ff59496d81a 100644 --- a/stream-chat-android-compose-sample/proguard-rules.pro +++ b/stream-chat-android-compose-sample/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