plugins { id 'com.android.application' id 'kotlin-android' id 'kotlin-kapt' id 'kotlin-parcelize' id 'androidx.navigation.safeargs.kotlin' id 'com.bugsnag.android.gradle' id 'dagger.hilt.android.plugin' } def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim() def buildTime = new Date().format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("GMT+1")) android { def packageName = "eu.darken.capod" compileSdkVersion buildConfig.compileSdk defaultConfig { applicationId "${packageName}" minSdkVersion buildConfig.minSdk targetSdkVersion buildConfig.targetSdk versionCode buildConfig.version.code versionName buildConfig.version.name testInstrumentationRunner "eu.darken.capod.HiltTestRunner" buildConfigField "String", "GITSHA", "\"${gitSha}\"" buildConfigField "String", "BUILDTIME", "\"${buildTime}\"" manifestPlaceholders = [bugsnagApiKey: "fake"] } signingConfigs { releaseFoss {} releaseGplay {} } signingConfigs { releaseFoss { def signingFossPropFile = new File(System.properties['user.home'], ".appconfig/${packageName}/signing-foss.properties") Properties signingPropsFoss = new Properties() if (signingFossPropFile.canRead()) signingPropsFoss.load(new FileInputStream(signingFossPropFile)) String keyStorePathFoss = System.getenv("STORE_PATH") ?: signingPropsFoss["release.storePath"] File keyStoreFoss = keyStorePathFoss ? new File(keyStorePathFoss) : null if (keyStoreFoss?.canRead()) { storeFile keyStoreFoss storePassword System.getenv("STORE_PASSWORD") ?: signingPropsFoss['release.storePassword'] keyAlias System.getenv("KEY_ALIAS") ?: signingPropsFoss['release.keyAlias'] keyPassword System.getenv("KEY_PASSWORD") ?: signingPropsFoss['release.keyPassword'] } } releaseGplay { def signingGplayPropFile = new File(System.properties['user.home'], ".appconfig/${packageName}/signing-gplay.properties") Properties signingPropsGplay = new Properties() if (signingGplayPropFile.canRead()) signingPropsGplay.load(new FileInputStream(signingGplayPropFile)) String keyStorePathGplay = System.getenv("STORE_PATH") ?: signingPropsGplay["release.storePath"] File keyStoreGplay = keyStorePathGplay ? new File(keyStorePathGplay) : null if (keyStoreGplay?.canRead()) { storeFile keyStoreGplay storePassword System.getenv("STORE_PASSWORD") ?: signingPropsGplay['release.storePassword'] keyAlias System.getenv("KEY_ALIAS") ?: signingPropsGplay['release.keyAlias'] keyPassword System.getenv("KEY_PASSWORD") ?: signingPropsGplay['release.keyPassword'] } } } flavorDimensions "version" productFlavors { foss { signingConfig signingConfigs.releaseFoss } gplay { signingConfig signingConfigs.releaseGplay } } Properties bugsnagProps = new Properties() def bugsnagPropsFile = new File(System.properties['user.home'], ".appconfig/${packageName}/bugsnag.properties") if (bugsnagPropsFile.canRead()) bugsnagProps.load(new FileInputStream(bugsnagPropsFile)) String bugSnagApiKey = System.getenv("BUGSNAG_API_KEY") ?: bugsnagProps.getProperty("bugsnag.apikey", "") buildTypes { def proguardRulesRelease = fileTree(dir: "../proguard", include: ["*.pro"]).asList().toArray() debug { minifyEnabled false shrinkResources false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt') proguardFiles proguardRulesRelease proguardFiles 'proguard-rules-debug.pro' manifestPlaceholders = [bugsnagApiKey: bugSnagApiKey] } beta { lintOptions { abortOnError true fatal 'StopShip' } minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt') proguardFiles proguardRulesRelease manifestPlaceholders = [bugsnagApiKey: bugSnagApiKey] } release { lintOptions { abortOnError true fatal 'StopShip' } minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt') proguardFiles proguardRulesRelease manifestPlaceholders = [bugsnagApiKey: bugSnagApiKey] } } applicationVariants.all { variant -> def flavor = variant.productFlavors[0].name.toUpperCase() def buildType = variant.buildType.name.toUpperCase() def versionCode = defaultConfig.versionCode def versionName = defaultConfig.versionName if (variant.buildType.name == "debug") { variant.mergedFlavor.resourceConfigurations.clear() variant.mergedFlavor.resourceConfigurations.add("en") variant.mergedFlavor.resourceConfigurations.add("de") } else if (variant.buildType.name != "debug") { variant.outputs.each { output -> output.outputFileName = "${packageName}-v${versionName}(${versionCode})-${gitSha}-${flavor}-${buildType}.apk" } } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } buildFeatures { viewBinding true } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { jvmTarget = "1.8" freeCompilerArgs += [ "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xopt-in=kotlinx.coroutines.FlowPreview", "-Xopt-in=kotlin.time.ExperimentalTime", "-Xopt-in=kotlin.ExperimentalUnsignedTypes", "-Xopt-in=kotlin.contracts.ExperimentalContracts", "-Xopt-in=kotlin.RequiresOptIn" ] } } testOptions { unitTests.all { useJUnitPlatform() } unitTests { includeAndroidResources = true } } sourceSets { test { java.srcDirs += "$projectDir/src/testShared/java" } androidTest { java.srcDirs += "$projectDir/src/testShared/java" androidTest.assets.srcDirs += files("$projectDir/schemas".toString()) } } } dependencies { implementation(project(":app-common")) // Kotlin implementation "org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin.core}" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlin.coroutines}" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlin.coroutines}" testImplementation "org.jetbrains.kotlin:kotlin-reflect:${versions.kotlin.core}" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.kotlin.coroutines}" androidTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.kotlin.coroutines}") { // conflicts with mockito due to direct inclusion of byte buddy exclude group: "org.jetbrains.kotlinx", module: "kotlinx-coroutines-debug" } // Debugging implementation('com.bugsnag:bugsnag-android:5.9.2') implementation 'com.getkeepsafe.relinker:relinker:1.4.3' implementation("com.squareup.moshi:moshi:1.13.0") kapt("com.squareup.moshi:moshi-kotlin-codegen:1.13.0") // DI implementation "com.google.dagger:dagger:${versions.dagger.core}" implementation "com.google.dagger:dagger-android:${versions.dagger.core}" kapt "com.google.dagger:dagger-compiler:${versions.dagger.core}" kapt "com.google.dagger:dagger-android-processor:${versions.dagger.core}" implementation "com.google.dagger:hilt-android:${versions.dagger.core}" kapt "com.google.dagger:hilt-android-compiler:${versions.dagger.core}" testImplementation "com.google.dagger:hilt-android-testing:${versions.dagger.core}" kaptTest "com.google.dagger:hilt-android-compiler:${versions.dagger.core}" androidTestImplementation "com.google.dagger:hilt-android-testing:${versions.dagger.core}" kaptAndroidTest "com.google.dagger:hilt-android-compiler:${versions.dagger.core}" kapt "androidx.hilt:hilt-compiler:1.0.0" implementation 'androidx.hilt:hilt-common:1.0.0' kaptTest "androidx.hilt:hilt-compiler:1.0.0" testImplementation 'androidx.hilt:hilt-common:1.0.0' // Support libs implementation 'androidx.core:core-ktx:1.7.0' implementation 'androidx.appcompat:appcompat:1.4.0' implementation 'androidx.annotation:annotation:1.3.0' implementation 'androidx.activity:activity-ktx:1.5.1' implementation 'androidx.fragment:fragment-ktx:1.5.2' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0' implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.0' implementation 'androidx.lifecycle:lifecycle-common-java8:2.4.0' implementation 'androidx.lifecycle:lifecycle-process:2.4.0' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0' implementation "androidx.navigation:navigation-fragment-ktx:2.5.1" implementation "androidx.navigation:navigation-ui-ktx:2.5.1" implementation 'androidx.preference:preference-ktx:1.1.1' implementation 'androidx.core:core-splashscreen:1.0.0' def work_version = "2.7.1" implementation "androidx.work:work-runtime:${work_version}" testImplementation "androidx.work:work-testing:${work_version}" implementation "androidx.work:work-runtime-ktx:${work_version}" implementation 'androidx.hilt:hilt-work:1.0.0' // IAP gplayImplementation 'com.android.billingclient:billing:4.0.0' // UI implementation 'androidx.constraintlayout:constraintlayout:2.1.2' implementation 'com.google.android.material:material:1.6.0-alpha01' // Testing testImplementation 'junit:junit:4.13.2' testImplementation "org.junit.vintage:junit-vintage-engine:5.7.1" testImplementation "androidx.test:core-ktx:1.4.0" testImplementation "io.mockk:mockk:1.12.1" androidTestImplementation "io.mockk:mockk-android:1.11.0" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.7.1" testImplementation "org.junit.jupiter:junit-jupiter-api:5.7.1" testImplementation "org.junit.jupiter:junit-jupiter-params:5.7.1" androidTestImplementation "androidx.navigation:navigation-testing:2.3.5" testImplementation "io.kotest:kotest-runner-junit5:4.6.2" testImplementation "io.kotest:kotest-assertions-core-jvm:4.6.2" testImplementation "io.kotest:kotest-property-jvm:4.6.2" androidTestImplementation "io.kotest:kotest-assertions-core-jvm:4.6.2" androidTestImplementation "io.kotest:kotest-property-jvm:4.6.2" testImplementation 'android.arch.core:core-testing:1.1.1' androidTestImplementation 'android.arch.core:core-testing:1.1.1' debugImplementation 'androidx.test:core-ktx:1.4.0' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test:runner:1.4.0' androidTestImplementation 'androidx.test:rules:1.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-intents:3.4.0' androidTestImplementation 'androidx.test.espresso.idling:idling-concurrent:3.4.0' }