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'
apply plugin: 'com.google.devtools.ksp'

android {
    compileSdk rootProject.ext.compileSdkVersion

    defaultConfig {
        if (!isRelease.toBoolean()) {
            applicationId "com.gh.gamecenter.setting.compose"
            multiDexEnabled true

            buildConfigField "String", "API_HOST", "\"${API_HOST}\""
        }

        minSdk 21
        targetSdk rootProject.ext.targetSdkVersion
        versionCode rootProject.ext.versionCode
        versionName rootProject.ext.versionName

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    sourceSets {
        main {
            if (isRelease.toBoolean()) {
                manifest.srcFile 'src/main/AndroidManifest.xml'
                java {
                    exclude 'manifest/**'
                }
            } else {
                java {
                    srcDirs = ['src/main/java', "src/setting/java"]
                }
                manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
            }
        }
    }

    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'
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion composeCompilerVersion
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

dependencies {
    if (!isRelease.toBoolean()) {
        implementation "androidx.multidex:multidex:$multiDex"
    }
    ksp "cn.therouter:apt:${routerVersion}"
    kapt "com.google.auto.service:auto-service:${autoServiceVersion}"

    implementation(project(path: ":module_common")) {
        exclude group: 'androidx.swiperefreshlayout'
    }
    implementation(project(path: ":module_login")) {
        exclude group: 'androidx.swiperefreshlayout'
    }
    implementation(project(path: ":module_core_feature")){
        exclude group: 'androidx.swiperefreshlayout'
    }
    implementation "com.lg:gid:${gid}"

    implementation "androidx.activity:activity-compose:$activityComposeVersion"
    implementation "androidx.compose.ui:ui:$composeVersion"
    implementation "androidx.compose.ui:ui-tooling-preview:$composeVersion"
    implementation "androidx.compose.material:material:$composeVersion"
    implementation "androidx.constraintlayout:constraintlayout-compose:$constraintlayoutCompose"
    implementation "com.airbnb.android:lottie-compose:$lottieCompose"

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$composeVersion"
    debugImplementation "androidx.compose.ui:ui-tooling:$composeVersion"
    debugImplementation "androidx.compose.ui:ui-test-manifest:$composeVersion"
}