Home | History | Annotate | Download | only in recyclerview
      1 apply plugin: 'com.android.library'
      2 
      3 archivesBaseName = 'recyclerview-v7'
      4 
      5 dependencies {
      6     compile project(':support-annotations')
      7     compile project(':support-compat')
      8     compile project(':support-core-ui')
      9     androidTestCompile ("com.android.support.test:runner:${project.rootProject.ext.testRunnerVersion}") {
     10         exclude module: 'support-annotations'
     11     }
     12     androidTestCompile ("com.android.support.test.espresso:espresso-core:${project.rootProject.ext.espressoVersion}") {
     13         exclude module: 'support-annotations'
     14     }
     15     testCompile 'junit:junit:4.12'
     16     testCompile "org.mockito:mockito-core:1.9.5"
     17     androidTestCompile "org.mockito:mockito-core:1.9.5"
     18     androidTestCompile "com.google.dexmaker:dexmaker:1.2"
     19     androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2"
     20 }
     21 
     22 android {
     23     compileSdkVersion 23
     24 
     25     defaultConfig {
     26         minSdkVersion 9
     27         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
     28     }
     29 
     30     sourceSets {
     31         main.manifest.srcFile 'AndroidManifest.xml'
     32         main.java.srcDir 'src'
     33         main.res.srcDirs 'res', 'res-public'
     34 
     35         androidTest.setRoot('tests')
     36         test.java.srcDir 'jvm-tests/src'
     37         androidTest.java.srcDir 'tests/src'
     38         androidTest.res.srcDir 'tests/res'
     39         androidTest.manifest.srcFile 'tests/AndroidManifest.xml'
     40     }
     41 
     42     compileOptions {
     43         sourceCompatibility JavaVersion.VERSION_1_7
     44         targetCompatibility JavaVersion.VERSION_1_7
     45     }
     46 
     47     lintOptions {
     48         // TODO: fix errors and reenable.
     49         abortOnError false
     50     }
     51 
     52     packagingOptions {
     53         exclude 'LICENSE.txt'
     54     }
     55 
     56     testOptions {
     57         unitTests.returnDefaultValues = true
     58     }
     59 
     60     buildTypes.all {
     61         consumerProguardFiles 'proguard-rules.pro'
     62     }
     63 }
     64 
     65 android.libraryVariants.all { variant ->
     66     def name = variant.buildType.name
     67 
     68     if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
     69         return; // Skip debug builds.
     70     }
     71     def suffix = name.capitalize()
     72 
     73     def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){
     74         dependsOn variant.javaCompile
     75         from variant.javaCompile.destinationDir
     76         from 'LICENSE.txt'
     77     }
     78     def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
     79         source android.sourceSets.main.java
     80         classpath = files(variant.javaCompile.classpath.files) + files(
     81                 "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
     82     }
     83 
     84     def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
     85         classifier = 'javadoc'
     86         from 'build/docs/javadoc'
     87     }
     88 
     89     def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
     90         classifier = 'sources'
     91         from android.sourceSets.main.java.srcDirs
     92     }
     93 
     94     artifacts.add('archives', javadocJarTask);
     95     artifacts.add('archives', sourcesJarTask);
     96 }
     97 
     98 uploadArchives {
     99     repositories {
    100         mavenDeployer {
    101             repository(url: uri(rootProject.ext.supportRepoOut)) {
    102             }
    103 
    104             pom.project {
    105                 name 'Android Support RecyclerView v7'
    106                 description "Android Support RecyclerView v7"
    107                 url 'http://developer.android.com/tools/extras/support-library.html'
    108                 inceptionYear '2011'
    109 
    110                 licenses {
    111                     license {
    112                         name 'The Apache Software License, Version 2.0'
    113                         url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    114                         distribution 'repo'
    115                     }
    116                 }
    117 
    118                 scm {
    119                     url "http://source.android.com"
    120                     connection "scm:git:https://android.googlesource.com/platform/frameworks/support"
    121                 }
    122                 developers {
    123                     developer {
    124                         name 'The Android Open Source Project'
    125                     }
    126                 }
    127             }
    128         }
    129     }
    130 }
    131