apply plugin: 'com.android.library'

//upload settings to bintray
ext {
    bintrayRepo = 'widget'
    bintrayName = 'ChipsLayoutManager'

    libraryName = 'ChipsLayoutManager'
    publishedGroupId = 'com.beloo.widget'
    artifact = 'ChipsLayoutManager'
    libraryVersion = "rootProject.ext.libraryVersion"

    libraryDescription = 'Android. A custom layout manager for RecyclerView which mimicric TextView span behaviour, flow layouts behaviour with support of amazing recyclerView features'

    siteUrl = 'https://github.com/BelooS/ChipsLayoutManager'
    gitUrl = 'https://github.com/BelooS/ChipsLayoutManager.git'

    developerId = 'beloo'
    developerName = 'Beloy Oleg'
    developerEmail = 'beloyoleg@gmail.com'

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

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    testBuildType "debug"

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 10
        versionName "1.0.1"

        testApplicationId "com.beloo.chipslayoutmanager.test"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {

        all {
            buildConfigField("boolean", "isLogEnabled", "false")
        }

        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        development {
            buildConfigField("boolean", "isLogEnabled", "true")
        }
    }

    sourceSets {
        androidTest {
            res.srcDirs = ['src/androidTest/res']
        }
    }

}

task androidJavadocs(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
}

task androidJavadocsJar(type: Jar) {
    classifier = 'javadoc'
    baseName = artifact
    from androidJavadocs.destinationDir
}

task androidSourcesJar(type: Jar) {
    classifier = 'sources'
    baseName = artifact
    from android.sourceSets.main.java.srcDirs
}

artifacts {
    archives androidSourcesJar
    archives androidJavadocsJar
}


def supportVersion = "25+";

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

    implementation "com.android.support:appcompat-v7:$supportVersion"
    implementation "com.android.support:recyclerview-v7:$supportVersion"

    androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestImplementation 'com.android.support.test:runner:0.5'
    androidTestImplementation "com.android.support:support-annotations:$supportVersion"
    androidTestImplementation 'pl.pragmatists:JUnitParams:1.0.5'
}

group = publishedGroupId // Maven Group ID for the artifact
version = libraryVersion



//Properties properties = new Properties()
//properties.load(project.rootProject.file('local.properties').newDataInputStream())
//
//bintray {
//    user = properties.getProperty("bintray.user")
//    key = properties.getProperty("bintray.apikey")
//
//    configurations = ['archives'] //When uploading configuration files
//
//    dryRun = false //[Default: false] Whether to run this as dry-run, without deploying
//    publish = true //[Default: false] Whether version should be auto published after an upload
//    override = true //[Default: false] Whether to override version artifacts already published
//
//    //Package configuration. The plugin will use the repo and name properties to check if the package already exists. In that case, there's no need to configure the other package properties (like userOrg, desc, etc).
//    pkg {
//        repo = bintrayRepo
//        name = bintrayName
//        desc = libraryDescription
//        websiteUrl = siteUrl
//        issueTrackerUrl = 'https://github.com/BelooS/ChipsLayoutManager/issues'
//        vcsUrl = gitUrl
//        licenses = allLicenses
//        publish = true
//        publicDownloadNumbers = true
//
//        githubRepo = 'BelooS/ChipsLayoutManager'
//        githubReleaseNotesFile = 'README.md'
//
//        //Optional version descriptor
//        version {
//            name = libraryVersion //Bintray logical version name
//            desc = '' //Optional - Version-specific description'
//            vcsTag = libraryVersion
//
//            gpg {
//                sign = true //Determines whether to GPG sign the files. The default is false
//                passphrase = properties.getProperty("bintray.gpg.password")
//                //Optional. The passphrase for GPG signing'
//            }
//        }
//    }
//}