def safeExtGet(prop, fallback) {
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

apply plugin: 'com.android.library'

android {
  compileSdkVersion safeExtGet('compileSdkVersion', 27)
  buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')

  defaultConfig {
    minSdkVersion safeExtGet('minSdkVersion', 16)
    targetSdkVersion safeExtGet('targetSdkVersion', 27)
  }
  lintOptions {
    abortOnError false
    warning 'InvalidPackage'
  }
  testOptions {
    unitTests.all {
      useJUnitPlatform()
    }
    unitTests.returnDefaultValues = true
  }
}

repositories {
  maven { url 'https://maven.getsocial.im/' }
}

dependencies {
  testImplementation "org.junit.jupiter:junit-jupiter-api:5.3.2"
  testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.3.2"
  testImplementation "org.junit.jupiter:junit-jupiter-params:5.3.2"
  compileOnly "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"

  //these classes need to be accessible in the :app project
  api "im.getsocial:getsocial-core:7.12.4@aar"
  api "im.getsocial:getsocial-ui:7.12.4@aar"

  // Optional. GetSocial is using it to obtain more accurate data about installs and make attribution more reliable
  implementation 'com.android.installreferrer:installreferrer:2.1'
}