plugins { alias(libs.plugins.android.application) alias(libs.plugins.google.ksp) alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.kapt) alias(libs.plugins.kotlin.parcelize) alias(libs.plugins.aboutlibraries) } apply from: 'getGitSha.gradle' final def gitSha = ext.getGitSha() // The app name final def APP_NAME = "Pachli" // The application id. Must be unique, e.g. based on your domain final def APP_ID = "app.pachli" // url of a custom app logo. Recommended size at least 600x600. Keep empty to use the default logo. final def CUSTOM_LOGO_URL = "" // e.g. mastodon.social. Keep empty to not suggest any instance on the signup screen final def CUSTOM_INSTANCE = "" // link to your support account. Will be linked on the about page when not empty. final def SUPPORT_ACCOUNT_URL = "https://mastodon.social/@Pachli" android { compileSdk 33 namespace "app.pachli" defaultConfig { applicationId APP_ID namespace "app.pachli" minSdk 23 targetSdk 33 versionCode 2 versionName "1.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true resValue "string", "app_name", APP_NAME buildConfigField("String", "CUSTOM_LOGO_URL", "\"$CUSTOM_LOGO_URL\"") buildConfigField("String", "CUSTOM_INSTANCE", "\"$CUSTOM_INSTANCE\"") buildConfigField("String", "SUPPORT_ACCOUNT_URL", "\"$SUPPORT_ACCOUNT_URL\"") } buildTypes { release { minifyEnabled true shrinkResources true proguardFiles 'proguard-rules.pro' } } flavorDimensions += "color" productFlavors { blue {} orange { resValue "string", "app_name", APP_NAME + " Current" applicationIdSuffix ".current" versionNameSuffix "-" + gitSha } } lint { lintConfig file("lint.xml") // Regenerate by running `./gradlew app:newLintBaseline` baseline = file("lint-baseline.xml") } buildFeatures { buildConfig true resValues true viewBinding true } testOptions { unitTests { returnDefaultValues = true includeAndroidResources = true } unitTests.all { systemProperty 'robolectric.logging.enabled', 'true' systemProperty 'robolectric.lazyload', 'ON' } } sourceSets { androidTest.assets.srcDirs += files("$projectDir/schemas".toString()) } // Exclude unneeded files added by libraries packagingOptions.resources.excludes += [ 'LICENSE_OFL', 'LICENSE_UNICODE', ] bundle { language { // bundle all languages in every apk so the dynamic language switching works enableSplit = false } } dependenciesInfo { includeInApk false includeInBundle false } // Can remove this once https://issuetracker.google.com/issues/260059413 is fixed. // https://kotlinlang.org/docs/gradle-configure-project.html#gradle-java-toolchains-support compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } applicationVariants.configureEach { variant -> variant.outputs.configureEach { outputFileName = "Pachli_${variant.versionName}_${variant.versionCode}_${gitSha}_" + "${variant.flavorName}_${buildType.name}.apk" } } } ksp { arg("room.schemaLocation", "$projectDir/schemas") arg("room.incremental", "true") } configurations { // JNI-only libraries don't play nicely with Robolectric // see https://github.com/tuskyapp/Tusky/pull/3367 testImplementation.exclude group: "org.conscrypt", module: "conscrypt-android" testRuntime.exclude group: "org.conscrypt", module: "conscrypt-android" } aboutLibraries { configPath = "licenses" includePlatform = false duplicationMode = com.mikepenz.aboutlibraries.plugin.DuplicateMode.MERGE prettyPrint = true } // library versions are in PROJECT_ROOT/gradle/libs.versions.toml dependencies { implementation libs.kotlinx.coroutines.android implementation libs.kotlinx.coroutines.rx3 implementation libs.bundles.androidx implementation libs.bundles.room ksp libs.androidx.room.compiler implementation libs.android.material implementation libs.gson implementation libs.bundles.retrofit implementation libs.networkresult.calladapter implementation libs.bundles.okhttp implementation libs.conscrypt.android implementation libs.bundles.glide ksp libs.glide.compiler implementation libs.bundles.rxjava3 implementation libs.bundles.autodispose implementation libs.bundles.dagger kapt libs.bundles.dagger.processors implementation libs.sparkbutton implementation libs.touchimageview implementation libs.bundles.material.drawer implementation libs.material.typeface implementation libs.image.cropper implementation libs.bundles.filemojicompat implementation libs.bouncycastle implementation libs.unified.push implementation libs.bundles.xmldiff implementation libs.bundles.aboutlibraries testImplementation libs.androidx.test.junit testImplementation libs.robolectric testImplementation libs.bundles.mockito testImplementation libs.mockwebserver testImplementation libs.androidx.core.testing testImplementation libs.kotlinx.coroutines.test testImplementation libs.androidx.work.testing testImplementation libs.truth testImplementation libs.turbine androidTestImplementation libs.espresso.core androidTestImplementation libs.androidx.room.testing androidTestImplementation libs.androidx.test.junit } tasks.register("newLintBaseline") { description 'Deletes and then recreates the lint baseline' // This task should always run, irrespective of caching notCompatibleWithConfigurationCache("Is always out of date") outputs.upToDateWhen { false } doLast { delete android.lint.baseline.path } // Regenerate the lint baseline it.finalizedBy tasks.named("lintBlueDebug") }