def getProcessesCountArg() {
    def procCount = Runtime.runtime.availableProcessors()

    Gradle gradle = getGradle()
    def isClean = gradle.getStartParameter().getTaskNames().find { it ==~ /.*clean.*/ }
    if (isClean) {
        procCount = 1
    }

    return "-j" + procCount
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 31
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 31
        externalNativeBuild {
            ndkBuild {
                arguments "APP_PLATFORM=android-16", getProcessesCountArg()
                abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
            }
        }
    }
    sourceSets {
        main {
            jniLibs.srcDir "libs"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                          'proguard-rules.pro'
        }
    }
    externalNativeBuild {
        ndkBuild {
            path 'jni/Android.mk'
        }
    }
    lintOptions {
        abortOnError false
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
}
