1apply plugin: 'android-library'
2
3archivesBaseName = 'appcompat-v7'
4
5dependencies {
6    compile project(':support-v4')
7    androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
8    testCompile 'junit:junit:4.12'
9}
10
11android {
12    compileSdkVersion 'current'
13
14    defaultConfig {
15        minSdkVersion 7
16        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17    }
18
19    sourceSets {
20        main.manifest.srcFile 'AndroidManifest.xml'
21        main.java.srcDir 'src'
22        main.res.srcDirs 'res', 'res-public'
23        main.assets.srcDir 'assets'
24        main.resources.srcDir 'src'
25
26        androidTest.setRoot('tests')
27        androidTest.java.srcDir 'tests/src'
28        androidTest.res.srcDir 'tests/res'
29        androidTest.manifest.srcFile 'tests/AndroidManifest.xml'
30    }
31
32    compileOptions {
33        sourceCompatibility JavaVersion.VERSION_1_7
34        targetCompatibility JavaVersion.VERSION_1_7
35    }
36
37    lintOptions {
38        // TODO: fix errors and reenable.
39        abortOnError false
40    }
41}
42
43android.libraryVariants.all { variant ->
44    def name = variant.buildType.name
45
46    if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
47        return; // Skip debug builds.
48    }
49    def suffix = name.capitalize()
50
51    def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){
52        dependsOn variant.javaCompile
53        from variant.javaCompile.destinationDir
54        from 'LICENSE.txt'
55    }
56    def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
57        source android.sourceSets.main.java
58        classpath = files(variant.javaCompile.classpath.files) + files(
59                "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
60    }
61
62    def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
63        classifier = 'javadoc'
64        from 'build/docs/javadoc'
65    }
66
67    def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
68        classifier = 'sources'
69        from android.sourceSets.main.java.srcDirs
70    }
71
72    artifacts.add('archives', javadocJarTask);
73    artifacts.add('archives', sourcesJarTask);
74}
75
76uploadArchives {
77    repositories {
78        mavenDeployer {
79            repository(url: uri(rootProject.ext.supportRepoOut)) {
80            }
81
82            pom.project {
83                name 'Android AppCompat Library v7'
84                description "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 4 or later."
85                url 'http://developer.android.com/tools/extras/support-library.html'
86                inceptionYear '2011'
87
88                licenses {
89                    license {
90                        name 'The Apache Software License, Version 2.0'
91                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
92                        distribution 'repo'
93                    }
94                }
95
96                scm {
97                    url "http://source.android.com"
98                    connection "scm:git:https://android.googlesource.com/platform/frameworks/support"
99                }
100                developers {
101                    developer {
102                        name 'The Android Open Source Project'
103                    }
104                }
105            }
106        }
107    }
108}