ext {
    junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
    androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
}

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.5.2'
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24'
    }
}

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

android {
    namespace 'dev.mushimushi.capacitor'
    compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36

    defaultConfig {
        minSdk project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
        consumerProguardFiles 'mushi-android/consumer-rules.pro'
    }

    sourceSets {
        main {
            java.srcDirs += 'mushi-android/src/main/kotlin'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = '17'
    }
}

repositories {
    google()
    mavenCentral()
}

dependencies {
    implementation "androidx.core:core-ktx:${project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.17.0'}"
    implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
    implementation "androidx.fragment:fragment-ktx:${project.hasProperty('androidxFragmentVersion') ? rootProject.ext.androidxFragmentVersion : '1.8.9'}"
    implementation project(':capacitor-android')
    implementation 'com.squareup.okhttp3:okhttp:4.12.0'
    implementation 'com.google.code.gson:gson:2.11.0'
    compileOnly 'io.sentry:sentry:7.18.1'

    testImplementation "junit:junit:$junitVersion"
}
