Home | History | Annotate | Download | only in droiddriver
      1 // If building from command line and you don't have the file local.properties that specifies
      2 // sdk.dir for the Android SDK path, you can run
      3 // $ ANDROID_HOME=/path/to/android-sdk gradle build
      4 
      5 buildscript {
      6     ext.bintrayUser    = project.hasProperty('bintrayUser') ? project.bintrayUser : System.getenv('BINTRAY_USER')
      7     ext.bintrayKey     = project.hasProperty('bintrayKey')  ? project.bintrayKey  : System.getenv('BINTRAY_KEY')
      8     ext.bintrayEnabled = project.bintrayUser && project.bintrayKey
      9 
     10     repositories {
     11         jcenter()
     12     }
     13     dependencies {
     14         classpath 'com.android.tools.build:gradle:1.3.0'
     15         classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
     16         classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
     17         if (bintrayEnabled) {
     18             classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3'
     19             classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1'
     20         }
     21     }
     22 }
     23 
     24 apply from: 'properties.gradle'
     25 group = ddGroup
     26 version = ddVersion
     27 
     28 apply plugin: 'android-sdk-manager'
     29 apply plugin: 'com.android.library'
     30 
     31 repositories {
     32     jcenter()
     33 }
     34 
     35 dependencies {
     36     compile 'com.android.support.test:runner:0.4.1'
     37 }
     38 
     39 tasks.withType(JavaCompile) {
     40     options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked'
     41 }
     42 
     43 android {
     44     compileSdkVersion 23
     45     buildToolsVersion '21.1.2'
     46 
     47     defaultConfig {
     48         minSdkVersion 8
     49         targetSdkVersion 23
     50         versionCode 1
     51         versionName version
     52     }
     53 
     54     compileOptions {
     55         sourceCompatibility JavaVersion.VERSION_1_7
     56         targetCompatibility JavaVersion.VERSION_1_7
     57     }
     58 
     59     sourceSets {
     60         main {
     61             manifest.srcFile 'AndroidManifest.xml'
     62             java.srcDirs = ['src']
     63         }
     64     }
     65 
     66     lintOptions {
     67         // Aborting on lint errors prevents jenkins from processing the Lint output
     68         // https://wiki.jenkins-ci.org/display/JENKINS/Android%20Lint%20Plugin
     69         abortOnError false
     70     }
     71 }
     72 
     73 task sourcesJar(type: Jar) {
     74     from android.sourceSets.main.java.srcDirs
     75     classifier = 'sources'
     76 }
     77 
     78 task javadoc(type: Javadoc) {
     79     source = android.sourceSets.main.java.srcDirs
     80     classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
     81     if (System.getProperty('java.specification.version') == '1.8') {
     82         // '-quiet' is not related to -Xdoclint. In fact it is default for the Javadoc task.
     83         // It is needed here because of a Gradle bug: addStringOption(String option) does not work.
     84         // addStringOption(String option, String value) adds both option and value to the generated
     85         // file javadoc.options, and value must be a valid javadoc command line option.
     86         options.addStringOption('Xdoclint:all,-missing', '-quiet')
     87     }
     88 }
     89 
     90 task javadocJar(type: Jar, dependsOn: javadoc) {
     91     classifier = 'javadoc'
     92     from javadoc.destinationDir
     93 }
     94 
     95 artifacts {
     96     archives javadocJar
     97     archives sourcesJar
     98 }
     99 
    100 apply from: 'maven.gradle'
    101 
    102 if (bintrayEnabled) {
    103     apply plugin: 'com.jfrog.bintray'
    104     apply from: 'jcenter.gradle'
    105     apply from: 'artifactory.gradle'
    106 }
    107