plugins {
    id 'com.android.library'
}

def WEBRTC_INC_PATH = "${projectDir}/deps/webrtc/src"
def WEBRTC_LIB_PATH = "${projectDir}/deps/webrtc/lib"

android {
    namespace 'com.acgist.mediasoup'
    compileSdk 32
    defaultConfig {
        minSdk 30
        targetSdk 32
        versionCode 100
        versionName "1.0.0"
        consumerProguardFiles "consumer-rules.pro"
        externalNativeBuild {
            cmake {
                cFlags '-std=c17'
                cppFlags '-std=c++17'
                // CPU架构：x86_64、x86、arm64-v8a、armeabi-v7a
                abiFilters 'arm64-v8a'
                arguments "-DLIBWEBRTC_INCLUDE_PATH=" + WEBRTC_INC_PATH,
                    "-DLIBWEBRTC_BINARY_PATH=" + WEBRTC_LIB_PATH,
                    "-DMEDIASOUPCLIENT_BUILD_TESTS=OFF",
                    "-DMEDIASOUPCLIENT_LOG_TRACE=OFF",
                    "-DMEDIASOUPCLIENT_LOG_DEV=OFF"
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    externalNativeBuild {
        cmake {
            path file('CMakeLists.txt')
            version '3.22.1'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.a', '*.so', '*.jar'])
    implementation 'org.apache.commons:commons-lang3:3.12.0'
    implementation 'org.apache.commons:commons-collections4:4.4'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
    implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2'
    testImplementation 'junit:junit:4.13.2'
}
