apply plugin: 'com.android.library'
apply plugin: 'com.github.sherter.google-java-format'

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.8'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

android {
    compileSdkVersion 26

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }

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

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

    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.google.firebase:firebase-core:17.1.0'
    implementation 'com.google.firebase:firebase-firestore:21.0.0'
}

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

artifacts {
    archives sourcesJar
}

googleJavaFormat {
    toolVersion = '1.6'
}
tasks.googleJavaFormat {
    source '.'
    include '**/*.java'
    exclude '**/generated/**'
}
tasks.verifyGoogleJavaFormat {
    source '.'
    include '**/*.java'
    exclude '**/generated/**'
}
