apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "org.libwebsockets.client"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            jni.srcDirs = []
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
}

task buildNativeLibs(type: Exec, description: "compile the native libraries") {
    commandLine 'make', '-f', 'NativeLibs.mk', '-C', 'src/main/jni', 'all'
}

task cleanNativeLibs(type: Exec, description: "clean the native libraries source tree") {
    commandLine 'make', '-f', 'NativeLibs.mk', '-C', 'src/main/jni', 'clean-ndk'
}

tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn buildNativeLibs }
clean.dependsOn 'cleanNativeLibs'