blob: d39c5dbff96a1c41edb7852502141ddf3764b055 [file] [log] [blame]
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -08001apply plugin: 'java'
2
3archivesBaseName = 'support-v4'
4
Xavier Ducrohet15474b92014-03-21 17:11:38 -07005// --------------------------
6// TO ADD NEW PLATFORM SPECIFIC CODE, UPDATE THIS:
7// create and configure the sourcesets/dependencies for platform-specific code.
8// values are: sourceset name, source folder name, api level, previous sourceset.
9def eclairSS = createApiSourceset('eclair', 'eclair', '5', null)
10def eclairMr1SS = createApiSourceset('eclairmr1', 'eclair-mr1', '7', eclairSS)
11def froyoSS = createApiSourceset('froyo', 'froyo', '8', eclairMr1SS)
12def gingerbreadSS = createApiSourceset('gingerbread', 'gingerbread', '9', froyoSS)
13def honeycombSS = createApiSourceset('honeycomb', 'honeycomb', '11', gingerbreadSS)
14def honeycombMr2SS = createApiSourceset('honeycombmr2', 'honeycomb_mr2', '13', honeycombSS)
15def icsSS = createApiSourceset('ics', 'ics', '14', honeycombMr2SS)
16def icsMr1SS = createApiSourceset('icsmr1', 'ics-mr1', '15', icsSS)
17def jbSS = createApiSourceset('jellybean', 'jellybean', '16', icsMr1SS)
18def jbMr1SS = createApiSourceset('jellybeanmr1', 'jellybean-mr1', '17', jbSS)
19def jbMr2SS = createApiSourceset('jellybeanmr2', 'jellybean-mr2', '18', jbMr1SS)
20def kitkatSS = createApiSourceset('kitkat', 'kitkat', '19', jbMr2SS)
Xavier Ducrohet261f67b2014-03-21 17:11:38 -070021def api20SS = createApiSourceset('api20', 'api20', 'current', kitkatSS)
Xavier Ducrohet855a9222014-01-02 19:00:43 -080022
Xavier Ducrohet15474b92014-03-21 17:11:38 -070023// setup the main code to depend on the above through the highest platform-specific sourceset.
Xavier Ducrohet261f67b2014-03-21 17:11:38 -070024setupDependencies('compile', api20SS)
Xavier Ducrohet15474b92014-03-21 17:11:38 -070025// --------------------------
26
27def createApiSourceset(String name, String folder, String apiLevel, SourceSet previousSource) {
28 def sourceSet = sourceSets.create(name)
29 sourceSet.java.srcDirs = [folder]
30
31 def configName = sourceSet.getCompileConfigurationName()
32
33 project.getDependencies().add(configName, getAndroidPrebuilt(apiLevel))
34 if (previousSource != null) {
35 setupDependencies(configName, previousSource)
36 }
37
38 project.jar {
39 from sourceSet.output
40 }
41
42 return sourceSet
43}
44
45def setupDependencies(String configName, SourceSet previousSourceSet) {
46 project.getDependencies().add(configName, previousSourceSet.output)
47 project.getDependencies().add(configName, previousSourceSet.compileClasspath)
48}
49
50// the main sourceset and its dependencies
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080051sourceSets {
Xavier Ducrohet15474b92014-03-21 17:11:38 -070052 main.java.srcDirs = ['java']
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080053}
54
55dependencies {
Tor Norbye05568b72014-03-20 19:19:52 -070056 compile project(':support-annotations')
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080057 compile getAndroidPrebuilt('4')
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080058}
59
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080060uploadArchives {
61 repositories {
62 mavenDeployer {
Xavier Ducrohet855a9222014-01-02 19:00:43 -080063 repository(url: uri(rootProject.ext.supportRepoOut)) {
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080064 }
65
66 pom.project {
67 name 'Android Support Library v4'
68 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."
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
94// configuration for the javadoc to include all source sets.
95javadoc {
96 source sourceSets.main.allJava
97 source sourceSets.eclair.allJava
Raphael Moll5057daa2013-10-29 17:01:14 -070098 source sourceSets.eclairmr1.allJava
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080099 source sourceSets.froyo.allJava
100 source sourceSets.gingerbread.allJava
101 source sourceSets.honeycomb.allJava
102 source sourceSets.honeycombmr2.allJava
103 source sourceSets.ics.allJava
104 source sourceSets.icsmr1.allJava
105 source sourceSets.jellybean.allJava
106 source sourceSets.jellybeanmr1.allJava
Alan Viverette5df122f2013-09-23 10:44:38 -0700107 source sourceSets.jellybeanmr2.allJava
108 source sourceSets.kitkat.allJava
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -0800109}
110
111// custom tasks for creating source/javadoc jars
112task sourcesJar(type: Jar, dependsOn:classes) {
113 classifier = 'sources'
114 from sourceSets.main.allSource
115 from sourceSets.eclair.allSource
Raphael Moll5057daa2013-10-29 17:01:14 -0700116 from sourceSets.eclairmr1.allSource
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -0800117 from sourceSets.froyo.allSource
118 from sourceSets.gingerbread.allSource
119 from sourceSets.honeycomb.allSource
120 from sourceSets.honeycombmr2.allSource
121 from sourceSets.ics.allSource
122 from sourceSets.icsmr1.allSource
123 from sourceSets.jellybean.allSource
124 from sourceSets.jellybeanmr1.allSource
Alan Viverette5df122f2013-09-23 10:44:38 -0700125 from sourceSets.jellybeanmr2.allSource
126 from sourceSets.kitkat.allSource
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -0800127}
128
129task javadocJar(type: Jar, dependsOn:javadoc) {
130 classifier 'javadoc'
131 from javadoc.destinationDir
132}
133
134// add javadoc/source jar tasks as artifacts
135artifacts {
136 archives jar
137 archives sourcesJar
138 archives javadocJar
139}