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

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

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

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

29
    compile 'com.android.support:support-v4:19.1.+'
E
Emil Arfvidsson 已提交
30 31 32 33 34 35
    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'
36 37 38
    androidTestCompile (group: 'org.robolectric', name: 'robolectric', version: '2.4-SNAPSHOT', changing: true) {
      exclude group: 'commons-logging:commons-logging:1.1.1'
    }
S
Sam Judd 已提交
39 40
}

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

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

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

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

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

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

75
def getJarName() {
S
Sam Judd 已提交
76
    "glide-${getVersionName()}.jar"
77 78
}

79 80 81
// Build a jar, from http://stackoverflow.com/a/19037807/1002054.
// TODO: this needs to be batched to include code from gif_decoder.
task clearJar(type: 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)
S
Sam Judd 已提交
93 94

apply from: "https://raw.githubusercontent.com/mcxiaoke/gradle-mvn-push/master/gradle-mvn-push.gradle"