/*
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
plugins {
    id 'com.android.library'
}

apply plugin: 'com.google.protobuf'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    ndkVersion rootProject.ext.ndkVersion

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion

        ndk {
            debugSymbolLevel = 'FULL'
        }
    }

    sourceSets {
        debug {
            proto {
                srcDirs 'src/main/java/com/google/android/libraries/privateanalytics/proto'
            }
        }
        release {
            proto {
                srcDirs 'src/main/java/com/google/android/libraries/privateanalytics/proto'
            }
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }
}

protobuf {
    protoc {
        artifact = 'com.google.protobuf:protoc:3.11.4'
    }
    generateProtoTasks {
        all().each { task ->
            task.builtins {
                java {
                    option "lite"
                }
            }
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    if (!file("$rootDir/prioclient-prebuilt/libs/prioclient-release.aar").exists()) {
        implementation project(':prioclient')
    } else {
        implementation project(':prioclient-prebuilt')
    }

    annotationProcessor 'com.google.auto.value:auto-value:1.7.3'

    implementation 'androidx.concurrent:concurrent-futures:1.1.0'
    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.google.auto.value:auto-value-annotations:1.7.3'
    implementation 'com.google.guava:guava:29.0-android'
    implementation 'com.jakewharton.threetenabp:threetenabp:1.2.4'
    implementation 'com.google.android.gms:play-services-base:17.4.0'
    implementation 'com.google.firebase:firebase-firestore:21.6.0'
    implementation 'com.google.firebase:firebase-datatransport:17.0.8'

    // JVM test dependencies
    testImplementation 'androidx.test.ext:junit:1.1.4-alpha01'
    testImplementation 'com.google.guava:guava-testlib:29.0-jre'
    testImplementation 'com.google.truth:truth:1.0.1'
    testImplementation 'org.mockito:mockito-core:3.12.4'
    testImplementation 'org.mockito:mockito-inline:3.12.4'
    testImplementation 'org.robolectric:robolectric:4.6.1'
}
