Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 0704f7c41d
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 135 lines (127 sloc) 6.138 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
task doc(dependsOn: ['javadocAll', 'groovydocAll', 'docGDK']) {
    ext.footer = "Copyright © 2003-2012 The Codehaus. All rights reserved."
    ext.title = "Groovy ${groovyVersion}"
}

def javadocSpec = {
    maxMemory = javaDoc_mx
    project.configure(options) {
        windowTitle = doc.title
        docTitle = doc.title
        encoding = "UTF-8"
        author = true
        version = true
        overview = rootProject.file("src/main/overviewj.html")
        footer = doc.footer
        source = rootProject.useIndy()?'1.7':'1.5'
        links("http://docs.oracle.com/javase/6/docs/api/", "http://evgeny-goldin.org/javadoc/ant/api/",
                "http://commons.apache.org/cli/api-release", "http://kentbeck.github.com/junit/javadoc/latest/",
                "http://docs.oracle.com/javaee/6/api/", "http://www.antlr2.org/javadoc")
    }
}

def groovydocSpec = {
    use = true
    if (project != rootProject) source = project.sourceSets.main.allSource
    classpath = javadoc.classpath
    ext.windowtitle = doc.title
    ext.doctitle = doc.title
    header = doc.title
    footer = doc.footer
    overview = rootProject.file("src/main/overview.html")
    includePrivate = false
    link "http://docs.oracle.com/javaee/6/api/", "javax.servlet.", "javax.management."
    link "http://docs.oracle.com/javase/6/docs/api/", "java.", "org.xml.", "javax.", "org.w3c."
    link "http://evgeny-goldin.org/javadoc/ant/api/", "org.apache.ant.", "org.apache.tools.ant."
    link "http://kentbeck.github.com/junit/javadoc/latest/", "org.junit.", "junit."
    link "http://www.antlr2.org/javadoc", "antlr."
    link "http://commons.apache.org/cli/api-release", "org.apache.commons.cli."
}

allprojects {
    javadoc javadocSpec
    groovydoc groovydocSpec
}

// Root project has an extra 'all' javadoc task
task javadocAll(type:Javadoc) << javadocSpec
javadocAll {
    destinationDir = new File(buildDir,'alljavadoc')
    source = javadoc.source
    classpath = javadoc.classpath
    subprojects.each { sp ->
        source += sp.javadoc.source
        classpath += sp.javadoc.classpath
    }
}

// Root project has an extra 'all' groovydoc task
task groovydocAll(type:Groovydoc) << groovydocSpec
groovydocAll {
    dependsOn( { project(':groovy-groovydoc').classes })
    dependsOn( { project(':groovy-docgenerator').classes })
    destinationDir = new File(buildDir,'allgroovydoc')
    source = groovydoc.source
    classpath = groovydoc.classpath
    groovyClasspath = groovydoc.groovyClasspath
    subprojects.each { sp ->
        source += sp.groovydoc.source
        classpath += sp.groovydoc.classpath
        groovyClasspath += sp.groovydoc.groovyClasspath
    }
}

// when docgenerator is run by the build, it requires a groovy-release-info file
// but the file is only generated by the 'jar' task, so as a workaround, we copy
// it into the docgenerator classes
task docProjectVersionInfo(type: Copy) {
    destinationDir = file("${project(':groovy-docgenerator').buildDir}/classes/main")
    into('META-INF') {
        from('src/main/META-INF/groovy-release-info.properties') {
            filter(rootProject.propertiesFilter, org.apache.tools.ant.filters.ReplaceTokens)
        }
    }
}

task docGDK {
// ext.extraDocGDKclasses = []
    dependsOn([project(':groovy-groovydoc'), project(':groovy-docgenerator')]*.classes)
    // TODO don't hard-code these
    dependsOn([project(':groovy-sql'), project(':groovy-sql'), project(':groovy-swing')]*.classes)
    dependsOn docProjectVersionInfo
    ext.destinationDir = "$buildDir/html/groovy-jdk"
    inputs.files sourceSets.tools.runtimeClasspath
    outputs.dir destinationDir
    doLast {task ->
        try {
            ant {
                java(classname: "org.codehaus.groovy.tools.DocGenerator", fork: "true", failonerror: "true",
                        classpath: (configurations.tools + groovydocAll.groovyClasspath).asPath,
                        errorproperty: 'edr',
                        outputproperty: 'odr') {
                    // either package name if in core or fully qualified path otherwise
                    arg(value: "org.codehaus.groovy.runtime.DefaultGroovyMethods")
                    arg(value: "org.codehaus.groovy.runtime.DefaultGroovyStaticMethods")
                    arg(value: "org.codehaus.groovy.runtime.DateGroovyMethods")
                    arg(value: "org.codehaus.groovy.runtime.EncodingGroovyMethods")
                    arg(value: "org.codehaus.groovy.runtime.IOGroovyMethods")
                    arg(value: "org.codehaus.groovy.runtime.ProcessGroovyMethods")
                    arg(value: "org.codehaus.groovy.runtime.ResourceGroovyMethods")
                    arg(value: "org.codehaus.groovy.runtime.SocketGroovyMethods")
                    arg(value: "org.codehaus.groovy.runtime.StringGroovyMethods")
                    arg(value: "org.codehaus.groovy.vmplugin.v5.PluginDefaultGroovyMethods")
                    arg(value: "org.codehaus.groovy.vmplugin.v6.PluginDefaultGroovyMethods")
                    arg(value: "org.codehaus.groovy.vmplugin.v6.PluginStaticGroovyMethods")
                    // TODO don't hard-code these
                    arg(value: "subprojects/groovy-sql/src/main/java/org/codehaus/groovy/runtime/SqlGroovyMethods.java")
                    arg(value: "subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java")
                    arg(value: "subprojects/groovy-xml/src/main/java/org/codehaus/groovy/runtime/XmlGroovyMethods.java")
                }
            }
        } finally {
            if (ant.properties.odr) {
                logger.info "Out: " + ant.properties.odr
            }
            if (ant.properties.edr) {
                logger.error "Err: " + ant.properties.edr
            }
        }
        copy {
            into task.destinationDir
            from "src/tools/org/codehaus/groovy/tools/groovy.ico", "src/tools/org/codehaus/groovy/tools/stylesheet.css"
        }
    }
}
Something went wrong with that request. Please try again.