use of org.codehaus.groovy.tools.groovydoc.ClasspathResourceManager in project groovy by apache.
the class Groovydoc method execute.
public void execute() throws BuildException {
List<String> packagesToDoc = new ArrayList<String>();
Path sourceDirs = new Path(getProject());
Properties properties = new Properties();
properties.setProperty("windowTitle", windowTitle);
properties.setProperty("docTitle", docTitle);
properties.setProperty("footer", footer);
properties.setProperty("header", header);
checkScopeProperties(properties);
properties.setProperty("publicScope", publicScope.toString());
properties.setProperty("protectedScope", protectedScope.toString());
properties.setProperty("packageScope", packageScope.toString());
properties.setProperty("privateScope", privateScope.toString());
properties.setProperty("author", author.toString());
properties.setProperty("processScripts", processScripts.toString());
properties.setProperty("includeMainForScripts", includeMainForScripts.toString());
properties.setProperty("overviewFile", overviewFile != null ? overviewFile.getAbsolutePath() : "");
properties.setProperty("charset", charset != null ? charset : "");
properties.setProperty("fileEncoding", fileEncoding != null ? fileEncoding : "");
properties.setProperty("timestamp", Boolean.valueOf(!noTimestamp).toString());
properties.setProperty("versionStamp", Boolean.valueOf(!noVersionStamp).toString());
if (sourcePath != null) {
sourceDirs.addExisting(sourcePath);
}
parsePackages(packagesToDoc, sourceDirs);
GroovyDocTool htmlTool = new GroovyDocTool(// we're gonna get the default templates out of the dist jar file
new ClasspathResourceManager(), sourcePath.list(), getDocTemplates(), getPackageTemplates(), getClassTemplates(), links, properties);
try {
htmlTool.add(sourceFilesToDoc);
FileOutputTool output = new FileOutputTool();
// TODO push destDir through APIs?
htmlTool.renderToOutput(output, destDir.getCanonicalPath());
} catch (Exception e) {
e.printStackTrace();
}
// try to override the default stylesheet with custom specified one if needed
if (styleSheetFile != null) {
try {
String css = ResourceGroovyMethods.getText(styleSheetFile);
File outfile = new File(destDir, "stylesheet.css");
ResourceGroovyMethods.setText(outfile, css);
} catch (IOException e) {
System.out.println("Warning: Unable to copy specified stylesheet '" + styleSheetFile.getAbsolutePath() + "'. Using default stylesheet instead. Due to: " + e.getMessage());
}
}
}
use of org.codehaus.groovy.tools.groovydoc.ClasspathResourceManager in project groovy-core by groovy.
the class Groovydoc method execute.
public void execute() throws BuildException {
List<String> packagesToDoc = new ArrayList<String>();
Path sourceDirs = new Path(getProject());
Properties properties = new Properties();
properties.setProperty("windowTitle", windowTitle);
properties.setProperty("docTitle", docTitle);
properties.setProperty("footer", footer);
properties.setProperty("header", header);
checkScopeProperties(properties);
properties.setProperty("publicScope", publicScope.toString());
properties.setProperty("protectedScope", protectedScope.toString());
properties.setProperty("packageScope", packageScope.toString());
properties.setProperty("privateScope", privateScope.toString());
properties.setProperty("author", author.toString());
properties.setProperty("processScripts", processScripts.toString());
properties.setProperty("includeMainForScripts", includeMainForScripts.toString());
properties.setProperty("overviewFile", overviewFile != null ? overviewFile.getAbsolutePath() : "");
properties.setProperty("charset", charset != null ? charset : "");
properties.setProperty("fileEncoding", fileEncoding != null ? fileEncoding : "");
if (sourcePath != null) {
sourceDirs.addExisting(sourcePath);
}
parsePackages(packagesToDoc, sourceDirs);
GroovyDocTool htmlTool = new GroovyDocTool(// we're gonna get the default templates out of the dist jar file
new ClasspathResourceManager(), sourcePath.list(), getDocTemplates(), getPackageTemplates(), getClassTemplates(), links, properties);
try {
htmlTool.add(sourceFilesToDoc);
FileOutputTool output = new FileOutputTool();
// TODO push destDir through APIs?
htmlTool.renderToOutput(output, destDir.getCanonicalPath());
} catch (Exception e) {
e.printStackTrace();
}
// try to override the default stylesheet with custom specified one if needed
if (styleSheetFile != null) {
try {
String css = ResourceGroovyMethods.getText(styleSheetFile);
File outfile = new File(destDir, "stylesheet.css");
ResourceGroovyMethods.setText(outfile, css);
} catch (IOException e) {
System.out.println("Warning: Unable to copy specified stylesheet '" + styleSheetFile.getAbsolutePath() + "'. Using default stylesheet instead. Due to: " + e.getMessage());
}
}
}
Aggregations