ext.alwaysLib = true //虽然apply了cc-settings-2.gradle，但一直作为library编译，否则别的组件依赖此module时会报错
apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'org.greenrobot.greendao'


android {
    compileSdkVersion rootProject.ext.android["compileSdkVersion"]

    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
    // 避免 lint 检测出错时停止构建
    lintOptions {
        abortOnError false
    }
    defaultConfig {
        minSdkVersion rootProject.ext.android["minSdkVersion"]
        targetSdkVersion rootProject.ext.android["targetSdkVersion"]
        versionCode rootProject.ext.android["versionCode"]
        versionName rootProject.ext.android["versionName"]
        multiDexEnabled true
        //配置注解处理器
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath true
            }
        }
    }

    resourcePrefix "database"

    buildTypes {
        debug {
            buildConfigField "boolean", "LOG_DEBUG", "true"
            buildConfigField "boolean", "USE_CANARY", "true"
            minifyEnabled false
            proguardFiles 'proguard.cfg'
        }
        release {
            buildConfigField "boolean", "LOG_DEBUG", "false"
            buildConfigField "boolean", "USE_CANARY", "false"
            minifyEnabled false
            shrinkResources false
            zipAlignEnabled false
            proguardFiles 'proguard.cfg'
        }
    }
    greendao {
        /**
         * 版本号
         */
        schemaVersion 23
        /**
         * greendao输出dao的数据库操作实体类文件夹（相对路径 包名+自定义路径名称，包将创建于包名的直接路径下）
         */
        daoPackage 'com.gingersoft.gsa.cloud.database.greendao'
        /**
         * greenDao实体类包文件夹
         */
        targetGenDir 'src/main/java'

        generateTests false  //设置为true以自动生成单元测试。
    }

}

dependencies {
    if (project.ext.runAsApp) {
        annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
        debugImplementation rootProject.ext.dependencies["canary-debug"]
        releaseImplementation rootProject.ext.dependencies["canary-release"]
        testImplementation rootProject.ext.dependencies["canary-release"]
    } else {
        compileOnly rootProject.ext.dependencies["dagger2-compiler"]
        compileOnly rootProject.ext.dependencies["canary-debug"]
        compileOnly rootProject.ext.dependencies["canary-release"]
        compileOnly rootProject.ext.dependencies["canary-release"]
    }
    api rootProject.ext.dependencies["gson"]
    // 數據庫
    implementation 'org.greenrobot:greendao:3.2.2'
    implementation 'org.greenrobot:greendao-generator:3.2.2'
}
