8038732: [javadoc] NetBeans IDE target does not build doclets

Reviewed-by: jjg, jlahoda
This commit is contained in:
Kumar Srinivasan 2014-08-27 06:25:17 -07:00
parent be04e8778b
commit d81bd9fdcf
4 changed files with 32 additions and 68 deletions

View File

@ -128,17 +128,11 @@ javac.tests = \
javadoc.includes = \
com/sun/javadoc/ \
com/sun/tools/javadoc/
javadoc.tests = \
tools/javadoc/
#
doclets.includes = \
com/sun/tools/javadoc/ \
com/sun/tools/doclets/
doclets.tests = \
javadoc.tests = \
tools/javadoc/ \
com/sun/javadoc/
#

View File

@ -83,7 +83,7 @@
- global property definitions
- general top level targets
- general diagnostic/debugging targets
- groups of targets for each tool: javac, javadoc, doclets, javah, javap
- groups of targets for each tool: javac, javadoc, javah, javap
Within each group, the following targets are provided, where applicable
build-bootstrap-TOOL build the bootstrap version of the tool
build-classes-TOOL build the classes for the tool
@ -252,15 +252,15 @@
</target>
<target name="build-bootstrap-tools"
depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah,build-bootstrap-sjavac"
depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-javah,build-bootstrap-sjavac"
/>
<target name="build-all-tools"
depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-sjavac"
depends="build-javac,build-javadoc,build-javah,build-javap,build-sjavac"
/>
<target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
<build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes} ${sjavac.includes}"/>
<build-classes includes="${javac.includes} ${javadoc.includes} ${javah.includes} ${javap.includes} ${sjavac.includes}"/>
</target>
<!-- clean -->
@ -615,7 +615,7 @@
<target name="build-bootstrap-javadoc" depends="build-bootstrap-javac">
<build-bootstrap-classes includes="${javadoc.includes}"/>
<build-bootstrap-jar name="javadoc" includes="${javadoc.includes}"
jarclasspath="javac.jar doclets.jar"/>
jarclasspath="javac.jar"/>
<build-bootstrap-tool name="javadoc"/>
</target>
@ -625,7 +625,7 @@
<target name="build-javadoc" depends="build-javac,build-classes-javadoc">
<build-jar name="javadoc" includes="${javadoc.includes}"
jarclasspath="javac.jar doclets.jar"/>
jarclasspath="javac.jar"/>
<build-tool name="javadoc"/>
</target>
@ -643,40 +643,6 @@
<target name="javadoc" depends="build-javadoc,jtreg-javadoc,findbugs-javadoc"/>
<!--
**** doclets targets.
-->
<target name="build-bootstrap-doclets" depends="build-bootstrap-javadoc,-def-build-bootstrap-jar">
<build-bootstrap-classes includes="${doclets.includes}"/>
<build-bootstrap-jar name="doclets" includes="${doclets.includes}"
jarmainclass="com.sun.tools.javadoc.Main"
jarclasspath="javadoc.jar"/>
</target>
<target name="build-classes-doclets" depends="build-classes-javadoc">
<build-classes includes="${doclets.includes}"/>
</target>
<target name="build-doclets" depends="build-javadoc,build-classes-doclets">
<!-- just jar, no bin for doclets -->
<build-jar name="doclets" includes="${doclets.includes}" jarclasspath="javadoc.jar"/>
</target>
<!-- (no javadoc for doclets) -->
<target name="jtreg-doclets" depends="build-doclets,-def-jtreg">
<jtreg-tool name="doclets" tests="${doclets.tests}"/>
</target>
<target name="findbugs-doclets" depends="build-doclets,-def-findbugs">
<findbugs-tool name="doclets"/>
</target>
<target name="doclets" depends="build-doclets,jtreg-doclets,findbugs-doclets"/>
<!--
**** javah targets.
-->
@ -684,7 +650,7 @@
<target name="build-bootstrap-javah" depends="build-bootstrap-javadoc">
<build-bootstrap-classes includes="${javah.includes}"/>
<build-bootstrap-jar name="javah" includes="${javah.includes}"
jarclasspath="javadoc.jar doclets.jar javac.jar"/>
jarclasspath="javadoc.jar javac.jar"/>
<build-bootstrap-tool name="javah"/>
</target>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -82,6 +82,7 @@ public class GenStubsTask extends MatchingTask {
createClasspath().setRefid(r);
}
@Override
public void setIncludes(String includes) {
super.setIncludes(includes);
this.includes = includes;
@ -103,7 +104,7 @@ public class GenStubsTask extends MatchingTask {
return;
System.out.println("Generating " + files.length + " stub files to " + destDir);
List<String> classNames = new ArrayList<String>();
List<String> classNames = new ArrayList<>();
for (String file: files) {
classNames.add(file.replaceAll(".java$", "").replace('/', '.'));
}
@ -114,7 +115,7 @@ public class GenStubsTask extends MatchingTask {
if (!ok)
throw new BuildException("genstubs failed");
} else {
List<String> cmd = new ArrayList<String>();
List<String> cmd = new ArrayList<>();
String java_home = System.getProperty("java.home");
cmd.add(new File(new File(java_home, "bin"), "java").getPath());
if (classpath != null)
@ -130,20 +131,15 @@ public class GenStubsTask extends MatchingTask {
pb.redirectErrorStream(true);
try {
Process p = pb.start();
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
try {
try (BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
String line;
while ((line = in.readLine()) != null)
System.out.println(line);
} finally {
in.close();
}
int rc = p.waitFor();
if (rc != 0)
throw new BuildException("genstubs failed");
} catch (IOException e) {
throw new BuildException("genstubs failed", e);
} catch (InterruptedException e) {
} catch (IOException | InterruptedException e) {
throw new BuildException("genstubs failed", e);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -41,11 +41,9 @@ import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import java.util.Properties;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
@ -56,6 +54,7 @@ import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
@ -101,6 +100,7 @@ public class SelectToolTask extends Task {
/**
* Set the location of the private properties file used to keep the retain
* user preferences for this repository.
* @param propertyFile the private properties file
*/
public void setPropertyFile(File propertyFile) {
this.propertyFile = propertyFile;
@ -110,6 +110,7 @@ public class SelectToolTask extends Task {
* Set the name of the property which will be set to the name of the
* selected tool, if any. If no tool is selected, the property will
* remain unset.
* @param toolProperty the tool name property
*/
public void setToolProperty(String toolProperty) {
this.toolProperty = toolProperty;
@ -118,14 +119,16 @@ public class SelectToolTask extends Task {
/**
* Set the name of the property which will be set to the execution args of the
* selected tool, if any. The args default to an empty string.
* @param argsProperty the execution args property value
*/
public void setArgsProperty(String argsProperty) {
this.argsProperty = argsProperty;
}
/**
* Set the name of the property which will be set to the execution args of the
* selected tool, if any. The args default to an empty string.
* Set the name of the property which will be used to bootstrap the
* selected tool, if any. The property will remain unset.
* @param bootstrapProperty
*/
public void setBootstrapProperty(String bootstrapProperty) {
this.bootstrapProperty = bootstrapProperty;
@ -134,6 +137,7 @@ public class SelectToolTask extends Task {
/**
* Specify whether or not to pop up a dialog if the user has not specified
* a default value for a property.
* @param askIfUnset a boolean flag indicating to prompt the user or not
*/
public void setAskIfUnset(boolean askIfUnset) {
this.askIfUnset = askIfUnset;
@ -208,10 +212,11 @@ public class SelectToolTask extends Task {
body.add(toolLabel, lc);
EnumSet<ToolChoices> toolChoices = toolProperty == null ?
EnumSet.allOf(ToolChoices.class) : EnumSet.range(ToolChoices.JAVAC, ToolChoices.JAVAP);
toolChoice = new JComboBox(toolChoices.toArray());
toolChoice = new JComboBox<>(toolChoices.toArray());
if (toolName != null)
toolChoice.setSelectedItem(ToolChoices.valueOf(toolName.toUpperCase()));
toolChoice.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
String tn = ((ToolChoices)e.getItem()).toolName;
argsField.setText(getDefaultArgsForTool(props, tn));
@ -237,8 +242,10 @@ public class SelectToolTask extends Task {
body.add(argsLabel, lc);
body.add(argsField, fc);
argsField.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
}
@Override
public void focusLost(FocusEvent e) {
String toolName = ((ToolChoices)toolChoice.getSelectedItem()).toolName;
if (toolName.length() > 0)
@ -257,6 +264,7 @@ public class SelectToolTask extends Task {
okButton = new JButton("OK");
okButton.setEnabled(toolProperty == null || (toolName != null && !toolName.equals("")));
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, p);
d.setVisible(false);
@ -326,7 +334,7 @@ public class SelectToolTask extends Task {
private File propertyFile;
// GUI components
private JComboBox toolChoice;
private JComboBox<?> toolChoice;
private JCheckBox bootstrapCheckbox;
private JTextField argsField;
private JCheckBox defaultCheck;