普通文本  |  95行  |  2.92 KB

apply plugin: 'java'
archivesBaseName = 'support-annotations'

sourceSets {
    main.java.srcDir 'src'
}

compileJava {
    sourceCompatibility = JavaVersion.VERSION_1_7
    targetCompatibility = JavaVersion.VERSION_1_7
}

jar {
    from sourceSets.main.output
    // Strip out typedef classes. For Android libraries, this is done
    // automatically by the Gradle plugin, but the Annotation library is a
    // plain jar, built by the regular Gradle java plugin. The typedefs
    // themselves have been manually extracted into the
    // external-annotations directory, and those are packaged separately
    // below by the annotationsZip task.
    exclude('android/support/annotation/ProductionVisibility.class')
    exclude('android/support/annotation/DimensionUnit.class')
}

uploadArchives {
    repositories {
        mavenDeployer {

            repository(url: uri(rootProject.ext.supportRepoOut)) {
            }

            pom.project {
                name 'Android Support Library Annotations'
                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."
                url 'http://developer.android.com/tools/extras/support-library.html'
                inceptionYear '2013'

                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
}

// Disable strict javadoc lint checks with javadoc v8 builds on Mac. http://b/26744780
if (JavaVersion.current().isJava8Compatible()) {
    tasks.withType(Javadoc) {
        options.addBooleanOption('Xdoclint:none', true)
    }
}

// custom tasks for creating source/javadoc jars
task sourcesJar(type: Jar, dependsOn:classes) {
    classifier = 'sources'
    from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn:javadoc) {
    classifier         'javadoc'
    from               javadoc.destinationDir
}

task annotationsZip(type: Zip) {
    classifier         'annotations'
    from               'external-annotations'
}

// add javadoc/source/annotations jar tasks as artifacts
artifacts {
    archives jar
    archives sourcesJar
    archives javadocJar
    archives annotationsZip
}