/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * 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
 *
 *     http://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.
 */

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion rootProject.compileSdkVersion
    buildToolsVersion rootProject.buildToolsVersion

    targetCompatibility = rootProject.targetCompatibilityVersion
    sourceCompatibility = rootProject.sourceCompatibilityVersion

    defaultConfig {
        minSdkVersion rootProject.minSdkVersion
        targetSdkVersion rootProject.targetSdkVersion

        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
    }
    namespace 'com.facebook.samples.litho'
    lint {
        abortOnError false
    }

    // TODO(#62): Re-enable abort on error.
}

dependencies {
    compileOnly project(':litho-sections-annotations')

    implementation project(':litho-core')
    implementation project(':litho-coroutines-kotlin')
    implementation project(':litho-editor-core')
    implementation(project(':litho-editor-flipper')) {
        exclude group:'com.facebook.flipper'
    }
    implementation project(':litho-fresco')
    implementation project(':litho-fresco-kotlin')
    implementation project(':litho-live-data')
    implementation project(':litho-sections-core')
    implementation project(':litho-sections-widget')
    implementation project(':litho-widget')
    implementation project(':litho-widget-kotlin')
    implementation project(':litho-rendercore-text')

    kapt project(':litho-processor')
    kapt project(':litho-sections-processor')

    // First-party
    implementation deps.soloader
    implementation deps.flipper
    implementation(deps.flipperLithoPlugin) {
       exclude group:'com.facebook.litho'
    }
    implementation deps.fresco
    implementation deps.frescoVito
    implementation deps.frescoVitoLitho
    implementation deps.frescoVitoOptions
    implementation deps.frescoVitoSource
    implementation deps.guava

    // Annotations
    compileOnly deps.jsr305
    compileOnly deps.inferAnnotations

    // Support Library
    implementation deps.viewModel
    implementation deps.kotlinCoroutines
    implementation deps.kotlinStandardLib
    implementation deps.liveData
    implementation deps.supportAppCompat
    implementation deps.supportFragment
    implementation deps.supportRecyclerView
    implementation deps.supportSwipeRefresh
    implementation deps.supportTransition


    // Integration test only
    androidTestImplementation project(':litho-espresso')
    androidTestImplementation deps.supportEspresso
    androidTestImplementation deps.supportEspressoIntents
    androidTestImplementation deps.junit

    // Unit test only
    testImplementation project(':litho-testing')
    testCompileOnly deps.jsr305
    testCompileOnly deps.mockitokotlin
    testAnnotationProcessor project(':litho-processor')
    kaptTest project(':litho-processor')
    testImplementation deps.junit
    testImplementation deps.hamcrestLibrary
    testImplementation deps.robolectric
    testImplementation deps.supportTestCore
    testImplementation deps.assertjCore
    testImplementation deps.mockitoCore
}

kotlin {
    jvmToolchain(17)
}
