apply plugin: 'com.android.library'
apply plugin: 'maven-publish'

android {
    namespace = 'com.termux.view'
    compileSdkVersion project.properties.compileSdkVersion.toInteger()

    defaultConfig {
        minSdkVersion project.properties.minSdkVersion.toInteger()
        targetSdkVersion project.properties.targetSdkVersion.toInteger()
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            jniDebuggable false
        }
        debug {
            minifyEnabled false
            jniDebuggable false
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    buildFeatures {
        viewBinding = false
    }
}

dependencies {
    testImplementation "junit:junit:4.13.2"
    implementation "androidx.annotation:annotation:1.9.1"
    api project(":terminal-emulator")
}

tasks.register('sourceJar', Jar) {
    from android.sourceSets.main.java.srcDirs
    archiveClassifier = "sources"
}

tasks.withType(JavaCompile).configureEach {
    options.compilerArgs << "-Xlint:deprecation"
}

afterEvaluate {
    publishing {
        publications {
            // Creates a Maven publication called "release".
            release(MavenPublication) {
                from components.findByName('release')
                groupId = 'com.termux'
                artifactId = 'terminal-view'
                version = '0.118.0'
                artifact(sourceJar)
            }
        }
    }
}

