apply plugin: 'com.android.library'

def projectDir = getProjectDir().absolutePath
def rootPath = file(projectDir + "/../../../").path

def javaApiSourcePath = file(rootPath + "/srcs/api-java/").path
def javaApiJavaPath = file(javaApiSourcePath + "/java/").path
def javaApiNativePath = file(javaApiSourcePath + "/cpp/").path

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        externalNativeBuild {
            cmake {
                targets "heifjni"
                abiFilters = rootProject.ext.chosenAbiFilters
                arguments "-DANDROID_STL=c++_shared", "-DNO_TESTS=true"
                cppFlags "-std=c++11"
            }
        }
        ndk {
            abiFilters = rootProject.ext.chosenAbiFilters
        }
    }

    buildTypes {
        debug {
            debuggable true
            jniDebuggable true
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    externalNativeBuild {
        cmake {
            path javaApiNativePath + "/CMakeLists.txt"
        }
    }

    sourceSets.main {
        java.srcDirs = [javaApiJavaPath]

    }
}

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