TAP5-2131 Adapt to choose between JDK6 and JDK7 stylesheets While here try to prevent accidental build based on a flawed javadoc tool: VU#225657 http://www.kb.cert.org/vuls/id/225657
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/c42c1c0d Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/c42c1c0d Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/c42c1c0d Branch: refs/heads/master Commit: c42c1c0d23ac37976f4280c99c51d1f2ca1b008c Parents: 8400097 Author: Massimo Lusetti <[email protected]> Authored: Thu Jun 20 19:47:20 2013 +0200 Committer: Massimo Lusetti <[email protected]> Committed: Thu Jun 20 19:47:20 2013 +0200 ---------------------------------------------------------------------- build.gradle | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/c42c1c0d/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index 59c349c..4ba47fe 100755 --- a/build.gradle +++ b/build.gradle @@ -258,22 +258,27 @@ subprojects.each { project.evaluationDependsOn(it.name) } // Cribbed from https://github.com/hibernate/hibernate-core/blob/master/release/release.gradle#L19 - task aggregateJavadoc(type: Javadoc) { + if ( !checkJDK() ) + throw new StopActionException("Update your JDK to fix VU#225657") + dependsOn configurations.javadoc group "Documentation" description "Build the aggregated JavaDocs for all modules" maxMemory "512m" destinationDir file("$buildDir/documentation/javadocs") + + def tapestryStylesheet = isJDK7() ? file("src/javadoc/stylesheet7.css") : file("src/javadoc/stylesheet.css"); + configure(options) { splitIndex true linkSource true - stylesheetFile file("src/javadoc/stylesheet.css") + stylesheetFile tapestryStylesheet windowTitle "Tapestry API Documentation" docTitle "Tapestry JavaDoc ($project.version)" - bottom 'Copyright © 2003-2012 <a href="http://tapestry.apache.org">The Apache Software Foundation</a>.' + bottom 'Copyright © 2003-2013 <a href="http://tapestry.apache.org">The Apache Software Foundation</a>.' use = true // 'use' seems to be a reserved word for the DSL links "http://download.oracle.com/javase/6/docs/api/" links "http://download.oracle.com/javaee/6/api/" @@ -485,3 +490,22 @@ boolean isSnapshot() { boolean isWindows() { System.properties['os.name'].toLowerCase().contains('windows') } + +boolean isJDK7() { + System.properties['java.version'].startsWith("1.7.") +} + +// Check JDK version to prevent VU#225657 see: +// http://www.oracle.com/technetwork/topics/security/javacpujun2013-1899847.html +// http://www.kb.cert.org/vuls/id/225657 +boolean checkJDK() { + def jdkVersion = System.properties['java.version'] + def minor = Integer.valueOf(jdkVersion.substring(jdkVersion.indexOf("_")+1)) + + if (jdkVersion.startsWith("1.7")) { + minor > 21 + } + else { // JDK 6 and 5 require the same minor version + minor > 45 + } +} \ No newline at end of file
