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 keyProperties = new Properties()
def keyPropertiesFile = rootProject.file("key.properties")
if (keyPropertiesFile.exists()) {
    keyPropertiesFile.withReader('UTF-8') { reader ->
        keyProperties.load(reader)
    }
}


android {
    namespace = "jp.flutterkaigi.ticketReader"
    compileSdk = 35
    ndkVersion = '27.0.12077973'

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

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_17
    }

    defaultConfig {
        applicationId = "jp.flutterkaigi.ticketReader"
        minSdk 28
        targetSdk = 35
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }

    signingConfigs {
        release {
            if (keyPropertiesFile.exists()) {
                keyAlias keyProperties.getProperty('keyAlias')
                keyPassword keyProperties.getProperty('keyPassword')
                storeFile rootProject.file(keyProperties.getProperty('keyStoreFilePath'))
                storePassword keyProperties.getProperty('keyStorePassword')
            }
        }
    }

    buildTypes {
        release {
            signingConfig = signingConfigs.release
        }
    }
}

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