1apply plugin: 'com.android.library'
2
3archivesBaseName = 'palette-v7'
4
5dependencies {
6    compile project(':support-v4')
7
8    androidTestCompile ('com.android.support.test:runner:0.4.1') {
9        exclude module: 'support-annotations'
10    }
11    testCompile 'junit:junit:4.12'
12}
13
14android {
15    compileSdkVersion 7
16
17    defaultConfig {
18        minSdkVersion 7
19        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
20    }
21
22    lintOptions {
23        // TODO: fix errors and reenable.
24        abortOnError false
25    }
26
27    compileOptions {
28        sourceCompatibility JavaVersion.VERSION_1_7
29        targetCompatibility JavaVersion.VERSION_1_7
30    }
31}
32
33android.libraryVariants.all { variant ->
34    def name = variant.buildType.name
35
36    if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
37        return; // Skip debug builds.
38    }
39    def suffix = name.capitalize()
40
41    def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){
42        dependsOn variant.javaCompile
43        from variant.javaCompile.destinationDir
44        from 'LICENSE.txt'
45    }
46    def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
47        source android.sourceSets.main.java
48        classpath = files(variant.javaCompile.classpath.files) + files(
49                "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
50    }
51
52    def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
53        classifier = 'javadoc'
54        from 'build/docs/javadoc'
55    }
56
57    def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
58        classifier = 'sources'
59        from android.sourceSets.main.java.srcDirs
60    }
61
62    artifacts.add('archives', javadocJarTask);
63    artifacts.add('archives', sourcesJarTask);
64}
65
66uploadArchives {
67    repositories {
68        mavenDeployer {
69            repository(url: uri(rootProject.ext.supportRepoOut)) {
70            }
71
72            pom.project {
73                name 'Android Support Palette v7'
74                description "Android Support for extracting color palettes from images"
75                url 'http://developer.android.com/tools/extras/support-library.html'
76                inceptionYear '2011'
77
78                licenses {
79                    license {
80                        name 'The Apache Software License, Version 2.0'
81                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
82                        distribution 'repo'
83                    }
84                }
85
86                scm {
87                    url "http://source.android.com"
88                    connection "scm:git:https://android.googlesource.com/platform/frameworks/support"
89                }
90                developers {
91                    developer {
92                        name 'The Android Open Source Project'
93                    }
94                }
95            }
96        }
97    }
98}
99