ICU-10988 Changed the default javadoc implementation to JDK7, updated the build script to use JDK8 supported version at build time if JDK8 is used. Prints out warning in top-level release targets, when JDK8 is used.

X-SVN-Rev: 37999
This commit is contained in:
Yoshito Umaoka 2015-09-23 03:59:54 +00:00
parent c5324d571a
commit 44a9dcdabe
8 changed files with 115 additions and 119 deletions

1
.gitattributes vendored
View file

@ -489,7 +489,6 @@ icu4j/tools/build/icu4j52.api3.gz -text
icu4j/tools/build/icu4j53.api3.gz -text
icu4j/tools/build/icu4j54.api3.gz -text
icu4j/tools/build/icu4j55.api3.gz -text
icu4j/tools/build/src/com/ibm/icu/dev/tool/docs/ICUTagletAdapter.java7 -text
tools/currency/.classpath -text
tools/currency/.project -text
tools/currency/.settings/org.eclipse.core.resources.prefs -text

View file

@ -83,6 +83,10 @@
</condition>
</fail>
<condition property="is.java7">
<contains string="${java.version}" substring="1.7."/>
</condition>
<condition property="is.java7.plus">
<or>
<contains string="${java.version}" substring="1.7."/>
@ -423,6 +427,7 @@
<target name="_check_config_for_release">
<condition property="release.build.config.ok">
<and>
<isset property="is.java7"/>
<isset property="java5.bootclasspath"/>
<isset property="java6.bootclasspath"/>
<isset property="jcite.libs"/>
@ -431,6 +436,9 @@
</target>
<target name="_verify_config_for_release" depends="_check_config_for_release" unless="release.build.config.ok">
<condition property="disp.is.java7" value="${java.version}" else="${java.version} - Must be 1.7!">
<isset property="is.java7"/>
</condition>
<condition property="disp.java5.bootclasspath" value="${java5.bootclasspath}" else="Not Defined!">
<isset property="java5.bootclasspath"/>
</condition>
@ -443,6 +451,7 @@
<echo message="################################################################"/>
<echo message="[WARNING] Insufficient Build Configuration for ICU4J Release"/>
<echo message="JDK Tools Version: ${disp.is.java7}"/>
<echo message="JRE 5 System Library Path: ${disp.java5.bootclasspath}"/>
<echo message="JRE 6 System Library Path: ${disp.java6.bootclasspath}"/>
<echo message="JCite Library Path: ${disp.jcite.libs}"/>

View file

@ -2,6 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JDK8_TOOLS"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JDK7_TOOLS"/>
<classpathentry kind="output" path="out/bin"/>
</classpath>

View file

@ -84,6 +84,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning

View file

@ -1,12 +1,22 @@
<!--
*******************************************************************************
* Copyright (C) 2009-2011, 2015 International Business Machines Corporation *
* and others. All Rights Reserved. *
* Copyright (C) 2009-2015, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
-->
<project name="build-tools" default="build" basedir=".">
<property file="build-local.properties"/>
<property file="build.properties"/>
<!-- before importing common-targets.xml -->
<condition property="alt.src.dir" value="out/tmp-src8">
<equals arg1="${ant.java.version}" arg2="1.8"/>
</condition>
<condition property="src.dir" value="${alt.src.dir}">
<isset property="alt.src.dir"/>
</condition>
<import file="${shared.dir}/build/common-targets.xml"/>
<path id="javac.classpathref">
@ -14,55 +24,32 @@
</path>
<property name="jar.name" value="icu4j-${ant.project.name}.jar"/>
<property name="src.jar.name" value="icu4j-${ant.project.name}-src.jar"/>
<property name="icutaglet.adapter" value="./src/com/ibm/icu/dev/tool/docs/ICUTagletAdapter.java"/>
<property name="v7.icutaglet.adapter" value="${icutaglet.adapter}7"/>
<target name="info" description="Display the build environment information">
<echo message="----- Build Environment Information -------------------"/>
<echo message="Java Home: ${java.home}"/>
<echo message="Java Version: ${java.version}"/>
<echo message="Ant Home: ${ant.home}"/>
<echo message="Ant Version: ${ant.version}"/>
<echo message="OS: ${os.name}"/>
<echo message="OS Version: ${os.version}"/>
<echo message="OS Arch: ${os.arch}"/>
<echo message="Host: ${env.COMPUTERNAME}"/>
<echo message="-------------------------------------------------------"/>
</target>
<target name="build" depends="info, compile, copy, jar, adapter-notify" description="Build the project"/>
<target name="build" depends="compile, copy, jar" description="Build the project"/>
<target name="build-all" depends="@build-all" description="Build the project including all dependencies"/>
<target name="clean" depends="@clean" description="Clean up the build outputs"/>
<target name="compile" depends="set-javadoc-adapter, @compile" description="Compile java source files"/>
<target name="compile" depends="copy-src-jdk8, @compile" description="Compile java source files"/>
<target name="copy" depends="@copy" description="Copy non-java runtime files to the project's binary directory"/>
<target name="jar" depends="compile, copy, @jar" description="Create the project's jar file"/>
<target name="src-jar" depends="@src-jar" description="Create the project's source jar file"/>
<target name="java-version" depends="info">
<condition property="java.version.pre8">
<or>
<equals arg1="${ant.java.version}" arg2="1.5"/>
<equals arg1="${ant.java.version}" arg2="1.6"/>
<equals arg1="${ant.java.version}" arg2="1.7"/>
</or>
</condition>
</target>
<target name="set-javadoc-adapter" depends="java-version" if="java.version.pre8">
<echo message="pre v8 Java build detected...setting taglet adapter to older API adapter"/>
<copy file="${v7.icutaglet.adapter}" tofile="${icutaglet.adapter}" overwrite="true" />
</target>
<target name="adapter-notify" depends="java-version" if="java.version.pre8">
<echo message="pre v8 Java build detected and the adapter was set to the older API adapter"/>
<echo message="NOTE: revert this change once the docs are built with this older Javadoc version "/>
<echo message="file to revert is: ${icutaglet.adapter}"/>
</target>
<target name="src-jar" depends="copy-src-jdk8, @src-jar" description="Create the project's source jar file"/>
<!-- Override a source file for supporting JDK 8 JavaDoc -->
<target name="copy-src-jdk8" if="alt.src.dir">
<echo message="Building ICU4J build tools with JDK8 tools..."/>
<mkdir dir="${alt.src.dir}"/>
<!-- copy all files under 'src' -->
<copy todir="${alt.src.dir}">
<fileset dir="src"/>
</copy>
<!-- overwrite jdk8 specific source file -->
<copy todir="${alt.src.dir}" overwrite="yes">
<fileset dir="src8"/>
</copy>
</target>
</project>

View file

@ -8,51 +8,40 @@ package com.ibm.icu.dev.tool.docs;
import com.sun.javadoc.Doc;
import com.sun.javadoc.Tag;
import com.sun.tools.doclets.formats.html.markup.RawHtml;
import com.sun.tools.doclets.internal.toolkit.Content;
import com.sun.tools.doclets.internal.toolkit.taglets.Taglet;
import com.sun.tools.doclets.internal.toolkit.taglets.TagletOutput;
import com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter;
/**
* The ICUTagletAdapter class is the abstract base class that adapts the ICUTaglet class to different implementations of the JavaDoc API.
* The methods in this class are meant to minimize the dual maintenance nature of supporting multiple JavaDoc APIs.
*
* This adapter supports the v8 JavaDoc API
* This adapter supports the v7 and earlier JavaDoc API
*/
public abstract class ICUTagletAdapter implements Taglet {
public abstract String toString(Tag tag);
public abstract String toString(Tag[] tags);
public Content getTagletOutput(Tag tag, TagletWriter writer)
throws IllegalArgumentException {
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer)
throws IllegalArgumentException {
// addContext doesn't except nulls so filter them out
String encodedText = toString(tag);
if(encodedText == null) return null;
Content out = writer.getOutputInstance();
out.addContent(new RawHtml(encodedText));
return out;
}
public Content getTagletOutput(Doc holder, TagletWriter writer)
throws IllegalArgumentException {
Content out = writer.getOutputInstance();
Tag[] tags = holder.tags(getName());
if (tags.length == 0) {
return null;
TagletOutput out = writer.getTagletOutputInstance();
out.setOutput(toString(tag));
return out;
}
// addContext doesn't except nulls so filter them out
String encodedText = toString(tags[0]);
if(encodedText == null) return null;
public TagletOutput getTagletOutput(Doc holder, TagletWriter writer)
throws IllegalArgumentException {
out.addContent(new RawHtml(encodedText));
return out;
}
TagletOutput out = writer.getTagletOutputInstance();
Tag[] tags = holder.tags(getName());
if (tags.length == 0) {
return null;
}
out.setOutput(toString(tags[0]));
return out;
}
}

View file

@ -1,47 +0,0 @@
/*
*******************************************************************************
* Copyright (C) 2015, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
package com.ibm.icu.dev.tool.docs;
import com.sun.javadoc.Doc;
import com.sun.javadoc.Tag;
import com.sun.tools.doclets.internal.toolkit.taglets.Taglet;
import com.sun.tools.doclets.internal.toolkit.taglets.TagletOutput;
import com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter;
/**
* The ICUTagletAdapter class is the abstract base class that adapts the ICUTaglet class to different implementations of the JavaDoc API.
* The methods in this class are meant to minimize the dual maintenance nature of supporting multiple JavaDoc APIs.
*
* This adapter supports the v7 and earlier JavaDoc API
*/
public abstract class ICUTagletAdapter implements Taglet {
public abstract String toString(Tag tag);
public abstract String toString(Tag[] tags);
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer)
throws IllegalArgumentException {
TagletOutput out = writer.getTagletOutputInstance();
out.setOutput(toString(tag));
return out;
}
public TagletOutput getTagletOutput(Doc holder, TagletWriter writer)
throws IllegalArgumentException {
TagletOutput out = writer.getTagletOutputInstance();
Tag[] tags = holder.tags(getName());
if (tags.length == 0) {
return null;
}
out.setOutput(toString(tags[0]));
return out;
}
}

View file

@ -0,0 +1,58 @@
/*
*******************************************************************************
* Copyright (C) 2015, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
package com.ibm.icu.dev.tool.docs;
import com.sun.javadoc.Doc;
import com.sun.javadoc.Tag;
import com.sun.tools.doclets.formats.html.markup.RawHtml;
import com.sun.tools.doclets.internal.toolkit.Content;
import com.sun.tools.doclets.internal.toolkit.taglets.Taglet;
import com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter;
/**
* The ICUTagletAdapter class is the abstract base class that adapts the ICUTaglet class to different implementations of the JavaDoc API.
* The methods in this class are meant to minimize the dual maintenance nature of supporting multiple JavaDoc APIs.
*
* This adapter supports the v8 JavaDoc API
*/
public abstract class ICUTagletAdapter implements Taglet {
public abstract String toString(Tag tag);
public abstract String toString(Tag[] tags);
public Content getTagletOutput(Tag tag, TagletWriter writer)
throws IllegalArgumentException {
// addContext doesn't except nulls so filter them out
String encodedText = toString(tag);
if(encodedText == null) return null;
Content out = writer.getOutputInstance();
out.addContent(new RawHtml(encodedText));
return out;
}
public Content getTagletOutput(Doc holder, TagletWriter writer)
throws IllegalArgumentException {
Content out = writer.getOutputInstance();
Tag[] tags = holder.tags(getName());
if (tags.length == 0) {
return null;
}
// addContext doesn't except nulls so filter them out
String encodedText = toString(tags[0]);
if(encodedText == null) return null;
out.addContent(new RawHtml(encodedText));
return out;
}
}