plugins {
    id 'com.android.library'
    id 'maven-publish'
}

dependencies {
    api(deps.errorprone, {
        exclude group: 'org.checkerframework', module: 'dataflow-errorprone'
    })
    implementation project(path: ':connectedapps-annotations')
    implementation(deps.errorprone, {
        exclude group: 'org.checkerframework', module: 'dataflow-errorprone'
    })
    testImplementation project(path: ':connectedapps-sharedtests')
    testImplementation deps.robolectric
    testImplementation 'junit:junit:4.13.1'
    testImplementation 'com.google.truth:truth:1.1.2'
    testImplementation 'androidx.test:core:1.3.0'
    testImplementation project(path: ':connectedapps')
    testImplementation project(path: ':connectedapps-annotations')
    testImplementation project(path: ':connectedapps-processor')
    testAnnotationProcessor project(path: ':connectedapps-processor')
    testImplementation project(path: ':connectedapps-testing')
    testImplementation project(path: ':connectedapps-testing-annotations')
    testImplementation 'com.google.protobuf:protobuf-java:4.0.0-rc-2'
    testAnnotationProcessor deps.autovalue
    testImplementation deps.autovalueAnnotations
}

afterEvaluate {
    publishing {
        publications {
            maven(MavenPublication) {
                from components.release
                groupId = 'com.google.android.enterprise.connectedapps'
                artifactId = 'connectedapps'
                version = project.version

                pom {
                    licenses {
                        license {
                            name = 'Apache 2.0'
                            url = 'https://opensource.org/licenses/Apache-2.0'
                        }
                    }
                }
            }
        }
    }
}

android {
    sourceSets {
        test{
            java.srcDir file('../tests/robotests/src')
        }
    }
}

android {
    defaultConfig {
        compileSdkVersion 30
        minSdkVersion 26
    }

    buildFeatures {
        aidl = true
    }

    testOptions.unitTests.includeAndroidResources = true

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
