buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:8.5.1"
    }
}

repositories {
    google()
    mavenLocal()
    mavenCentral()
}

apply plugin: 'com.android.application'

android {
    namespace "software.amazon.awssdk.iotsamples"
    compileSdk 35

    defaultConfig {
        applicationId "software.amazon.awssdk.iotsamples"
        minSdkVersion 24
        targetSdkVersion 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    // Make sure JNI libs are packaged UNCOMPRESSED (so AGP can align them)
    packagingOptions {
        jniLibs {
            useLegacyPackaging false
        }
    }

    buildFeatures {
        buildConfig true
    }

    publishing {
        // Creates the 'release' SoftwareComponent used by maven-publish
        singleVariant("release") {
            withSourcesJar()
        }
        // If you also need debug: singleVariant("debug")
    }

    sourceSets {
        main {
            java.srcDir '../../Mqtt/Mqtt5X509/src/main/java'
            java.srcDir '../AndroidKeyChainPubSub/src/main/java'
            java.srcDir 'src/main/java'
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
        // Enable desugaring so that Android lint doesn't flag `java.time` usage. Downstream
        // consumers will need to enable desugaring to use this library.
        // See: https://developer.android.com/studio/write/java8-support#library-desugaring
        coreLibraryDesugaringEnabled true
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    api 'software.amazon.awssdk.iotdevicesdk:aws-iot-device-sdk-android:1.27.4'
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core:1.2.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
