| apply plugin: 'java' |
| |
| archivesBaseName = 'support-v4' |
| |
| // -------------------------- |
| // TO ADD NEW PLATFORM SPECIFIC CODE, UPDATE THIS: |
| // create and configure the sourcesets/dependencies for platform-specific code. |
| // values are: sourceset name, source folder name, api level, previous sourceset. |
| def eclairSS = createApiSourceset('eclair', 'eclair', '5', null) |
| def eclairMr1SS = createApiSourceset('eclairmr1', 'eclair-mr1', '7', eclairSS) |
| def froyoSS = createApiSourceset('froyo', 'froyo', '8', eclairMr1SS) |
| def gingerbreadSS = createApiSourceset('gingerbread', 'gingerbread', '9', froyoSS) |
| def honeycombSS = createApiSourceset('honeycomb', 'honeycomb', '11', gingerbreadSS) |
| def honeycombMr2SS = createApiSourceset('honeycombmr2', 'honeycomb_mr2', '13', honeycombSS) |
| def icsSS = createApiSourceset('ics', 'ics', '14', honeycombMr2SS) |
| def icsMr1SS = createApiSourceset('icsmr1', 'ics-mr1', '15', icsSS) |
| def jbSS = createApiSourceset('jellybean', 'jellybean', '16', icsMr1SS) |
| def jbMr1SS = createApiSourceset('jellybeanmr1', 'jellybean-mr1', '17', jbSS) |
| def jbMr2SS = createApiSourceset('jellybeanmr2', 'jellybean-mr2', '18', jbMr1SS) |
| def kitkatSS = createApiSourceset('kitkat', 'kitkat', '19', jbMr2SS) |
| def api20SS = createApiSourceset('api20', 'api20', 'current', kitkatSS) |
| |
| // setup the main code to depend on the above through the highest platform-specific sourceset. |
| setupDependencies('compile', api20SS) |
| // -------------------------- |
| |
| def createApiSourceset(String name, String folder, String apiLevel, SourceSet previousSource) { |
| def sourceSet = sourceSets.create(name) |
| sourceSet.java.srcDirs = [folder] |
| |
| def configName = sourceSet.getCompileConfigurationName() |
| |
| project.getDependencies().add(configName, getAndroidPrebuilt(apiLevel)) |
| if (previousSource != null) { |
| setupDependencies(configName, previousSource) |
| } |
| |
| project.jar { |
| from sourceSet.output |
| } |
| |
| return sourceSet |
| } |
| |
| def setupDependencies(String configName, SourceSet previousSourceSet) { |
| project.getDependencies().add(configName, previousSourceSet.output) |
| project.getDependencies().add(configName, previousSourceSet.compileClasspath) |
| } |
| |
| // the main sourceset and its dependencies |
| sourceSets { |
| main.java.srcDirs = ['java'] |
| } |
| |
| dependencies { |
| compile project(':support-annotations') |
| compile getAndroidPrebuilt('4') |
| } |
| |
| uploadArchives { |
| repositories { |
| mavenDeployer { |
| repository(url: uri(rootProject.ext.supportRepoOut)) { |
| } |
| |
| pom.project { |
| name 'Android Support Library v4' |
| 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." |
| url 'http://developer.android.com/tools/extras/support-library.html' |
| inceptionYear '2011' |
| |
| licenses { |
| license { |
| name 'The Apache Software License, Version 2.0' |
| url 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
| distribution 'repo' |
| } |
| } |
| |
| scm { |
| url "http://source.android.com" |
| connection "scm:git:https://android.googlesource.com/platform/frameworks/support" |
| } |
| developers { |
| developer { |
| name 'The Android Open Source Project' |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| // configuration for the javadoc to include all source sets. |
| javadoc { |
| source sourceSets.main.allJava |
| source sourceSets.eclair.allJava |
| source sourceSets.eclairmr1.allJava |
| source sourceSets.froyo.allJava |
| source sourceSets.gingerbread.allJava |
| source sourceSets.honeycomb.allJava |
| source sourceSets.honeycombmr2.allJava |
| source sourceSets.ics.allJava |
| source sourceSets.icsmr1.allJava |
| source sourceSets.jellybean.allJava |
| source sourceSets.jellybeanmr1.allJava |
| source sourceSets.jellybeanmr2.allJava |
| source sourceSets.kitkat.allJava |
| } |
| |
| // custom tasks for creating source/javadoc jars |
| task sourcesJar(type: Jar, dependsOn:classes) { |
| classifier = 'sources' |
| from sourceSets.main.allSource |
| from sourceSets.eclair.allSource |
| from sourceSets.eclairmr1.allSource |
| from sourceSets.froyo.allSource |
| from sourceSets.gingerbread.allSource |
| from sourceSets.honeycomb.allSource |
| from sourceSets.honeycombmr2.allSource |
| from sourceSets.ics.allSource |
| from sourceSets.icsmr1.allSource |
| from sourceSets.jellybean.allSource |
| from sourceSets.jellybeanmr1.allSource |
| from sourceSets.jellybeanmr2.allSource |
| from sourceSets.kitkat.allSource |
| } |
| |
| task javadocJar(type: Jar, dependsOn:javadoc) { |
| classifier 'javadoc' |
| from javadoc.destinationDir |
| } |
| |
| // add javadoc/source jar tasks as artifacts |
| artifacts { |
| archives jar |
| archives sourcesJar |
| archives javadocJar |
| } |