buildscript {
    ext {
        def projectConfigFilePath = "$rootDir/notificare-gradle-config.json"
        def jsonFile = new File(projectConfigFilePath)
        notificareConfig = new groovy.json.JsonSlurper().parseText(jsonFile.text)
    }

    repositories {
        google()
        mavenCentral()
        maven { url "https://maven.notifica.re/releases" }
    }
    dependencies {
        String notificareServicesGradlePluginClassPath = "re.notifica.gradle:notificare-services:${notificareConfig.NOTIFICARE_SERVICES_GRADLE_PLUGIN_VERSION}"
        println "Adding classpath: $notificareServicesGradlePluginClassPath"
        classpath notificareServicesGradlePluginClassPath
    }
}

android {
    kotlinOptions {
        jvmTarget = cordovaConfig.KOTLIN_JVM_TARGET ?: '1.8'
        freeCompilerArgs += [
                '-Xopt-in=re.notifica.InternalNotificareApi',
        ]
    }
}

repositories {
    google()
    mavenCentral()
    maven { url "https://maven.notifica.re/releases" }
    maven { url "https://maven.notifica.re/prereleases" }
}

dependencies {
    def notificare_version = '4.2.3'
    implementation "re.notifica:notificare:$notificare_version"
    implementation "re.notifica:notificare-utilities:$notificare_version"
}

cdvPluginPostBuildExtras.add({
    apply plugin: re.notifica.gradle.NotificareServicesPlugin
})
