blob: a63cc9ed0db1f3df936ee6eeeec742f2a65ef5c9 [file] [log] [blame]
Tony Mantler6904f672015-02-19 08:58:37 -08001/*
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
Yigit Boyar02a9e8c2016-01-26 20:41:00 -080017apply plugin: 'com.android.library'
Tony Mantler6904f672015-02-19 08:58:37 -080018
19archivesBaseName = 'preference-v7'
20
21dependencies {
22 compile project(':support-v4')
23 compile project(':support-appcompat-v7')
24 compile project(':support-recyclerview-v7')
Tony Mantler84352192016-07-20 11:39:11 -070025
26 androidTestCompile ("com.android.support.test:runner:${project.rootProject.ext.testRunnerVersion}") {
27 exclude module: 'support-annotations'
28 }
29 androidTestCompile ("com.android.support.test.espresso:espresso-core:${project.rootProject.ext.espressoVersion}") {
30 exclude module: 'support-annotations'
31 }
32 testCompile 'junit:junit:4.12'
Tony Mantler6904f672015-02-19 08:58:37 -080033}
34
35android {
Yigit Boyar02a9e8c2016-01-26 20:41:00 -080036 compileSdkVersion project.ext.currentSdk
Tony Mantler6904f672015-02-19 08:58:37 -080037
Tony Mantler84352192016-07-20 11:39:11 -070038 defaultConfig {
39 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Alan Viverette9439d702016-10-25 14:45:10 +010040 minSdkVersion 9
Tony Mantler84352192016-07-20 11:39:11 -070041 }
42
Tony Mantler6904f672015-02-19 08:58:37 -080043 sourceSets {
44 main.manifest.srcFile 'AndroidManifest.xml'
45 main.java.srcDir 'src'
Jason Monk3fadd622015-10-28 14:33:19 -040046 main.java.srcDir 'constants'
Tony Mantler6904f672015-02-19 08:58:37 -080047 main.res.srcDir 'res'
48 main.assets.srcDir 'assets'
49 main.resources.srcDir 'src'
50
51 // this moves src/instrumentTest to tests so all folders follow:
52 // tests/java, tests/res, tests/assets, ...
53 // This is a *reset* so it replaces the default paths
54 androidTest.setRoot('tests')
55 androidTest.java.srcDir 'tests/src'
Tony Mantler84352192016-07-20 11:39:11 -070056 androidTest.res.srcDir 'tests/res'
57 androidTest.manifest.srcFile 'tests/AndroidManifest.xml'
Tony Mantler6904f672015-02-19 08:58:37 -080058 }
59
60 compileOptions {
61 sourceCompatibility JavaVersion.VERSION_1_7
62 targetCompatibility JavaVersion.VERSION_1_7
63 }
64
65 lintOptions {
Alan Viveretteaf6b2512016-11-16 17:33:10 -050066 // Remove this once all NewApi breakages have been fixed.
67 disable "NewApi"
Tony Mantler6904f672015-02-19 08:58:37 -080068 }
Tony Mantler06f9ee52015-08-21 10:55:03 -070069
70 buildTypes.all {
71 consumerProguardFiles 'proguard-rules.pro'
72 }
Tony Mantler6904f672015-02-19 08:58:37 -080073}
Tony Mantlera2dbc752015-10-07 15:34:36 -070074
Alan Viverette523ece82016-06-09 14:13:34 -040075android.libraryVariants.all { variant ->
76 def name = variant.buildType.name
77
78 if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
79 return; // Skip debug builds.
80 }
81 def suffix = name.capitalize()
82
83 def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){
84 dependsOn variant.javaCompile
85 from variant.javaCompile.destinationDir
86 from 'LICENSE.txt'
87 }
88 def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
89 source android.sourceSets.main.java
90 classpath = files(variant.javaCompile.classpath.files) + files(
91 "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
92 }
93
94 def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
95 classifier = 'javadoc'
96 from 'build/docs/javadoc'
97 }
98
99 def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
100 classifier = 'sources'
101 from android.sourceSets.main.java.srcDirs
102 }
103
104 artifacts.add('archives', javadocJarTask);
105 artifacts.add('archives', sourcesJarTask);
106}
107
Tony Mantlera2dbc752015-10-07 15:34:36 -0700108uploadArchives {
109 repositories {
110 mavenDeployer {
111 repository(url: uri(rootProject.ext.supportRepoOut)) {
112 }
113
114 pom.project {
115 name 'Android Support Preference v7'
116 description "Android Support Preference v7"
117 url 'http://developer.android.com/tools/extras/support-library.html'
118 inceptionYear '2015'
119
120 licenses {
121 license {
122 name 'The Apache Software License, Version 2.0'
123 url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
124 distribution 'repo'
125 }
126 }
127
128 scm {
129 url "http://source.android.com"
130 connection "scm:git:https://android.googlesource.com/platform/frameworks/support"
131 }
132 developers {
133 developer {
134 name 'The Android Open Source Project'
135 }
136 }
137 }
138 }
139 }
140}