apply plugin: "com.android.library"
apply plugin: "com.facebook.react"

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

android {
    namespace "com.huawei.hms.rn.iap"
    compileSdkVersion safeExtGet("compileSdkVersion", 36)

    defaultConfig {
        minSdkVersion safeExtGet("minSdkVersion", 21)
        targetSdkVersion safeExtGet("targetSdkVersion", 36)
    }

    lintOptions {
        abortOnError false
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
}

react {
    jsRootDir = file("../src/specs")
    libraryName = "HMSIapModuleSpec"
    codegenJavaPackageName = "com.huawei.hms.rn.iap"
}

repositories {
    google()
    mavenCentral()
    maven { url "https://developer.huawei.com/repo/" }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-android"
    implementation "com.huawei.agconnect:agconnect-core:1.9.1.301"
    implementation "com.huawei.hms:iap:6.13.0.300"
    implementation "com.google.code.gson:gson:2.9.1"
}
