apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'androidx.benchmark'

android {
  compileSdkVersion Config.compileSdkVersion

  defaultConfig {
    minSdkVersion Config.webView_minSdkVersion
    targetSdkVersion Config.targetSdkVersion
    missingDimensionStrategy 'abi', 'abi_all', 'abi_arm', 'abi_arm64', 'abi_x86'
    // warning: keep in sync with ".gitlab-ci.yml"
    testInstrumentationRunnerArgument 'androidx.benchmark.output.enable', 'true'
    testInstrumentationRunnerArgument 'androidx.benchmark.suppressErrors', 'LOW-BATTERY'
    testInstrumentationRunner 'androidx.benchmark.junit4.AndroidBenchmarkRunner'
  }

  testBuildType = "release"

  buildTypes {
    release {
      isDefault = true
      minifyEnabled true
      proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'benchmark-proguard-rules.pro'
      signingConfig signingConfigs.debug
    }
  }

  kotlinOptions {
    jvmTarget = Config.jvmTarget
  }

  sourceSets {
    androidTest.java.srcDirs += 'src/androidTest/java'
  }
}

dependencies {
  api project(':adblock-android-settings')
  api project(':adblock-android-webview')
  androidTestImplementation Deps.androidx_test_espresso_core
  androidTestImplementation Deps.androidx_test_espresso_web
  androidTestImplementation Deps.mockito_core
  androidTestImplementation Deps.mockito_android
  androidTestImplementation Deps.mockito_kotlin
  androidTestImplementation Deps.timber
  androidTestImplementation Deps.wiremock_standalone
  androidTestImplementation project(':adblock-android')
  // All of the following could be androidTestImplementation, but Android Studio 4.1 doesn't
  // navigate dependencies good enough. So it's left as is because it's a non-production module.
  implementation Deps.kotlin_stdlib
  implementation Deps.androidx_benchmark_junit4
  implementation Deps.androidx_test_core
  implementation Deps.androidx_test_runner
  implementation Deps.androidx_test_ext_junit
  implementation Deps.androidx_benchmark_common
  implementation Deps.androidx_benchmark_junit4
  implementation Deps.junit4
}
