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

apply plugin: 'com.qxml.code.plugin'

android {
    compileSdkVersion android_compileSdkVersion.toInteger()
    buildToolsVersion android_buildToolsVersion

    defaultConfig {
        minSdkVersion android_minSdkVersion
        targetSdkVersion android_targetSdkVersion.toInteger()
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        consumerProguardFiles "consumer-rules.pro"

        flavorDimensions "versionCode"
    }

    signingConfigs {
        release {
            storeFile file('../qxml.jks')
            keyAlias 'qxml'
            keyPassword '123456'
            storePassword '123456'
        }
    }

    buildTypes {
        debug {
            minifyEnabled false
            debuggable false
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled true
            debuggable false
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        midrelease.initWith(debug)
        midrelease {
            matchingFallbacks = [ 'debug', 'release']
        }
    }

    repositories {
        flatDir {
            dirs 'libs'
        }
    }

    dataBinding {
        enabled = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    lintOptions {
        checkReleaseBuilds false
        disable "InvalidPackage"
    }

    sourceSets {
        main {
            resources.srcDirs += "build/qxml/tempRes"
        }
    }

    productFlavors {
        Aa {
            applicationId 'com.support_test.a'
        }
        Bb {
            applicationId 'com.support_test.b'
        }
    }
}

qxml {
    enable true
    useFactory false
    viewDebug true
    logEnable true
    debugEnable false
    compatMode com.qxml.CompatMode.AUTO
    acceptReferenceStyle true
    useCreateViewListener false
    checkMethod true

    //在root build.gradle同级目录中可创建qxmlRemoveLayoutWhiteList.txt白名单文件，内容格式为layout文件名，按行读取，eg：
    //removeConvertedLayout true会自动保留转换失败的layout所关联的layout文件，但未经qxml处理的layout文件需在白名单文件中声明，如动态添加的ViewStub#setLayoutResource引用的layout文件
    /*
        activity_main
        imageview_test
    */
    removeConvertedLayout false
    buildType {
        debug {
            viewDebug true
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation kotlin_stdlib
    implementation support_v7
    implementation support_recyclerview
    implementation support_design
    implementation support_constraintLayout
    implementation support_lottie
    implementation support_fresco

    testImplementation junit
    androidTestImplementation test_runner
    androidTestImplementation test_core

    //annotationProcessor deps.qxml.processor
    annotationProcessor deps.qxml.processor
    //implementation deps.qxml.tools
    implementation deps.qxml.qxmlTest
    implementation deps.qxml.annotations
    implementation deps.qxml.dynamic_supportLib

}