plugins {
    id 'com.android.application'
    id 'com.chaquo.python'
}

android {
    signingConfigs {
        release {
            storeFile file('../keystore')
            storePassword 'android'
            keyAlias 'key0'
            keyPassword 'android'
        }
    }
    compileSdk 34

    defaultConfig {
        applicationId "com.pcapdroid.mitm"
        minSdk 21
        targetSdk 34
        versionCode 21
        versionName "1.4"

        // see productFlavors below
        /*ndk {
            abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
        }*/

        python {
            version "3.10"
            pip {
                install "../submodules/mitmproxy" // 11.0.0
                install "beautifulsoup4"
                options "--find-links", "../submodules/chaquopy-wheels"
            }
            pyc {
                src true
            }
        }
    }

    // NOTE: abi splits currently not supported by chaquopy
    // https://github.com/chaquo/chaquopy/issues/449
    // https://chaquo.com/chaquopy/doc/current/faq.html#faq-size
    flavorDimensions "abi"
    productFlavors {
        arm32 {
            dimension "abi"
            ndk { abiFilters "armeabi-v7a" }
        }
        arm64 {
            dimension "abi"
            ndk { abiFilters "arm64-v8a" }
        }
        x86 {
            dimension "abi"
            ndk { abiFilters "x86" }
        }
        x86_64 {
            dimension "abi"
            ndk { abiFilters "x86_64" }
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    namespace 'com.pcapdroid.mitm'
}

dependencies {}
