app/build.gradle
plugins {
id 'com.android.application'
id 'jacoco'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
id 'com.google.gms.google-services'
}
String getOTMApiKey() {
def api_key = System.getenv("OTM_API_KEY")
if (api_key != null) {
return api_key;
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
return properties.getProperty("OTM_API_KEY");
}
String getOpenAiApiKey() {
def api_key = System.getenv("OPENAI_API_KEY")
if (api_key != null) {
return api_key;
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
return properties.getProperty("OPEN_AI_API_KEY");
}
String getFirebaseMessagingKey() {
def api_key = System.getenv("FIREBASE_MESSAGING_KEY")
if (api_key != null) {
return api_key;
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
return properties.getProperty("FIREBASE_MESSAGING_KEY");
}
android {
namespace 'ch.epfl.culturequest'
compileSdk 33
defaultConfig {
applicationId 'ch.epfl.culturequest'
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "OTM_API_KEY", "\""+getOTMApiKey()+"\""
buildConfigField "String", "OPEN_AI_API_KEY", "\""+getOpenAiApiKey()+"\""
buildConfigField "String", "FIREBASE_MESSAGING_KEY", "\""+getFirebaseMessagingKey()+"\""
buildConfigField "java.util.concurrent.atomic.AtomicBoolean", "IS_TESTING", "new java.util.concurrent.atomic.AtomicBoolean(false)"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_9
targetCompatibility JavaVersion.VERSION_1_9
}
buildFeatures {
viewBinding true
}
signingConfigs {
debug {
storeFile file("external/debug.keystore")
}
}
}
dependencies {
implementation 'com.google.android.gms:play-services-auth:20.4.1'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.firebaseui:firebase-ui-auth:7.2.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.fragment:fragment:1.5.5'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1' // DO NOT UPDATE TO 2.6.0. It creates duplicate classes
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1' // same as above
implementation 'androidx.navigation:navigation-fragment:2.5.3'
implementation 'androidx.navigation:navigation-runtime:2.5.3'
implementation 'androidx.navigation:navigation-ui:2.5.3'
implementation 'com.google.firebase:firebase-analytics:21.2.0'
implementation 'com.google.firebase:firebase-database:20.1.0'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'
testImplementation "androidx.arch.core:core-testing:2.2.0"
implementation 'androidx.test.espresso:espresso-contrib:3.5.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation "io.reactivex.rxjava2:rxjava:2.1.0"
implementation 'com.google.firebase:firebase-storage'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
implementation 'com.theokanning.openai-gpt3-java:service:0.11.0'
implementation 'org.jsoup:jsoup:1.15.4'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.5.1'
androidTestImplementation "com.squareup.okhttp3:mockwebserver:4.9.3"
testImplementation "com.squareup.okhttp3:mockwebserver:4.9.3"
androidTestImplementation 'com.jakewharton.espresso:okhttp3-idling-resource:1.0.0'
testImplementation 'junit:junit:4.13.2'
implementation group: 'org.mockito', name: 'mockito-android', version: '5.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test:rules:1.5.0'
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.5.1'
androidTestImplementation 'androidx.test:monitor:1.6.1'
androidTestImplementation "androidx.navigation:navigation-testing:2.5.3"
androidTestImplementation 'com.21buttons:fragment-test-rule:2.0.1'
debugImplementation "androidx.fragment:fragment-testing:1.5.5"
debugImplementation "androidx.test:monitor:1.6.1"
debugImplementation 'com.21buttons:fragment-test-rule-extras:2.0.1'
testImplementation "org.mockito:mockito-core:5.1.1"
implementation 'com.github.yalantis:ucrop:2.2.8'
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:32.0.0')
// Add the dependencies for the Firebase Cloud Messaging and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-analytics'
implementation "com.squareup.okhttp3:logging-interceptor:4.3.1"
}
configurations.all {
resolutionStrategy {
force 'com.squareup.okhttp3:okhttp:4.9.3'
}
}
configurations.all {
resolutionStrategy {
force 'com.squareup.okhttp3:okhttp:4.9.3'
}
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
reports {
xml.required = true
html.required = true
}
def fileFilter = [
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'android/**/*.*',
'**/databinding/*',
'**/CameraSetup.java',
]
def debugTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug/classes", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"
sourceDirectories.setFrom(files([mainSrc]))
classDirectories.setFrom(files([debugTree]))
executionData.setFrom(fileTree(dir: project.buildDir, includes: [
'outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec',
'outputs/code_coverage/debugAndroidTest/connected/*/coverage.ec'
]))
}
connectedCheck {
finalizedBy jacocoTestReport
}