apply plugin: 'com.android.library'
android {
  compileSdkVersion Integer.parseInt(project.COMPILE_SDK_VERSION)
  buildToolsVersion BUILD_TOOLS_VERSION

  defaultConfig {
    minSdkVersion project.MINIMUM_SDK_VERSION
    // This should be a property set in Java code by the user of this lib
    buildConfigField 'boolean', 'DELETE_DB', 'false'

    javaCompileOptions {
      annotationProcessorOptions {
        arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
      }
    }
  }

  buildTypes {
    debug {
      minifyEnabled false
    }

    release {
      minifyEnabled false
      shrinkResources false
    }
  }

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }

  packagingOptions {
    exclude 'META-INF/services/javax.annotation.processing.Processor'
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/MANIFEST.MF'
    exclude 'META-INF/LGPL2.1'
  }

  lintOptions {
    abortOnError false
  }

  libraryVariants.all { variant ->

    variant.buildConfigField "int", "ROOM_SCHEMA_VERSION",
        project.ROOM_SCHEMA_VERSION
    variant.buildConfigField "String", "ROOM_DATABASE_NAME",
        "\"" + project.ROOM_DATABASE_NAME + "\""
  }
}

dependencies {
  implementation fileTree(include: ['*.jar'], dir: 'libs')
  implementation project(path: ':crashreports')
  implementation project(path: ':utils')

  testImplementation "junit:junit:${JUNIT_VERSION}"
  implementation "androidx.appcompat:appcompat:${APPCOMPAT_VERSION}"
  implementation "io.reactivex:rxjava:${RXJAVA_VERSION}"
  implementation "io.reactivex:rxandroid:${RXANDROID_VERSION}"
  implementation "nl.littlerobots.rxlint:rxlint:${Rx_lint_version}"
  // And ProGuard rules for RxJava!
  implementation "com.artemzin.rxjava:proguard-rules:${RXJAVA_PROGUARD_RULES_VERSION}"
  implementation "androidx.room:room-runtime:${ROOM_VERSION}"
  annotationProcessor "androidx.room:room-compiler:${ROOM_VERSION}"

  // RxJava support for Room
  implementation "androidx.room:room-rxjava2:${ROOM_VERSION}"

  implementation "io.reactivex.rxjava2:rxjava:${RXJAVA_2_VERSION}"
  implementation "io.reactivex.rxjava2:rxandroid:${RXANDROID_2_VERSION}"

  implementation "com.google.code.gson:gson:${GSON_VERSION}"
}
