ext {
    bintrayRepo = 'Libs'
    bintrayName = 'permissionUtil'

    publishedGroupId = 'com.github.euzee'
    libraryName = 'permissionUtil'
    artifact = 'permissionUtil'

    libraryDescription = 'Simple android util to request runtime permissions.'

    siteUrl = 'https://github.com/Euzee/permissionUtil'
    gitUrl = 'https://github.com/Euzee/permissionUtil.git'

    libraryVersion = '1.0.7'

    developerId = 'Euzee'
    developerName = 'Euzee'
    developerEmail = 'www.dimuha@mail.ru'

    licenseName = 'The Apache Software License, Version 2.0'
    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    allLicenses = ["Apache-2.0"]
}

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName libraryVersion
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }

}

dependencies {
    def SUPPORT_LIBRARY_VERSION = '27.1.1'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
}
apply from: 'install.gradle'
apply from: 'bintray.gradle'

task prepareApplicationProperties {
    File file = new File('README.md')
    String fileContents = file.getText('UTF-8')
    fileContents = fileContents.replaceAll("permissionUtil:\\d{1,}.\\d{1,}.\\d{1,}", "permissionUtil:" + libraryVersion)
    file.write(fileContents)
}
tasks.preBuild.dependsOn 'prepareApplicationProperties'
tasks.bintrayUpload.dependsOn 'install'