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