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