apply plugin: 'com.android.library'

android {
    compileSdk 36

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 36
    }
    namespace 'com.adjust.test_library'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.code.gson:gson:2.8.6'
    // Add web sockets
    implementation 'org.java-websocket:Java-WebSocket:1.5.1'
}

task adjustTestLibraryJarCleanDebug(type: Delete) {
    delete "build/intermediates/packaged-classes/debug/classes.jar"
}

task adjustTestLibraryJarCleanRelease(type: Delete) {
    delete "build/intermediates/packaged-classes/release/classes.jar"
}

task adjustTestLibraryAarRelease(type: Copy) {
    dependsOn 'assembleRelease'

    from('build/outputs/aar/')
    include 'test-library-release.aar'
    destinationDir file('build/libs/')
}

task adjustTestLibraryAarDebug(type: Copy) {
    dependsOn 'assembleDebug'

    from('build/outputs/aar/')
    include 'test-library-debug.aar'
    destinationDir file('build/libs/')
}

task adjustTestLibraryJarRelease(type: Jar) {
    dependsOn 'compileReleaseJavaWithJavac'
    from('build/intermediates/javac/release/classes/')
    archiveFileName  = project.provider { "test-library-release.jar"}
}

task adjustTestLibraryJarDebug(type: Jar) {
    dependsOn 'compileDebugJavaWithJavac'
    from('build/intermediates/javac/debug/classes/')
    archiveFileName  = project.provider { "test-library-debug.jar"}
}

adjustTestLibraryJarDebug.dependsOn(adjustTestLibraryJarCleanDebug, build)
adjustTestLibraryJarRelease.dependsOn(adjustTestLibraryJarCleanRelease, build)
