Kevin Jin | 2721cd9 | 2015-02-10 17:05:30 -0800 | [diff] [blame] | 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 |
bootstraponline | e983cbf | 2015-02-20 16:01:42 -0500 | [diff] [blame] | 4 | |
Kevin Jin | 2721cd9 | 2015-02-10 17:05:30 -0800 | [diff] [blame] | 5 | buildscript { |
bootstraponline | 5cb69a9 | 2015-03-13 11:30:00 -0400 | [diff] [blame] | 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 |
bootstraponline | e983cbf | 2015-02-20 16:01:42 -0500 | [diff] [blame] | 9 | |
Kevin Jin | 2721cd9 | 2015-02-10 17:05:30 -0800 | [diff] [blame] | 10 | repositories { |
| 11 | jcenter() |
| 12 | } |
| 13 | dependencies { |
Kevin Jin | ae6ae8f | 2016-03-14 13:58:19 -0700 | [diff] [blame] | 14 | classpath 'com.android.tools.build:gradle:1.3.0' |
Eric Fitchett | 675040f | 2016-01-05 16:09:26 -0500 | [diff] [blame] | 15 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' |
Kevin Jin | 80b6aeb | 2015-02-19 09:08:29 -0800 | [diff] [blame] | 16 | classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' |
bootstraponline | e983cbf | 2015-02-20 16:01:42 -0500 | [diff] [blame] | 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 | } |
Kevin Jin | 76a109c | 2014-07-30 18:20:44 -0700 | [diff] [blame] | 21 | } |
| 22 | } |
| 23 | |
bootstraponline | e891ed2 | 2015-02-20 14:25:26 -0500 | [diff] [blame] | 24 | apply from: 'properties.gradle' |
| 25 | group = ddGroup |
| 26 | version = ddVersion |
| 27 | |
bootstraponline | 2794383 | 2015-02-18 12:40:16 -0500 | [diff] [blame] | 28 | apply plugin: 'android-sdk-manager' |
Kevin Jin | 2721cd9 | 2015-02-10 17:05:30 -0800 | [diff] [blame] | 29 | apply plugin: 'com.android.library' |
| 30 | |
kjin | a0cf3e7 | 2017-01-18 09:37:51 -0800 | [diff] [blame] | 31 | repositories { |
| 32 | jcenter() |
| 33 | } |
| 34 | |
| 35 | dependencies { |
| 36 | compile 'com.android.support.test:runner:0.4.1' |
| 37 | } |
| 38 | |
Kevin Jin | 85ac3ef | 2015-02-11 18:18:18 -0800 | [diff] [blame] | 39 | tasks.withType(JavaCompile) { |
Kevin Jin | ae6ae8f | 2016-03-14 13:58:19 -0700 | [diff] [blame] | 40 | options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked' |
Kevin Jin | 85ac3ef | 2015-02-11 18:18:18 -0800 | [diff] [blame] | 41 | } |
| 42 | |
Kevin Jin | 2721cd9 | 2015-02-10 17:05:30 -0800 | [diff] [blame] | 43 | android { |
Kevin Jin | a20b6b4 | 2016-03-15 11:29:08 -0700 | [diff] [blame] | 44 | compileSdkVersion 23 |
bootstraponline | bcb5f69 | 2015-02-12 11:28:49 -0500 | [diff] [blame] | 45 | buildToolsVersion '21.1.2' |
Kevin Jin | 2721cd9 | 2015-02-10 17:05:30 -0800 | [diff] [blame] | 46 | |
| 47 | defaultConfig { |
Kevin Jin | 082c792 | 2015-02-19 16:27:53 -0800 | [diff] [blame] | 48 | minSdkVersion 8 |
Kevin Jin | a20b6b4 | 2016-03-15 11:29:08 -0700 | [diff] [blame] | 49 | targetSdkVersion 23 |
Kevin Jin | 85ac3ef | 2015-02-11 18:18:18 -0800 | [diff] [blame] | 50 | versionCode 1 |
| 51 | versionName version |
Kevin Jin | 2721cd9 | 2015-02-10 17:05:30 -0800 | [diff] [blame] | 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 | } |
bootstraponline | 07c1127 | 2015-02-18 13:50:58 -0500 | [diff] [blame] | 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 | } |
Kevin Jin | 76a109c | 2014-07-30 18:20:44 -0700 | [diff] [blame] | 71 | } |
Kevin Jin | 85ac3ef | 2015-02-11 18:18:18 -0800 | [diff] [blame] | 72 | |
Kevin Jin | 85ac3ef | 2015-02-11 18:18:18 -0800 | [diff] [blame] | 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)) |
Kevin Jin | e66c531 | 2015-02-18 17:45:46 -0800 | [diff] [blame] | 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. |
Kevin Jin | 66be402 | 2015-02-18 15:29:54 -0800 | [diff] [blame] | 86 | options.addStringOption('Xdoclint:all,-missing', '-quiet') |
| 87 | } |
Kevin Jin | 85ac3ef | 2015-02-11 18:18:18 -0800 | [diff] [blame] | 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 | } |
bootstraponline | bcb5f69 | 2015-02-12 11:28:49 -0500 | [diff] [blame] | 99 | |
bootstraponline | e891ed2 | 2015-02-20 14:25:26 -0500 | [diff] [blame] | 100 | apply from: 'maven.gradle' |
bootstraponline | e983cbf | 2015-02-20 16:01:42 -0500 | [diff] [blame] | 101 | |
| 102 | if (bintrayEnabled) { |
| 103 | apply plugin: 'com.jfrog.bintray' |
| 104 | apply from: 'jcenter.gradle' |
| 105 | apply from: 'artifactory.gradle' |
| 106 | } |