apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'

group = 'com.github.alex-townsend'

android {
  compileSdkVersion 28
  buildToolsVersion "28.0.3"

  defaultConfig {
    minSdkVersion 14
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  }
  sourceSets {
    androidTest {
      java.srcDirs = ['src/androidTest/java']
      resources.srcDirs = ['src/androidTest/res']
    }
  }

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }

  packagingOptions {
    exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
    exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
  }
  testOptions {
    animationsDisabled = true
  }
}

dependencies {

  implementation 'androidx.recyclerview:recyclerview:1.0.0'

  androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
  androidTestImplementation "androidx.test.ext:junit:1.1.0"
  androidTestImplementation 'androidx.test:runner:1.1.1'
  androidTestImplementation 'androidx.test:rules:1.1.1'
  androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.1'
}


// build a jar with source files
task sourcesJar(type: Jar) {
  from android.sourceSets.main.java.srcDirs
  classifier = 'sources'
}

task javadoc(type: Javadoc) {
  failOnError  false
  source = android.sourceSets.main.java.sourceFiles
  classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
  classpath += configurations.compile
}

// build a jar with javadoc
task javadocJar(type: Jar, dependsOn: javadoc) {
  classifier = 'javadoc'
  from javadoc.destinationDir
}

artifacts {
  archives sourcesJar
  archives javadocJar
}