buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath "com.android.tools.build:gradle:${androidGradleToolsVersion}"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://install.felgo.com/maven/' }
    }
}

apply plugin: 'com.android.application'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation "androidx.appcompat:appcompat:1.2.0"

    implementation 'com.felgo.plugins:plugin-notification:4.+' // local notifications
}

android {
    /*******************************************************
     * The following variables:
     * - androidBuildToolsVersion,
     * - androidCompileSdkVersion
     * - qt5AndroidDir - holds the path to qt android files
     *                   needed to build any Qt application
     *                   on Android.
     *
     * are defined in gradle.properties file. This file is
     * updated by QtCreator and androiddeployqt tools.
     * Changing them manually might break the compilation!
     *******************************************************/

    namespace            androidPackageName
    
    compileSdkVersion    androidCompileSdkVersion.toInteger()
    buildToolsVersion    androidBuildToolsVersion

    compileOptions {
      sourceCompatibility 1.8
      targetCompatibility 1.8
    }

    defaultConfig {
      multiDexEnabled true
      targetSdkVersion   androidCompileSdkVersion.toInteger()
      applicationId    = productIdentifier
      versionCode      = productVersionCode.toInteger()
      versionName      = productVersionName
      minSdkVersion    = project.hasProperty("qtMinSdkVersion") ? qtMinSdkVersion.toInteger() : 23
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
            aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
            res.srcDirs = [qt5AndroidDir + '/res', 'res']
            resources.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
       }
    }

    lintOptions {
        abortOnError false
    }
    aaptOptions { // Do not compress Qt binary resources file
        noCompress 'rcc'
    }
    tasks.withType(JavaCompile) {
        options.incremental = true
    }
    packagingOptions {
        jniLibs {
            useLegacyPackaging = true
        }
    }
}

