plugins {
    id "com.android.application"
    id "kotlin-android"
    // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
    id "dev.flutter.flutter-gradle-plugin"
}


def releaseProperties = new Properties()
def releasePropertiesFile = rootProject.file('keystore-release.properties')
if (releasePropertiesFile.exists()) {
    releaseProperties.load(new FileInputStream(releasePropertiesFile))
}

android {
    namespace = "cloud.phylum.drive"
    compileSdk = flutter.compileSdkVersion
    ndkVersion = "27.0.12077973"

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId = "cloud.phylum.drive"
        minSdk = 23
        targetSdk = flutter.targetSdkVersion
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }

    signingConfigs {
        release {
            keyAlias releaseProperties['keyAlias']
            keyPassword releaseProperties['keyPassword']
            storeFile rootProject.file(releaseProperties['storeFile'])
            storePassword releaseProperties['storePassword']
        }
    }

    buildTypes {
        debug {
            applicationIdSuffix ".dev"
            versionNameSuffix "-DEV"
        }
        release {
            signingConfig = signingConfigs.release
        }
    }
}

project(':receive_sharing_intent').afterEvaluate {
    project(':receive_sharing_intent').android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        kotlinOptions {
            jvmTarget = JavaVersion.VERSION_1_8
        }
    }
}

flutter {
    source = "../.."
}
