本文整理汇总了Java中com.sun.tools.javadoc.Main.execute方法的典型用法代码示例。如果您正苦于以下问题:Java Main.execute方法的具体用法?Java Main.execute怎么用?Java Main.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javadoc.Main
的用法示例。
在下文中一共展示了Main.execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doRunTest
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
void doRunTest(int expectedResult, Predicate<String> validate, String... args) {
System.err.println("running with args: " + Arrays.asList(args));
List<String> options = new ArrayList<>();
options.addAll(Arrays.asList(args));
options.add("-XDrawDiagnostics");
options.add(System.getProperty("test.src", ".") + java.io.File.separatorChar + "ReleaseOptionSource.java");
StringWriter out = new StringWriter();
PrintWriter pw = new PrintWriter(out);
int actualResult = Main.execute("javadoc", pw, pw, pw, "com.sun.tools.doclets.formats.html.HtmlDoclet", options.toArray(new String[0]));
System.err.println("actual result=" + actualResult);
System.err.println("actual output=" + out.toString());
if (actualResult != expectedResult)
throw new Error();
if (!validate.test(out.toString())) {
throw new Error("Not an expected error output: " + out.toString());
}
}
示例2: doRunTest
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
void doRunTest(int expectedResult, Predicate<String> validate, String... args) {
System.err.println("running with args: " + Arrays.asList(args));
List<String> options = new ArrayList<>();
options.addAll(Arrays.asList(args));
options.add("-XDrawDiagnostics");
options.add(new File(System.getProperty("test.src", "."), "ReleaseOptionSource.java").getPath());
StringWriter out = new StringWriter();
PrintWriter pw = new PrintWriter(out);
int actualResult = Main.execute("javadoc", pw, pw, pw, "com.sun.tools.doclets.standard.Standard", options.toArray(new String[0]));
System.err.println("actual result=" + actualResult);
System.err.println("actual output=" + out.toString());
if (actualResult != expectedResult)
throw new Error("Exit code not as expected");
if (!validate.test(out.toString())) {
throw new Error("Output not as expected");
}
}
示例3: main
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
File outputFile = new File(args[0]);
WRITER = new BufferedWriter(new FileWriter(outputFile), 10000);
WRITER.write("digraph G {\n");
Main.execute("JavadocIndexer", "com.solrstart.javadoc.dependencies.Analyzer", new String[]{
"-sourcepath",
"/Volumes/RAMDisk/source-solr-4.7.0/lucene/analysis/common/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/analysis/icu/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/analysis/kuromoji/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/analysis/morfologik/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/analysis/phonetic/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/analysis/smartcn/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/analysis/stempel/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/analysis/uima/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/codecs/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/core/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/expressions/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/grouping/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/highlighter/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/join/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/memory/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/misc/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/queries/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/queryparser/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/spatial/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/suggest/src/java:/Volumes/RAMDisk/source-solr-4.7.0/solr/contrib/analysis-extras/src/java:/Volumes/RAMDisk/source-solr-4.7.0/solr/contrib/clustering/src/java:/Volumes/RAMDisk/source-solr-4.7.0/solr/contrib/dataimporthandler-extras/src/java:/Volumes/RAMDisk/source-solr-4.7.0/solr/contrib/dataimporthandler/src/java:/Volumes/RAMDisk/source-solr-4.7.0/solr/contrib/extraction/src/java:/Volumes/RAMDisk/source-solr-4.7.0/solr/contrib/langid/src/java:/Volumes/RAMDisk/source-solr-4.7.0/solr/contrib/map-reduce/src/java:/Volumes/RAMDisk/source-solr-4.7.0/solr/contrib/morphlines-cell/src/java:/Volumes/RAMDisk/source-solr-4.7.0/solr/contrib/morphlines-core/src/java:/Volumes/RAMDisk/source-solr-4.7.0/solr/contrib/uima/src/java:/Volumes/RAMDisk/source-solr-4.7.0/solr/contrib/velocity/src/java:/Volumes/RAMDisk/source-solr-4.7.0/solr/core/src/java:/Volumes/RAMDisk/source-solr-4.7.0/solr/solrj/src/java",
// "/Volumes/RAMDisk/source-solr-4.7.0/solr/core/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/core/src/java",
// "/Volumes/RAMDisk/source-solr-4.7.0/solr/core/src/java",
"-subpackages",
"org.apache"
// org.tartarus.snowball:org.apache.lucene:org.apache.solr:org.egothor.stemmer
});
WRITER.write("}\n");
WRITER.close();
//Then run graphviz:
// dot -Tsvg -O -Grankdir=LR dependencies.dot
}
示例4: generateJavadoc
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
/**
* Generate Javadoc and return associated Doclet ID.
* This method is synchronized.
*
* @param programName Name of the program (for error messages).
* @param errWriter PrintWriter to receive error messages.
* @param warnWriter PrintWriter to receive warning messages.
* @param noticeWriter PrintWriter to receive notice messages.
* @param args The command line parameters.
* @return an unique doclet ID which represent the subsequent Main#execute() run.
* @throws IllegalStateException if the generated doclet ID is already used. Try again.
* @throws IllegalArgumentException if Javadoc fails to generate docs.
*/
public static synchronized long generateJavadoc(String programName,
PrintWriter errWriter,
PrintWriter warnWriter,
PrintWriter noticeWriter,
String[] args)
{
if (_docInfo.containsKey(_id))
{
throw new IllegalStateException("Doclet information with ID " + _id + " already exists");
}
final int javadocRetCode = Main.execute(programName, errWriter, warnWriter, noticeWriter, Rest4JDoclet.class.getName(), args);
if (javadocRetCode != 0)
{
throw new IllegalArgumentException("Javadoc failed with return code " + javadocRetCode);
}
final long currentId = _id;
++_id;
return currentId;
}
示例5: main
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
String[] templateParts = template.split("#");
int sources = templateParts.length / 2;
for (int source = 0; source < sources; source++) {
StringBuilder testSource = new StringBuilder();
for (int i = 0; i < templateParts.length; i += 2) {
testSource.append(templateParts[i]);
if (i == 2 * source) {
testSource.append(templateParts[i + 1]);
}
}
test = 0;
testsDone = false;
while (!testsDone) {
ToolBox tb = new ToolBox();
new JavacTask(tb)
.sources(testSource.toString(),
"public class CompletionErrorMissing {}",
"public interface CompletionErrorIntfMissing {}",
"public class CompletionErrorExcMissing extends Exception {}")
.outdir(".")
.run()
.writeAll();
tb.deleteFiles("CompletionErrorMissing.class", "CompletionErrorIntfMissing.class", "CompletionErrorExcMissing.class");
// run javadoc:
if (Main.execute("javadoc", "CompletionError", CompletionError.class.getClassLoader(),
"-classpath", "." + File.pathSeparator + testClassPath,
new File(testSrc, "CompletionError.java").getPath()) != 0)
throw new Error();
}
}
}
示例6: doTest
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
static void doTest() {
ByteArrayOutputStream redirectedOutput = new ByteArrayOutputStream();
PrintStream originalOutput = System.out;
// redirect System.out to a buffer
System.setOut(new PrintStream(redirectedOutput));
PrintWriter sink = new PrintWriter(new ByteArrayOutputStream());
// execute javadoc
int result = Main.execute("javadoc", sink, sink, sink,
"com.sun.tools.doclets.standard.Standard",
new String[] {"p"}
);
// test whether javadoc did any output to System.out
if (redirectedOutput.toByteArray().length > 0) {
originalOutput.println("Test failed; here's what javadoc wrote on its standard output:");
originalOutput.println(redirectedOutput.toString());
throw new Error("javadoc output wasn\'t properly redirected");
} else if (result != 0) {
throw new Error("javadoc run failed");
} else {
originalOutput.println("OK, good");
}
}
示例7: main
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
String[] templateParts = template.split("#");
int sources = templateParts.length / 2;
for (int source = 0; source < sources; source++) {
StringBuilder testSource = new StringBuilder();
for (int i = 0; i < templateParts.length; i += 2) {
testSource.append(templateParts[i]);
if (i == 2 * source) {
testSource.append(templateParts[i + 1]);
}
}
test = 0;
testsDone = false;
while (!testsDone) {
ToolBox tb = new ToolBox();
new JavacTask(tb)
.sources(testSource.toString(),
"public class CompletionErrorMissing {}",
"public interface CompletionErrorIntfMissing {}",
"public class CompletionErrorExcMissing extends Exception {}")
.outdir(".")
.run()
.writeAll();
tb.deleteFiles("CompletionErrorMissing.class", "CompletionErrorIntfMissing.class", "CompletionErrorExcMissing.class");
// run javadoc:
if (Main.execute("javadoc", "CompletionError", CompletionError.class.getClassLoader(),
"-classpath", ".",
System.getProperty("test.src", ".") + File.separatorChar + "CompletionError.java") != 0)
throw new Error();
}
}
}
示例8: main
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
String[] templateParts = template.split("#");
int sources = templateParts.length / 2;
for (int source = 0; source < sources; source++) {
StringBuilder testSource = new StringBuilder();
for (int i = 0; i < templateParts.length; i += 2) {
testSource.append(templateParts[i]);
if (i == 2 * source) {
testSource.append(templateParts[i + 1]);
}
}
test = 0;
testsDone = false;
while (!testsDone) {
List<JavaSource> fileObjects =
Arrays.asList(new JavaSource("CompletionErrorAuxiliary", testSource.toString()),
new JavaSource("CompletionErrorMissing", "public class CompletionErrorMissing {}"),
new JavaSource("CompletionErrorIntfMissing", "public interface CompletionErrorIntfMissing {}"),
new JavaSource("CompletionErrorExcMissing", "public class CompletionErrorExcMissing extends Exception {}"));
Boolean result = compiler.getTask(null, null, null, Arrays.asList("-d", "."), null, fileObjects).call();
if (!result)
throw new Error();
for (String delete : new String[] {"CompletionErrorMissing.class", "CompletionErrorIntfMissing.class", "CompletionErrorExcMissing.class"}) {
Files.delete(Paths.get(delete));
}
// run javadoc:
if (Main.execute("javadoc", "CompletionError", CompletionError.class.getClassLoader(),
"-classpath", ".",
System.getProperty("test.src", ".") + File.separatorChar + "CompletionError.java") != 0)
throw new Error();
}
}
}
示例9: main
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
/***
* This is a doclet driver that triggers Javadoc repeatedly with passed-in parameters
* @param args - comes in groups of three: module sourcepath subpackages.
* sourcepath and subpackages both accept the list separated by colons (':')
*/
public static void main(String[] args) throws IOException, SolrServerException {
SOLR_SERVER = new HttpSolrServer( "http://localhost:8983/solr/JavadocCollection");
if (args.length % 3 != 1){
System.err.println("We are expecting parameters start from solr version label and then in groups of 3: module sourcepath subpackages");
}
API_VERSION = args[0]; //should be 4.8 or 4.7.1 or similar
SOLR_SERVER.deleteByQuery("apiVersion:" + API_VERSION); //we trust this parameter not to be a hack...
SOLR_SERVER.commit();
for(int offset = 1; offset<args.length; offset+=3){
MODULE = args[offset]; //set for global access
String sourcepath = args[offset+1];
String subpackages = args[offset+2];
Main.execute("JavadocIndexer", "com.solrstart.javadoc.indexer.Index", new String[]{
"-sourcepath", sourcepath,
"-subpackages", subpackages
});
}
// Main.execute("JavadocIndexer", "com.solrstart.javadoc.indexer.Index", new String[]{
// "-sourcepath",
// "/Volumes/RAMDisk/source-solr-4.7.0/solr/core/src/java:/Volumes/RAMDisk/source-solr-4.7.0/lucene/core/src/java",
// "-subpackages",
// "org.apache.solr"
// });
SOLR_SERVER.shutdown(); //just easier that tryin
}
示例10: runJavaDoclet
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
private List<StepImplementationsDescriptor> runJavaDoclet(final String classToDocument) {
final List<StepImplementationsDescriptor> classStepTagList = new ArrayList<StepImplementationsDescriptor>();
project.getBasedir();
String sourceRoot = null;
// what's the path to this class ?
String path = resolveClassToPath(classToDocument, project.getBuild().getSourceDirectory());
if (path != null) {
// file is in the source path
sourceRoot = project.getBuild().getSourceDirectory();
} else {
path = resolveClassToPath(classToDocument, project.getBuild().getTestSourceDirectory());
if (path != null) {
// file is in the test tree
sourceRoot = project.getBuild().getTestSourceDirectory();
}
}
if (sourceRoot == null || path == null) {
log.error("unabled to locate source file");
// TODO exception ?
} else {
CustomDoclet.setExpressionList(classStepTagList);
final String[] args = {"-doclet", "com.technophobia.substeps.glossary.CustomDoclet",
"-sourcepath", sourceRoot,
path
};
// the custom doclet generates quite a lot of noise around things missing from the classpath etc -
// not important in this context, so consume and discard apart from the errors..
StringWriter esw = new StringWriter();
PrintWriter err = new PrintWriter(esw);
StringWriter wsw = new StringWriter();
PrintWriter warn = new PrintWriter(wsw);
StringWriter nsw = new StringWriter();
PrintWriter notice = new PrintWriter(nsw);
String warnings = esw.toString();
if (!warnings.isEmpty()) {
getLog().warn("Substeps CustomDoclet warnings:\n" + warnings);
}
Main.execute("SubstepsDoclet", err, warn, notice, "com.technophobia.substeps.glossary.CustomDoclet", args);
}
return classStepTagList;
}
示例11: main
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
public static void main(String[] args) throws FileNotFoundException {
String name = FilterDoclet.class.getName();
Main.execute(name, args);
}
示例12: main
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
public static void main(String[] args) {
String name = JavadocFilter.class.getName();
Main.execute(name, name, args);
}
示例13: main
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
public static void main(String[] args)
{
String name = ExcludeDoclet.class.getName();
Main.execute(name, name, args);
}
示例14: main
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
public static void main (String[] args) {
String name = PublicApiDoclet.class.getName();
Main.execute(name, name, args);
}
示例15: main
import com.sun.tools.javadoc.Main; //导入方法依赖的package包/类
public static void main(String[] args) {
Main.execute(new String[]{"-doclet", "org.kuali.rice.krad.demo.uif.library.tools.KRADLibraryPropertiesDoclet",
"-sourcepath", "C:/Java/Projects/Rice/Trunk/krad/krad-web-framework/src/main/java", "-subpackages",
"org.kuali.rice.krad.uif:org.kuali.rice.krad.datadictionary.validation.constraint"});
}