blob: 8cc329edaa8754a183a089ad7096e837da3acdbb [file] [log] [blame]
Kevin Jin2721cd92015-02-10 17:05:30 -08001// 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
bootstraponlinee983cbf2015-02-20 16:01:42 -05004
Kevin Jin2721cd92015-02-10 17:05:30 -08005buildscript {
bootstraponline5cb69a92015-03-13 11:30:00 -04006 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
bootstraponlinee983cbf2015-02-20 16:01:42 -05009
Kevin Jin2721cd92015-02-10 17:05:30 -080010 repositories {
11 jcenter()
12 }
13 dependencies {
Kevin Jinae6ae8f2016-03-14 13:58:19 -070014 classpath 'com.android.tools.build:gradle:1.3.0'
Eric Fitchett675040f2016-01-05 16:09:26 -050015 classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
Kevin Jin80b6aeb2015-02-19 09:08:29 -080016 classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
bootstraponlinee983cbf2015-02-20 16:01:42 -050017 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 Jin76a109c2014-07-30 18:20:44 -070021 }
22}
23
bootstraponlinee891ed22015-02-20 14:25:26 -050024apply from: 'properties.gradle'
25group = ddGroup
26version = ddVersion
27
bootstraponline27943832015-02-18 12:40:16 -050028apply plugin: 'android-sdk-manager'
Kevin Jin2721cd92015-02-10 17:05:30 -080029apply plugin: 'com.android.library'
30
kjina0cf3e72017-01-18 09:37:51 -080031repositories {
32 jcenter()
33}
34
35dependencies {
36 compile 'com.android.support.test:runner:0.4.1'
37}
38
Kevin Jin85ac3ef2015-02-11 18:18:18 -080039tasks.withType(JavaCompile) {
Kevin Jinae6ae8f2016-03-14 13:58:19 -070040 options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked'
Kevin Jin85ac3ef2015-02-11 18:18:18 -080041}
42
Kevin Jin2721cd92015-02-10 17:05:30 -080043android {
Kevin Jina20b6b42016-03-15 11:29:08 -070044 compileSdkVersion 23
bootstraponlinebcb5f692015-02-12 11:28:49 -050045 buildToolsVersion '21.1.2'
Kevin Jin2721cd92015-02-10 17:05:30 -080046
47 defaultConfig {
Kevin Jin082c7922015-02-19 16:27:53 -080048 minSdkVersion 8
Kevin Jina20b6b42016-03-15 11:29:08 -070049 targetSdkVersion 23
Kevin Jin85ac3ef2015-02-11 18:18:18 -080050 versionCode 1
51 versionName version
Kevin Jin2721cd92015-02-10 17:05:30 -080052 }
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 }
bootstraponline07c11272015-02-18 13:50:58 -050065
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 Jin76a109c2014-07-30 18:20:44 -070071}
Kevin Jin85ac3ef2015-02-11 18:18:18 -080072
Kevin Jin85ac3ef2015-02-11 18:18:18 -080073task sourcesJar(type: Jar) {
74 from android.sourceSets.main.java.srcDirs
75 classifier = 'sources'
76}
77
78task javadoc(type: Javadoc) {
79 source = android.sourceSets.main.java.srcDirs
80 classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
Kevin Jine66c5312015-02-18 17:45:46 -080081 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 Jin66be4022015-02-18 15:29:54 -080086 options.addStringOption('Xdoclint:all,-missing', '-quiet')
87 }
Kevin Jin85ac3ef2015-02-11 18:18:18 -080088}
89
90task javadocJar(type: Jar, dependsOn: javadoc) {
91 classifier = 'javadoc'
92 from javadoc.destinationDir
93}
94
95artifacts {
96 archives javadocJar
97 archives sourcesJar
98}
bootstraponlinebcb5f692015-02-12 11:28:49 -050099
bootstraponlinee891ed22015-02-20 14:25:26 -0500100apply from: 'maven.gradle'
bootstraponlinee983cbf2015-02-20 16:01:42 -0500101
102if (bintrayEnabled) {
103 apply plugin: 'com.jfrog.bintray'
104 apply from: 'jcenter.gradle'
105 apply from: 'artifactory.gradle'
106}