apply plugin: 'com.android.library'

def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
apply from: expoModulesCorePlugin
applyKotlinExpoModulesCorePlugin()
useCoreDependencies()
useDefaultAndroidSdkVersions()

android {
  namespace "expo.modules.devclient"
  defaultConfig {
    versionCode 1
    versionName "4.0.26"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  }

  buildTypes {
    buildTypes.each {
      it.buildConfigField 'String', 'VERSION', "\"${defaultConfig.versionName}\""
    }

    releaseWithDevLauncher {
      initWith release
      matchingFallbacks = ['release', 'debug']
    }
  }

  sourceSets {
    releaseWithDevLauncher {
      setRoot 'src/debug'
    }
  }

  buildFeatures {
    buildConfig true
    viewBinding true
  }
}

dependencies {
  androidTestImplementation project(":expo-dev-menu-interface")
  androidTestImplementation project(":expo-updates-interface")
  androidTestImplementation project(":expo-dev-menu")
  androidTestImplementation project(":expo-dev-launcher")
  androidTestImplementation project(":expo-manifests")

  androidTestImplementation 'com.facebook.react:react-android'
  androidTestImplementation 'com.facebook.react:hermes-android'

  androidTestImplementation('androidx.test.espresso:espresso-core:3.4.0')
  androidTestImplementation('androidx.test:core:1.4.0')
  androidTestImplementation('androidx.test:core-ktx:1.4.0')
  androidTestImplementation('androidx.test.ext:junit:1.1.3')
  androidTestImplementation('androidx.test.ext:junit-ktx:1.1.3')
  androidTestImplementation('androidx.test:runner:1.4.0')
  androidTestImplementation('androidx.test:rules:1.4.0')

  androidTestImplementation 'org.webkit:android-jsc:+'

  androidTestImplementation "io.insert-koin:koin-test:3.1.2"
  androidTestImplementation "io.insert-koin:koin-test-junit4:3.1.2"

  androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3"
  androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1"

  androidTestImplementation "androidx.appcompat:appcompat:1.1.0"

  androidTestImplementation "com.google.truth:truth:1.1.2"
  androidTestImplementation 'io.mockk:mockk-android:1.12.3'

  // Fixes "e: java.lang.AssertionError: No such enum entry LIBRARY_GROUP_PREFIX in org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl@b254b575"
  // According to the https://stackoverflow.com/a/67736351
  implementation 'androidx.annotation:annotation:1.2.0'
}
