buildscript {
  ext {
    kotlinVersion = '1.8.0'
    buildToolsVersion = '33.0.0'
    compileSdkVersion = 35
    targetSdkVersion = 34
    minSdkVersion = 21
  }

  ext.detoxKotlinVersion = ext.kotlinVersion

  ext.getExtOrDefault = {name ->
    return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['LevinEncryptedUploader_' + name]
  }

  repositories {
    mavenCentral()
    google()
    maven { url 'https://www.jitpack.io' }
  }

  dependencies {
    classpath 'com.android.tools.build:gradle:7.4.2'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
  }
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.facebook.react'

android {
  namespace "com.levinencrypteduploader"
  compileSdkVersion rootProject.ext.compileSdkVersion
  buildToolsVersion rootProject.ext.buildToolsVersion

  defaultConfig {
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
  }

  buildFeatures {
    buildConfig true
  }

  buildTypes {
    release {
      minifyEnabled false
    }
  }

  lintOptions {
    disable "GradleCompatible"
    abortOnError false
  }

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_17
    targetCompatibility JavaVersion.VERSION_17
  }
  kotlinOptions {
    jvmTarget = "17"
  }
}

repositories {
  mavenCentral()
  maven { url 'https://www.jitpack.io' }
  mavenLocal()
  google()
}

def _ext = ext

def _kotlinVersion = _ext.has('detoxKotlinVersion') ? _ext.detoxKotlinVersion : '1.3.10'
def _kotlinStdlib = _ext.has('detoxKotlinStdlib') ? _ext.detoxKotlinStdlib : 'kotlin-stdlib-jdk8'

dependencies {
  implementation "com.facebook.react:react-android"
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
  implementation "androidx.core:core-ktx:1.12.0"
  implementation "com.squareup.okhttp3:okhttp:4.7.2"
  implementation "org.conscrypt:conscrypt-android:2.5.2"
  implementation 'com.facebook.react:react-android:+'
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
  implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
  implementation 'com.google.crypto.tink:tink-android:1.7.0'
  implementation 'androidx.work:work-runtime-ktx:2.8.1'


  testImplementation 'junit:junit:4.13.2'
  testImplementation 'org.mockito:mockito-core:4.0.0'
  testImplementation 'org.mockito.kotlin:mockito-kotlin:4.0.0'
  testImplementation 'com.squareup.okhttp3:mockwebserver:4.9.3'
  testImplementation 'androidx.test:core:1.5.0'
  testImplementation 'androidx.test:runner:1.5.2'
  testImplementation 'androidx.test:rules:1.5.0'
  testImplementation 'androidx.test.ext:junit:1.1.5'
  testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.8.0'
  androidTestImplementation 'androidx.test:core:1.5.0'
  androidTestImplementation 'androidx.test:runner:1.5.2'
  androidTestImplementation 'androidx.test:rules:1.5.0'
  androidTestImplementation 'androidx.test.ext:junit:1.1.5'
}


android.libraryVariants.all { variant ->
    tasks.named("compile${variant.name.capitalize()}Kotlin") {
        dependsOn(tasks.named("generate${variant.name.capitalize()}BuildConfig"))
    }
}