/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */


import com.facebook.fresco.buildsrc.Deps
import com.facebook.fresco.buildsrc.GradleDeps
import com.facebook.fresco.buildsrc.SampleDeps
import com.facebook.fresco.buildsrc.TestDeps

apply plugin: 'com.android.application'

android {
    ndkVersion GradleDeps.Native.version

    compileSdkVersion FrescoConfig.compileSdkVersion
    buildToolsVersion FrescoConfig.buildToolsVersion

    namespace "com.facebook.samples.scrollperf"

    defaultConfig {
        applicationId "com.facebook.samples.scrollperf"
        minSdkVersion FrescoConfig.samplesMinSdkVersion
        targetSdkVersion FrescoConfig.targetSdkVersion
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-scrollperf.pro'
        }
    }
    flavorDimensions "useSoLoader"
    productFlavors {
        soLoader {
        }
        noSoLoader {
        }
        noNativeCode {
        }
    }

    lintOptions {
        warning 'InvalidPackage'
        abortOnError false
    }

    buildFeatures {
        buildConfig = true
    }
}

dependencies {
    compileOnly Deps.jsr305
    compileOnly Deps.javaxAnnotation
    compileOnly Deps.inferAnnotation
    implementation SampleDeps.AndroidX.appcompat
    implementation SampleDeps.AndroidX.recyclerview
    implementation SampleDeps.AndroidX.preference
    implementation project(":vito:core")
    implementation project(":vito:init")
    implementation project(":vito:options")
    implementation project(":vito:source")
    implementation project(":vito:view")

    implementation (fileTree(dir: 'libs', include: ['*.jar']))

    noSoLoaderImplementation (project(':static-webp')) {
        exclude group: 'com.facebook.soloader', module: 'soloader'
        exclude module: 'soloader'
    }
    noSoLoaderImplementation (project(':drawee-backends:drawee-pipeline')) {
        exclude group: 'com.facebook.soloader', module: 'soloader'
        exclude module: 'soloader'
    }

    noNativeCodeImplementation (project(':static-webp')) {
        exclude group: 'com.facebook.soloader', module: 'soloader'
        exclude module: 'native-filters'
        exclude module: 'imagepipeline-native'
        exclude module: 'nativememory'
        exclude module: 'native-imagetranscoder'
    }
    noNativeCodeImplementation (project(':drawee-backends:drawee-pipeline')) {
        exclude group: 'com.facebook.soloader', module: 'soloader'
        exclude module: 'native-filters'
        exclude module: 'imagepipeline-native'
        exclude module: 'nativememory'
        exclude module: 'native-imagetranscoder'
    }

    soLoaderImplementation project(':static-webp')
    soLoaderImplementation project(':drawee-backends:drawee-pipeline')

    testImplementation TestDeps.junit

    androidTestImplementation TestDeps.junit
    androidTestImplementation TestDeps.mockitoCore
    androidTestImplementation(TestDeps.Powermock.apiMockito) {
        exclude group: 'org.mockito', module: 'mockito-all'
    }
    androidTestImplementation TestDeps.Powermock.moduleJunit4
    androidTestImplementation TestDeps.Powermock.moduleJunit4Rule
    androidTestImplementation TestDeps.Powermock.classloadingXstream
    androidTestImplementation(TestDeps.robolectric) {
        exclude group: 'commons-logging', module: 'commons-logging'
        exclude group: 'org.apache.httpcomponents', module: 'httpclient'
    }
}
