apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'  // to send safeArgs between different fragments we must parcelize
apply plugin: "androidx.navigation.safeargs.kotlin"  //id 'androidx.navigation.safeargs'
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: 'maven-publish'  // CHECK:PM needed for jitpack.io?
apply plugin: 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'

def VERSION_NAME="$VERSION_CODE"

android {
  compileSdkVersion 31
  buildToolsVersion "30.0.3"

  namespace 'cy.ac.ucy.cs.anyplace.logger'

  defaultConfig {
    applicationId "cy.ac.ucy.cs.anyplace.logger"
    minSdkVersion 29    // AndroidX (android 9)
    //noinspection OldTargetApi
    targetSdkVersion 31
    versionCode 15
    versionName "$VERSION_NAME-log"

     testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
  }

  kotlinOptions {
    jvmTarget = '11'
  }

  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
  }
  buildFeatures {
    dataBinding true
    viewBinding true
  }
  packagingOptions {
    resources {
      excludes += ['META-INF/DEPENDENCIES']
    }
  }
}

dependencies {
  // KOTLIN
  implementation "androidx.core:core-ktx:1.7.0"

  // Internal libraries
  //// UI NAVIGATION
  implementation "androidx.navigation:navigation-fragment-ktx:$ver_nav"
  implementation "androidx.navigation:navigation-ui-ktx:$ver_nav"
  implementation 'androidx.appcompat:appcompat:1.4.1'
  implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
  implementation 'androidx.preference:preference-ktx:1.2.0'
  implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
  implementation 'com.google.android.material:material:1.5.0'

  //// COROUTINES
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$ver_coroutines"
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$ver_coroutines"
  implementation "androidx.lifecycle:lifecycle-runtime-ktx:$ver_lifecycle"
  implementation "androidx.lifecycle:lifecycle-service:$ver_lifecycle"

  // GOOGLE SERVICES
  //// GOOGLE MAPS & UTILS
  implementation 'com.google.android.gms:play-services-maps:18.0.2'
  implementation 'com.google.maps.android:android-maps-utils:2.3.0'
  //// FusedLocation (coarse/fine grain)
  implementation 'com.google.android.gms:play-services-location:19.0.1'

  implementation 'androidx.legacy:legacy-support-v4:1.0.0'
  //// DEPENDENCY INJECTION (dagger/hilt)
  implementation "com.google.dagger:hilt-android:$ver_hilt"
  kapt "com.google.dagger:hilt-compiler:$ver_hilt"
  kapt "com.google.dagger:dagger-android-processor:$ver_hilt"

  // RETROFIT
  implementation 'com.squareup.retrofit2:retrofit:2.9.0'
  implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
  implementation 'com.squareup.okhttp3:okhttp:4.3.1'

  // ANYPLACE LIBRARIES:
  //// REMOTE (from libraries published on JitPack)
  // implementation 'com.github.dmsl:anyplace-lib-core:4.0.2'
  // implementation 'com.github.dmsl:anyplace-lib-android:v4.0.1'
  //// LOCAL: requires pulling the all submodules (see README.md)
  implementation project(path: ':lib-android')
  implementation project(path: ':lib-core')

  // Testing:
   testImplementation 'junit:junit:4.13.2'
   androidTestImplementation 'androidx.test.ext:junit:1.1.3'
   androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}