普通文本  |  146行  |  4.77 KB

apply plugin: 'java'

archivesBaseName = 'support-v4'

sourceSets {
    main.java.srcDir 'java'
    eclair.java.srcDir 'eclair'
    eclairmr1.java.srcDir 'eclair-mr1'
    froyo.java.srcDir 'froyo'
    gingerbread.java.srcDir 'gingerbread'
    honeycomb.java.srcDir 'honeycomb'
    honeycombmr2.java.srcDir 'honeycomb_mr2'
    ics.java.srcDir 'ics'
    icsmr1.java.srcDir 'ics-mr1'
    jellybean.java.srcDir 'jellybean'
    jellybeanmr1.java.srcDir 'jellybean-mr1'
    jellybeanmr2.java.srcDir 'jellybean-mr2'
    kitkat.java.srcDir 'kitkat'
}

dependencies {
    eclairCompile getAndroidPrebuilt('5')
    eclairmr1Compile getAndroidPrebuilt('7')
    froyoCompile getAndroidPrebuilt('8')
    gingerbreadCompile getAndroidPrebuilt('9')
    honeycombCompile getAndroidPrebuilt('11')
    honeycombmr2Compile getAndroidPrebuilt('13')
    icsCompile getAndroidPrebuilt('14')
    icsmr1Compile getAndroidPrebuilt('15')
    jellybeanCompile getAndroidPrebuilt('16')
    jellybeanmr1Compile getAndroidPrebuilt('17')
    jellybeanmr2Compile getAndroidPrebuilt('18')
    kitkatCompile getAndroidPrebuilt('19')

    compile getAndroidPrebuilt('4')
    compile sourceSets.eclair.output
    compile sourceSets.eclairmr1.output
    compile sourceSets.froyo.output
    compile sourceSets.gingerbread.output
    compile sourceSets.honeycomb.output
    compile sourceSets.honeycombmr2.output
    compile sourceSets.ics.output
    compile sourceSets.icsmr1.output
    compile sourceSets.jellybean.output
    compile sourceSets.jellybeanmr1.output
    compile sourceSets.jellybeanmr2.output
    compile sourceSets.kitkat.output
}


jar {
    from sourceSets.eclair.output
    from sourceSets.eclairmr1.output
    from sourceSets.froyo.output
    from sourceSets.gingerbread.output
    from sourceSets.honeycomb.output
    from sourceSets.honeycombmr2.output
    from sourceSets.ics.output
    from sourceSets.icsmr1.output
    from sourceSets.jellybean.output
    from sourceSets.jellybeanmr1.output
    from sourceSets.jellybeanmr2.output
    from sourceSets.kitkat.output
}

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: uri(project.parent.ext.androidRepoOut)) {
            }

            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
}