apply plugin: 'com.android.application'

Properties props = new Properties()
props.load(new FileInputStream(file("../local.properties")))

android {
    signingConfigs {
        release {
            keyAlias props['KEY_ALIAS']
            keyPassword props['KEY_PASSWORD']
            storeFile file(props['KEYSTORE_FILE'])
            storePassword props['KEYSTORE_PASSWORD']
        }
    }
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        applicationId "site.duqian.wchook"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode rootProject.ext.versionCode
        versionName rootProject.ext.versionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.12'

    implementation 'com.android.support:appcompat-v7:26+'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.crystal:crystalrangeseekbar:1.1.1'
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    //xposed
    compileOnly 'de.robv.android.xposed:api:82:sources'
    compileOnly 'de.robv.android.xposed:api:82'
    //googlemap
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    //高德地图
    implementation 'com.amap.api:search:5.7.0'
    implementation 'com.amap.api:map3d-native:5.0.0'
    implementation 'com.amap.api:map3d:5.0.0'
    implementation 'com.amap.api:location:3.8.0'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.okhttp3:okhttp:3.9.1'
    //悬浮窗
    implementation 'com.github.yhaolpz:FloatWindow:1.0.8'
}

afterEvaluate {
    installDebug.doLast {
        updateSelfAPP.execute()
        rebootVXP.execute()
        launchSelfAPP.execute()
        launchWechat.execute()
    }
}
task updateSelfAPP(type: Exec) {
    def pkg = android.defaultConfig.applicationId
    commandLine android.adbExecutable, 'shell', 'am', 'broadcast', '-a', 'io.va.exposed.CMD', '-e', 'cmd', 'update', '-e', 'pkg', pkg
}
task rebootVXP(type: Exec) {
    commandLine android.adbExecutable, 'shell', 'am', 'broadcast', '-a', 'io.va.exposed.CMD', '-e', 'cmd', 'reboot'
}
task launchSelfAPP(type: Exec) {
    def pkg = 'site.duqian.wchook'
    commandLine android.adbExecutable, 'shell', 'am', 'broadcast', '-a', 'io.va.exposed.CMD', '-e', 'cmd', 'launch', '-e', 'pkg', pkg
}
task launchWechat(type: Exec) {
    def pkg = 'com.tencent.mm'
    commandLine android.adbExecutable, 'shell', 'am', 'broadcast', '-a', 'io.va.exposed.CMD', '-e', 'cmd', 'launch', '-e', 'pkg', pkg
}
