aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
blob: 5b206795bde040497951d953f67cf4834288850d (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// 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 {
    repositories {
        jcenter()
    }
    dependencies {
        // this requires Gradle 2
        classpath 'com.android.tools.build:gradle:1.0.1'
        classpath 'com.github.dcendents:android-maven-plugin:1.2'
        classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'
    }
}

// Requires Grade >= 2.1
plugins {
    id 'com.jfrog.bintray' version '1.1'
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.library'

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

def ddArtifactId  = 'droiddriver'
def ddGroup       = 'io.appium'
def ddVersion     = '0.9.1-SNAPSHOT'
def ddWebsite     = 'https://github.com/appium/droiddriver'
def ddTracker     = 'https://github.com/appium/droiddriver/issues'
def ddGit         = 'https://github.com/appium/droiddriver.git'
def ddDescription = 'Android UI testing framework'
version = ddVersion
group = ddGroup

android {
    compileSdkVersion 21
    buildToolsVersion '21.1.2'

    defaultConfig {
        minSdkVersion 12 // TODO: need to support SDK 9?
        targetSdkVersion 21
        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
    }
}

apply plugin: 'com.github.dcendents.android-maven'

install {
    repositories.mavenInstaller {
        pom {
            project {
                packaging 'aar'
                version = ddVersion
                groupId = ddGroup
                artifactId = ddArtifactId

                description = ddDescription
                url ddWebsite

                licenses {
                    license {
                        name 'The Apache Software License, Version 2.0'
                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    }
                }

                scm {
                    connection ddGit
                    developerConnection ddGit
                    url ddWebsite
                }

                issueManagement {
                    url ddTracker
                }
            }
        }
    }
}

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.getProperties().get('java.specification.version') == '1.8') {
        options.addStringOption('Xdoclint:all,-missing', '-quiet')
    }
}

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

artifacts {
    archives javadocJar
    archives sourcesJar
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

bintray {
    publish = true
    user = properties.getProperty('bintray.user')
    key = properties.getProperty('bintray.key')

    configurations = ['archives']
    pkg {
        repo = 'maven'
        userOrg = 'appium'
        name = "${ddGroup}:${ddArtifactId}"
        websiteUrl = ddWebsite
        issueTrackerUrl = ddTracker
        vcsUrl = ddGit
        desc = ddDescription
        licenses = ['The Apache Software License, Version 2.0']
        publicDownloadNumbers = true
        version {
            name = ddVersion
            desc = ddDescription
        }
    }
}