def javaApiUrl = 'http://docs.oracle.com/javase/1.7.0/docs/api'
def groovyApiUrl = "http://docs.groovy-lang.org/2.4.7/html/gapi/"

tasks.withType(Javadoc) {
    classpath += project.configurations.shadow
    options.links(javaApiUrl, groovyApiUrl)
    if (JavaVersion.current().java8Compatible) {
        options.addStringOption('Xdoclint:none', '-quiet')
    }
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from 'build/docs/javadoc'
}

task sourcesJar(type: Jar) {
    classifier = 'sources'
    from sourceSets.main.allSource
}

project.tasks.groovydoc {
    classpath += project.configurations.shadow
}

build.dependsOn javadocJar, sourcesJar
