1/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
17
18
19apply plugin: 'com.android.library'
20
21archivesBaseName = 'preference-v14'
22
23dependencies {
24    compile project(':support-v4')
25    compile project(':support-appcompat-v7')
26    compile project(':support-recyclerview-v7')
27    compile project(':support-preference-v7')
28}
29
30android {
31    compileSdkVersion project.ext.currentSdk
32
33    sourceSets {
34        main.manifest.srcFile 'AndroidManifest.xml'
35        main.java.srcDir 'src'
36        main.res.srcDir 'res'
37        main.assets.srcDir 'assets'
38        main.resources.srcDir 'src'
39
40        // this moves src/instrumentTest to tests so all folders follow:
41        // tests/java, tests/res, tests/assets, ...
42        // This is a *reset* so it replaces the default paths
43        androidTest.setRoot('tests')
44        androidTest.java.srcDir 'tests/src'
45    }
46
47    compileOptions {
48        sourceCompatibility JavaVersion.VERSION_1_7
49        targetCompatibility JavaVersion.VERSION_1_7
50    }
51
52    lintOptions {
53        // TODO: fix errors and reenable.
54        abortOnError false
55    }
56}
57
58android.libraryVariants.all { variant ->
59    def name = variant.buildType.name
60
61    if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
62        return; // Skip debug builds.
63    }
64    def suffix = name.capitalize()
65
66    def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){
67        dependsOn variant.javaCompile
68        from variant.javaCompile.destinationDir
69        from 'LICENSE.txt'
70    }
71    def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
72        source android.sourceSets.main.java
73        classpath = files(variant.javaCompile.classpath.files) + files(
74                "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
75    }
76
77    def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
78        classifier = 'javadoc'
79        from 'build/docs/javadoc'
80    }
81
82    def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
83        classifier = 'sources'
84        from android.sourceSets.main.java.srcDirs
85    }
86
87    artifacts.add('archives', javadocJarTask);
88    artifacts.add('archives', sourcesJarTask);
89}
90
91uploadArchives {
92    repositories {
93        mavenDeployer {
94            repository(url: uri(rootProject.ext.supportRepoOut)) {
95            }
96
97            pom.project {
98                name 'Android Support Preference v14'
99                description "Android Support Preference v14"
100                url 'http://developer.android.com/tools/extras/support-library.html'
101                inceptionYear '2015'
102
103                licenses {
104                    license {
105                        name 'The Apache Software License, Version 2.0'
106                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
107                        distribution 'repo'
108                    }
109                }
110
111                scm {
112                    url "http://source.android.com"
113                    connection "scm:git:https://android.googlesource.com/platform/frameworks/support"
114                }
115                developers {
116                    developer {
117                        name 'The Android Open Source Project'
118                    }
119                }
120            }
121        }
122    }
123}
124