• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1apply plugin: 'com.android.library'
2
3archivesBaseName = 'cardview-v7'
4
5dependencies {
6    compile project(':support-annotations')
7}
8
9android {
10    // WARNING: should be 7
11    compileSdkVersion project.ext.currentSdk
12
13    defaultConfig {
14        minSdkVersion 7
15        // TODO: get target from branch
16        //targetSdkVersion 19
17    }
18
19    compileOptions {
20        sourceCompatibility JavaVersion.VERSION_1_7
21        targetCompatibility JavaVersion.VERSION_1_7
22    }
23
24    sourceSets {
25        main.manifest.srcFile 'AndroidManifest.xml'
26        main.java.srcDirs = ['base', 'eclair-mr1', 'jellybean-mr1', 'api21', 'src']
27        main.aidl.srcDirs = ['base', 'eclair-mr1', 'jellybean-mr1', 'api21', 'src']
28        main.res.srcDirs = ['res']
29
30        androidTest.setRoot('tests')
31        androidTest.java.srcDir 'tests/java'
32    }
33
34    compileOptions {
35        sourceCompatibility JavaVersion.VERSION_1_7
36        targetCompatibility JavaVersion.VERSION_1_7
37    }
38
39    lintOptions {
40        // TODO: fix errors and reenable.
41        abortOnError false
42    }
43}
44
45android.libraryVariants.all { variant ->
46    def name = variant.buildType.name
47
48    if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
49        return; // Skip debug builds.
50    }
51    def suffix = name.capitalize()
52
53    def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){
54        dependsOn variant.javaCompile
55        from variant.javaCompile.destinationDir
56        from 'LICENSE.txt'
57    }
58    def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
59        source android.sourceSets.main.java
60        classpath = files(variant.javaCompile.classpath.files) + files(
61                "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
62    }
63
64    def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
65        classifier = 'javadoc'
66        from 'build/docs/javadoc'
67    }
68
69    def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
70        classifier = 'sources'
71        from android.sourceSets.main.java.srcDirs
72    }
73
74    artifacts.add('archives', javadocJarTask);
75    artifacts.add('archives', sourcesJarTask);
76}
77
78uploadArchives {
79    repositories {
80        mavenDeployer {
81            repository(url: uri(rootProject.ext.supportRepoOut)) {
82            }
83
84            pom.project {
85                name 'Android Support CardView v7'
86                description "Android Support CardView v7"
87                url 'http://developer.android.com/tools/extras/support-library.html'
88                inceptionYear '2011'
89
90                licenses {
91                    license {
92                        name 'The Apache Software License, Version 2.0'
93                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
94                        distribution 'repo'
95                    }
96                }
97
98                scm {
99                    url "http://source.android.com"
100                    connection "scm:git:https://android.googlesource.com/platform/frameworks/support"
101                }
102                developers {
103                    developer {
104                        name 'The Android Open Source Project'
105                    }
106                }
107            }
108        }
109    }
110}
111