apply plugin: 'com.android.application'

def configProps = new Properties()
def configPath = project.hasProperty('configPath') ? project.configPath : rootProject.file('config.prop')
configProps.load(new FileInputStream(configPath))

android {
    defaultConfig {
        applicationId 'com.topjohnwu.magisk'
        vectorDrawables.useSupportLibrary = true
    }

    signingConfigs {
        config {
            storeFile rootProject.file('release-key.jks')
            storePassword configProps['keyStorePass']
            keyAlias configProps['keyAlias']
            keyPassword configProps['keyPass']
        }
    }

    buildTypes {
        debug {
            // If keystore exists, sign the APK with custom signature
            if (signingConfigs.config.storeFile.exists())
                signingConfig signingConfigs.config
        }
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
    }

    flavorDimensions 'mode'

    productFlavors {
        full {
            versionName configProps['appVersion']
            versionCode configProps['appVersionCode'] as Integer
            javaCompileOptions {
                annotationProcessorOptions {
                    argument('butterknife.debuggable', 'false')
                }
            }
        }
        stub {
            versionCode 1
            versionName 'stub'
        }
    }

    lintOptions {
        disable 'MissingTranslation'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation project(':net')
    fullImplementation project(':app-core')
    fullImplementation 'ru.noties:markwon:2.0.1'
    fullImplementation 'com.caverock:androidsvg-aar:1.3'

    def androidXVersion = "1.0.0"
    implementation 'androidx.core:core:1.0.1'
    fullImplementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    fullImplementation 'androidx.appcompat:appcompat:1.0.2'
    fullImplementation "androidx.preference:preference:${androidXVersion}"
    fullImplementation "androidx.recyclerview:recyclerview:${androidXVersion}"
    fullImplementation "androidx.cardview:cardview:${androidXVersion}"
    fullImplementation "com.google.android.material:material:${androidXVersion}"
    fullImplementation 'android.arch.work:work-runtime:1.0.0-beta05'
    fullImplementation 'androidx.room:room-runtime:2.0.0'
    fullImplementation 'androidx.transition:transition:1.0.1'

    def butterKnifeVersion = '10.0.0'
    fullImplementation "com.jakewharton:butterknife-runtime:${butterKnifeVersion}"
    fullAnnotationProcessor "com.jakewharton:butterknife-compiler:${butterKnifeVersion}"
}