apply plugin: 'com.android.application'

android {
    compileSdkVersion versions.compileSdk
    defaultConfig {
        applicationId "com.hc.tjlt.vr"
        minSdkVersion versions.minSdk
        targetSdkVersion versions.targetSdk
        versionCode versions.versionCode
        versionName versions.versionName
        testInstrumentationRunner lib.test.test_runner
        ndk {
            //APP的build.gradle设置支持的SO库架构
            abiFilters 'armeabi', 'armeabi-v7a', 'x86'
        }

    }


    compileOptions {
        sourceCompatibility versions.Java
        targetCompatibility versions.Java
    }

    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }

    buildTypes {
        release {
            buildConfigField "Boolean", "isDebug", "false"     //app全局是否调试,发布版本不要开启
        }

        debug {
            buildConfigField "Boolean", "isDebug", "true"     //app全局是否调试,调试版本开启
        }
    }

    android.applicationVariants.all{ variant ->
        variant.outputs.all { output ->
            def outputFile = output.outputFile
            if (outputFile != null && outputFile.name.endsWith('.apk')) {
                def fileName
                if (variant.buildType.name == "release") {
                    // 输出apk名称为
                    fileName = "hc_vr_tjlt_${variant.versionName}_release_${releaseTime()}.apk"
                } else {
                    fileName = "hc_vr_tjlt_${variant.versionName}_debug_${releaseTime()}.apk"
                }
                outputFileName = fileName
            }
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
    implementation lib.support.v7
    implementation lib.support.constraint_layout
    implementation lib.support.appcompat
    implementation lib.support.constraintlayout
    testImplementation lib.test.junit
    androidTestImplementation lib.test.runner
    androidTestImplementation lib.test.espresso
    implementation project(path: ':core')
    implementation project(path: ':ijkvideo')
    implementation project(path: ':vrlib')
}

def releaseTime() {
    return new Date().format("yyyyMMdd", TimeZone.getTimeZone("UTC"))
}