apply plugin: 'com.android.application'
apply from: '../config/sign.gradle'
android {
    signingConfigs {
        if (propertyHaveSigningConfigs) {
            config {
                keyAlias propertyKeyAliasStr
                keyPassword propertyKeyPwdStr
                storeFile file(propertyStoreFileStr)
                storePassword propertyStorePwdStr
            }
        }
    }
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.tcl.customerapi"
        minSdkVersion 29
        targetSdkVersion 29
        versionCode 1108
        versionName "1.1.08"

        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
            debuggable false
        }
        debug {
            signingConfig signingConfigs.config
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    lintOptions {
        abortOnError false
    }

    applicationVariants.all { variant ->
        variant.outputs.all {
            //delete 'build/outputs/aar/'
            // 输出apk名称为
            def buildName = 'HotelApi'
            if (outputFileName != null && outputFileName.endsWith("-release-unsigned.apk")) {
                outputFileName = buildName + "-${defaultConfig.versionName}-release-unsigned.apk"
            } else if (outputFileName != null && outputFileName.endsWith("release.apk")) {
                outputFileName = buildName + "-${defaultConfig.versionName}.apk"
            } else if (outputFileName != null && outputFileName.endsWith("debug.apk")) {
                outputFileName = buildName + "-${defaultConfig.versionName}-debug.apk"
            }
        }
    }
}

dependencies {
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation(name: 'appassistsdk-2.0.11', ext: 'aar')
    implementation(name: 'snack-1.0.2', ext: 'aar')
    implementation(name: 'ah-extension-1.0.1', ext: 'aar')
    testImplementation 'com.alibaba:fastjson:1.2.61'
    implementation 'com.alibaba:fastjson:1.1.71.android'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
    implementation 'com.fasterxml.jackson.core:jackson-core:2.9.8'
    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.8'
    implementation 'io.reactivex.rxjava2:rxjava:2.2.5'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'
    implementation 'com.squareup.okhttp3:okhttp:4.2.2'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'org.apache.httpcomponents:httpcore:4.4.4'
    compileOnly files('mylibs/com.tcl.seeker.jar')
    compileOnly files('mylibs/tvmanager.jar')
    compileOnly files('mylibs/framework.jar')
    compileOnly files('mylibs/com.tcl.tvos.addon.jar')
    implementation files('mylibs/android.tclwidget.jar')
    implementation files('libs/QRZxing-core-2.2.jar')
    implementation files('libs/jdom.jar')
    implementation files('libs/sqlitecommon.jar')
    implementation files('libs/com.broadcom.bt.jar')
    implementation files('mylibs/vendor.tcl.gpio-V1.0-java.jar')
}

def getLayoutLibPath() {
    def versionPath = "android-25"
    return "${android.getSdkDirectory().getAbsolutePath()}" + "/platforms/" + versionPath + "/data/layoutlib.jar"
}