app/build.gradle
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'jacoco'
id 'com.google.gms.google-services'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id "androidx.navigation.safeargs.kotlin"
}
// load keystore password from secret file
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
signingConfigs {
debug {
keyAlias 'key0'
keyPassword keystoreProperties['keyPassword']
storeFile file('keystore')
storePassword keystoreProperties['storePassword']
}
release {
keyAlias 'key0'
keyPassword keystoreProperties['keyPassword']
storeFile file('keystore')
storePassword keystoreProperties['storePassword']
}
}
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.github.HumanLearning2021.HumanLearningApp"
minSdkVersion 24
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "com.github.HumanLearning2021.HumanLearningApp.CustomTestRunner"
// Fix Room incremental processing
javaCompileOptions {
annotationProcessorOptions {
arguments["room.incremental"] = "true"
}
}
signingConfig signingConfigs.release
}
buildFeatures {
viewBinding true
}
viewBinding {
enabled = true
}
buildTypes {
debug {
testCoverageEnabled true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
testOptions {
unitTests.returnDefaultValues = true
}
lintOptions {
// This one suggests deleting the v24 res folders as the minSdk is higher than 24, yet doing
// so causes the app to not build
disable 'ObsoleteSdkInt'
// This one complains that bitmaps should not be in the drawable folder. However, it works as
// is and when moving them to the suggested folder, the images become very low resolution
disable 'IconLocation'
// Didn't find a way to fix this, but it does not seem to cause any issue as we've been
// using the learning for a while
disable 'ClickableViewAccessibility'
}
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
reports {
xml.enabled = true
html.enabled = true
}
def fileFilter = [
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'android/**/*.*',
// Exclude Hilt generated classes
'**/*Hilt*.*',
'hilt_aggregated_deps/**',
'**/*_Factory.class',
'**/*_MembersInjector.class',
// Not coverable by any tests
'**/com/github/HumanLearning2021/HumanLearningApp/App*',
]
def debugTree = fileTree(dir: "$project.buildDir/tmp/kotlin-classes/debug", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"
sourceDirectories.setFrom(files([mainSrc]))
classDirectories.setFrom(files([debugTree]))
executionData.setFrom(fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec', 'outputs/code_coverage/debugAndroidTest/connected/*coverage.ec'
]))
}
connectedCheck {
finalizedBy jacocoTestReport
}
dependencies {
def fragment_version = "1.3.4"
def room_version = "2.3.0"
apply plugin: 'kotlin-parcelize'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
//set to 1.3.0 on purpose instead of 1.3.1 because otherwise cirrus crashes
//noinspection GradleDependency
implementation "androidx.fragment:fragment-ktx:$fragment_version"
implementation 'androidx.activity:activity-ktx:1.2.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.4.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
// Glide
implementation 'com.github.bumptech.glide:glide:4.12.0'
kapt 'com.github.bumptech.glide:compiler:4.12.0'
// Firebase
implementation platform('com.google.firebase:firebase-bom:26.6.0')
implementation 'com.google.firebase:firebase-firestore-ktx'
implementation 'com.google.firebase:firebase-storage-ktx'
implementation 'com.firebaseui:firebase-ui-storage:6.4.0'
implementation 'com.firebaseui:firebase-ui-auth:6.4.0'
implementation 'com.google.firebase:firebase-auth-ktx'
// Hilt
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-compiler:$hilt_version"
androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_version"
kaptAndroidTest "com.google.dagger:hilt-android-compiler:$hilt_version"
// Test frameworks
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.4.3'
testImplementation "org.mockito:mockito-core:3.8.0"
androidTestImplementation "org.mockito:mockito-android:3.8.0"
testImplementation 'org.mockito:mockito-inline:3.8.0'
testImplementation 'org.robolectric:robolectric:4.4'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation('com.schibsted.spain:barista:3.8.0') {
exclude group: 'org.jetbrains.kotlin'
}
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
//Room
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
// Fix Room incremental Processing
annotationProcessor "androidx.room:room-compiler:$room_version"
// Navigation Component dependencies
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
debugImplementation "androidx.fragment:fragment-testing:$fragment_version"
implementation "androidx.camera:camera-core:1.1.0-alpha04"
implementation "androidx.camera:camera-camera2:1.1.0-alpha04"
implementation "androidx.camera:camera-lifecycle:1.1.0-alpha04"
implementation "androidx.camera:camera-view:1.0.0-alpha24"
//Graphs
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}
repositories {
maven { url 'https://jitpack.io' }
}