1import org.apache.tools.ant.taskdefs.Delete
2
3buildscript {
4    repositories {
5        mavenCentral()
6        // TODO: remove this when robolectric 2.4 is released.
7        maven {
8            url "https://oss.sonatype.org/content/repositories/snapshots"
9        }
10    }
11    dependencies {
12        classpath 'org.robolectric:robolectric-gradle-plugin:0.11.+'
13        classpath 'com.android.tools.build:gradle:0.11.2'
14    }
15}
16
17apply plugin: 'android-library'
18apply plugin: 'robolectric'
19
20repositories {
21    mavenCentral()
22    // TODO: remove this when robolectric 2.4 is released.
23    maven {
24        url "https://oss.sonatype.org/content/repositories/snapshots"
25    }
26}
27
28dependencies {
29    compile project(':third_party:gif_decoder')
30
31    compile 'com.android.support:support-v4:19.1.+'
32    compile 'com.mcxiaoke.volley:library:1.0.+'
33    compile 'com.jakewharton:disklrucache:2.0.+'
34
35    androidTestCompile 'org.hamcrest:hamcrest-core:1.3'
36    androidTestCompile 'junit:junit:4.11'
37    androidTestCompile 'org.mockito:mockito-all:1.9.5'
38    androidTestCompile 'org.robolectric:robolectric:2.3'
39    androidTestCompile group: 'org.robolectric', name: 'robolectric', version: '2.4-SNAPSHOT', changing: true
40}
41
42ext {
43    versionMajor = 3
44    versionMinor = 2
45    versionPatch = 0
46    versionBuild = 5
47}
48
49def getVersionName() {
50    return "${versionMajor}.${versionMinor}.${versionPatch}a"
51}
52
53android {
54    compileSdkVersion 19
55    buildToolsVersion = '19.1.0'
56
57    defaultConfig {
58        minSdkVersion 10
59        targetSdkVersion 19
60        versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
61        versionName getVersionName()
62    }
63
64    sourceSets {
65        main {
66            java.srcDirs         = ['src/main/java']
67            manifest.srcFile 'AndroidManifest.xml'
68        }
69
70        androidTest {
71            java.srcDirs = ['src/test/java']
72        }
73    }
74}
75
76def getJarName() {
77    return "glide-${getVersionName()}.jar"
78}
79
80//Build a jar, from http://stackoverflow.com/a/19037807/1002054
81task clearJar(type: org.gradle.api.tasks.Delete) {
82    delete "build/libs/${getJarName()}"
83}
84
85task makeJar(type: Copy) {
86    from('build/intermediates/bundles/release/')
87    into('build/libs/')
88    include('classes.jar')
89    rename ('classes.jar', getJarName())
90}
91
92makeJar.dependsOn(clearJar, build)
93