build.gradle 2.3 KB
Newer Older
S
Sam Judd 已提交
1 2
import org.apache.tools.ant.taskdefs.Delete

S
Sam Judd 已提交
3 4 5
buildscript {
    repositories {
        mavenCentral()
S
Sam Judd 已提交
6 7 8 9
        // TODO: remove this when robolectric 2.4 is released.
        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots"
        }
S
Sam Judd 已提交
10 11
    }
    dependencies {
12
        classpath 'org.robolectric:robolectric-gradle-plugin:0.11.+'
E
Emil Arfvidsson 已提交
13
        classpath 'com.android.tools.build:gradle:0.11.2'
S
Sam Judd 已提交
14 15 16 17
    }
}

apply plugin: 'android-library'
18
apply plugin: 'robolectric'
S
Sam Judd 已提交
19 20 21

repositories {
    mavenCentral()
S
Sam Judd 已提交
22 23 24 25
    // TODO: remove this when robolectric 2.4 is released.
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots"
    }
S
Sam Judd 已提交
26 27 28
}

dependencies {
E
Emil Arfvidsson 已提交
29 30
    compile project(':third_party:gif_decoder')

31
    compile 'com.android.support:support-v4:19.1.+'
E
Emil Arfvidsson 已提交
32 33 34 35 36 37 38
    compile 'com.mcxiaoke.volley:library:1.0.+'
    compile 'com.jakewharton:disklrucache:2.0.+'

    androidTestCompile 'org.hamcrest:hamcrest-core:1.3'
    androidTestCompile 'junit:junit:4.11'
    androidTestCompile 'org.mockito:mockito-all:1.9.5'
    androidTestCompile 'org.robolectric:robolectric:2.3'
S
Sam Judd 已提交
39
    androidTestCompile group: 'org.robolectric', name: 'robolectric', version: '2.4-SNAPSHOT', changing: true
S
Sam Judd 已提交
40 41
}

42 43 44 45 46 47 48 49 50 51 52
ext {
    versionMajor = 3
    versionMinor = 2
    versionPatch = 0
    versionBuild = 5
}

def getVersionName() {
    return "${versionMajor}.${versionMinor}.${versionPatch}a"
}

S
Sam Judd 已提交
53
android {
S
Sam Judd 已提交
54
    compileSdkVersion 19
E
Emil Arfvidsson 已提交
55
    buildToolsVersion = '19.1.0'
S
Sam Judd 已提交
56

57
    defaultConfig {
58 59 60 61
        minSdkVersion 10
        targetSdkVersion 19
        versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
        versionName getVersionName()
62 63
    }

S
Sam Judd 已提交
64 65
    sourceSets {
        main {
66
            java.srcDirs         = ['src/main/java']
S
Sam Judd 已提交
67 68
            manifest.srcFile 'AndroidManifest.xml'
        }
E
Emil Arfvidsson 已提交
69

70 71 72
        androidTest {
            java.srcDirs = ['src/test/java']
        }
S
Sam Judd 已提交
73
    }
E
Emil Arfvidsson 已提交
74 75
}

76 77 78 79
def getJarName() {
    return "glide-${getVersionName()}.jar"
}

S
Sam Judd 已提交
80 81
//Build a jar, from http://stackoverflow.com/a/19037807/1002054
task clearJar(type: org.gradle.api.tasks.Delete) {
82 83 84 85 86 87 88 89 90 91 92
    delete "build/libs/${getJarName()}"
}

task makeJar(type: Copy) {
    from('build/intermediates/bundles/release/')
    into('build/libs/')
    include('classes.jar')
    rename ('classes.jar', getJarName())
}

makeJar.dependsOn(clearJar, build)