if (isRelease.toBoolean()) {
    apply plugin: 'com.android.library'
} else {
    apply plugin: 'com.android.application'
}
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        if (!isRelease.toBoolean()) {
            applicationId "com.gh.feedback"
            multiDexEnabled true

            buildConfigField "String", "API_HOST", "\"${API_HOST}\""
            buildConfigField "String", "WECHAT_APPID", "\"${WECHAT_APPID}\""
            buildConfigField "String", "WECHAT_SECRET", "\"${WECHAT_SECRET}\""
            buildConfigField "String", "TENCENT_APPID", "\"${TENCENT_APPID}\""
            buildConfigField "String", "WEIBO_APPKEY", "\"${WEIBO_APPKEY}\""
            buildConfigField "String", "QUICK_LOGIN_APPID", "\"${QUICK_LOGIN_APPID}\""
            buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
        }
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode rootProject.ext.versionCode
        versionName rootProject.ext.versionName

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    sourceSets {
        main {
            if (isRelease.toBoolean()) {
                manifest.srcFile 'src/main/AndroidManifest.xml'
                java {
                    exclude 'manifest/**'
                }
            } else {
                java {
                    srcDirs = ['src/main/java', "src/feedback/java"]
                }
                manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
            }
        }
    }

    kapt {
        arguments {
            arg("AROUTER_MODULE_NAME", project.name)
        }
    }

    buildFeatures {
        viewBinding true
    }

    buildTypes {
        debug {
            if (!isRelease.toBoolean()) {
                buildConfigField "String", "DEV_API_HOST", "\"${DEV_API_HOST}\""
            }
        }
        release {
            consumerProguardFiles 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    kapt "com.alibaba:arouter-compiler:$arouterVersion"
    if (!isRelease.toBoolean()) {
        implementation "androidx.multidex:multidex:${multiDex}"
    }
    implementation(project(path: ":module_common")) {
        exclude group: 'androidx.swiperefreshlayout'
    }
    implementation(project(path: ":module_login")) {
        exclude group: 'androidx.swiperefreshlayout'
    }
    implementation(project(':module_core_feature')){
        exclude group: 'androidx.swiperefreshlayout'
    }
}