aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
blob: 8cc329edaa8754a183a089ad7096e837da3acdbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// If building from command line and you don't have the file local.properties that specifies
// sdk.dir for the Android SDK path, you can run
// $ ANDROID_HOME=/path/to/android-sdk gradle build

buildscript {
    ext.bintrayUser    = project.hasProperty('bintrayUser') ? project.bintrayUser : System.getenv('BINTRAY_USER')
    ext.bintrayKey     = project.hasProperty('bintrayKey')  ? project.bintrayKey  : System.getenv('BINTRAY_KEY')
    ext.bintrayEnabled = project.bintrayUser && project.bintrayKey

    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
        classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
        if (bintrayEnabled) {
            classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3'
            classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1'
        }
    }
}

apply from: 'properties.gradle'
group = ddGroup
version = ddVersion

apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.library'

repositories {
    jcenter()
}

dependencies {
    compile 'com.android.support.test:runner:0.4.1'
}

tasks.withType(JavaCompile) {
    options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked'
}

android {
    compileSdkVersion 23
    buildToolsVersion '21.1.2'

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 23
        versionCode 1
        versionName version
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
        }
    }

    lintOptions {
        // Aborting on lint errors prevents jenkins from processing the Lint output
        // https://wiki.jenkins-ci.org/display/JENKINS/Android%20Lint%20Plugin
        abortOnError false
    }
}

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
    if (System.getProperty('java.specification.version') == '1.8') {
        // '-quiet' is not related to -Xdoclint. In fact it is default for the Javadoc task.
        // It is needed here because of a Gradle bug: addStringOption(String option) does not work.
        // addStringOption(String option, String value) adds both option and value to the generated
        // file javadoc.options, and value must be a valid javadoc command line option.
        options.addStringOption('Xdoclint:all,-missing', '-quiet')
    }
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

artifacts {
    archives javadocJar
    archives sourcesJar
}

apply from: 'maven.gradle'

if (bintrayEnabled) {
    apply plugin: 'com.jfrog.bintray'
    apply from: 'jcenter.gradle'
    apply from: 'artifactory.gradle'
}