apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply from: 'signConfig.gradle'

println "测试打印...${widgetcase.keyAlias}"

android {
    compileSdk setup.compileSdk

    defaultConfig {
        applicationId "com.doyou.cvc"
        minSdkVersion setup.minSdk
        targetSdkVersion setup.targetSdk
        versionCode release.versionCode
        versionName release.versionName
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }


    signingConfigs {
        autoSigning {
            // 加载properties
//            def properties = new Properties()
//            def inputStream = project.rootProject.file('local.properties').newDataInputStream()
//            properties.load(inputStream)
//
//            keyAlias 'widgetcase'
//            keyPassword properties.getProperty('certificates.password')
//            storeFile file('../widgetcase')
//            storePassword properties.getProperty('certificates.password')

            keyAlias widgetcase.keyAlias
            keyPassword widgetcase.signPwd
            storeFile file(widgetcase.keyStoreFileDir)
            storePassword widgetcase.signPwd
        }
    }

    buildTypes {
        debug {
            minifyEnabled false
            zipAlignEnabled false
            multiDexEnabled true
            signingConfig signingConfigs.autoSigning
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        release {
            minifyEnabled true
            multiDexEnabled true
            zipAlignEnabled true
            signingConfig signingConfigs.autoSigning
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    applicationVariants.all { variant ->
        variant.outputs.each { output ->
//            variant.packageApplicationProvider.get().outputDirectory = new File(project.rootDir.absolutePath + "/apk")
            def outName = "WidgetCase"
            def fileName = outName + '-v' + variant.versionName + '-' + variant.buildType.name + '.apk'
            output.outputFileName = fileName
        }
    }
}

repositories { // 正确引用aar：https://blog.csdn.net/qq_35522272/article/details/70214962
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}"
    implementation "androidx.appcompat:appcompat:${versions.appcompat}"
    implementation "androidx.annotation:annotation:${versions.annotation}"
    implementation "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}"
    implementation 'com.google.android:flexbox:1.1.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation project(':lib-tools')
    implementation project(':lib-widget')
    //    implementation "com.faithhb:toolslib:${outer.toolslib}"
    // aar中依赖的库，主项目也必须依赖，因为aar中依赖的库不会被打进aar包中
//    implementation 'com.github:widgetcase:1.0.4'
//    implementation(name: 'hawkeye_widget-release', ext: 'aar')
    /**
     * 三方库
     */
    // 吐司框架：https://github.com/getActivity/Toaster
    implementation "com.github.getActivity:Toaster:${outer.toaster}"
}
