final String FRAMEWORK_PREBUILTS_DIR = "prebuilts"

android {
    defaultConfig {
        applicationVariants.all { variant ->
            if (variant.flavorName.startsWith("shade")) {
                variant.outputs.each {
                    it.versionNameOverride new Date().format("yyyy-MM-dd HH:mm")
                    if (variant.buildType.name == "release") {
                        it.versionCodeOverride ((System.currentTimeMillis() / 60000) as int)
                    }
                }
            }
        }
    }

    productFlavors {
        shade {
            dimension "app"
            applicationId 'amirz.shade'
            testApplicationId 'amirz.shade.tests'
            versionName 'Q'
        }

        customUI {
            dimension "recents"
        }
    }

    sourceSets {
        shade {
            aidl.srcDirs = ['shade/aidl']
            assets.srcDirs = ['shade/assets']
            res.srcDirs = ['shade/res', 'shade/res_translations', 'shade/res_translations_manual']
            java.srcDirs = ['shade/src', 'shade/src_flags', 'src_shortcuts_overrides', 'shade/src_backport']
            manifest.srcFile "shade/AndroidManifest.xml"
        }

        customUI {
            java.srcDirs = ['shade/src_ui_overrides']
            res.srcDirs = ['shade/res_ui_overrides']
        }
    }

    dependencies {
        // Required for AOSP to compile. This is already included in the sysui_shared.jar
        customUIImplementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'plugin_core.jar')
    }
    
    dexOptions {
        javaMaxHeapSize "3g"
    }
}

apply from: 'shade/smali.gradle'
