aboutsummaryrefslogtreecommitdiffstats
path: root/ajdoc/src
diff options
context:
space:
mode:
authoraclement <aclement>2008-11-27 22:56:23 +0000
committeraclement <aclement>2008-11-27 22:56:23 +0000
commitae5ed056a7c9424f10bf03187cfc1fb6c80db62a (patch)
tree6aca9a9e73e7652a08ff8aee83adf925bec68fb1 /ajdoc/src
parentf1f16968edf4ef8afdc36246d43697dcedfd2166 (diff)
downloadaspectj-ae5ed056a7c9424f10bf03187cfc1fb6c80db62a.tar.gz
aspectj-ae5ed056a7c9424f10bf03187cfc1fb6c80db62a.zip
256514: c1
Diffstat (limited to 'ajdoc/src')
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/Main.java52
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java7
2 files changed, 59 insertions, 0 deletions
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
index 15c4301e1..158463c0f 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
@@ -145,6 +145,8 @@ public class Main implements Config {
System.out.println("> Building signature files...");
try {
StubFileGenerator.doFiles(model, declIDTable, inputFiles, signatureFiles);
+ //Copy package.html and related files over
+ packageHTML(model, inputFiles);
} catch (DocException d) {
System.err.println(d.getMessage());
return;
@@ -162,6 +164,56 @@ public class Main implements Config {
}
}
+ /** Method to copy over any package.html files that may be part of the documentation
+ * so that javadoc generates the package-summary properly. */
+ private static void packageHTML(AsmManager model, File[] inputFiles) throws IOException {
+ ArrayList dirList = new ArrayList();
+ for(int i = 0; i < inputFiles.length; i++){
+ String packageName = StructureUtil.getPackageDeclarationFromFile(model, inputFiles[i]);
+ // Only copy the package.html file once.
+ if(dirList.contains(packageName))
+ continue;
+
+ // Check to see if there exist a package.html file for this package.
+ String dir = inputFiles[i].getAbsolutePath().substring(0, inputFiles[i].getAbsolutePath().lastIndexOf("\\"));
+ File input = new File(dir + Config.DIR_SEP_CHAR + "package.html");
+ File inDir = new File(dir+ Config.DIR_SEP_CHAR + "doc-files");
+ // If it does not exist lets go to the next package.
+ if(!input.exists()){
+ dirList.add(packageName);
+ continue;
+ }
+
+ String filename = "";
+ String docFiles = "";
+ if (packageName != null) {
+ String pathName = outputWorkingDir + '/' + packageName.replace('.', '/');
+ File packageDir = new File(pathName);
+ if (!packageDir.exists()) {
+ dirList.add(packageDir);
+ continue;
+ }
+ packageName = packageName.replace('.', '/'); // !!!
+ filename = outputWorkingDir + Config.DIR_SEP_CHAR + packageName + Config.DIR_SEP_CHAR + "package.html";
+ docFiles = rootDir.getAbsolutePath() + Config.DIR_SEP_CHAR + packageName + Config.DIR_SEP_CHAR + "doc-files";
+ } else {
+ filename = outputWorkingDir + Config.DIR_SEP_CHAR + "package.html";
+ docFiles = rootDir.getAbsolutePath() + Config.DIR_SEP_CHAR + "doc-files";
+ }
+
+
+ File output = new File(filename);
+ FileUtil.copyFile(input, output);// Copy package.html
+ // javadoc doesn't do anything with the doc-files folder so
+ // we'll just copy it directly to the document location.
+ if(!inDir.exists())
+ continue;
+ File outDir = new File(docFiles);
+ System.out.println("> Copying folder " + outDir);
+ FileUtil.copyFile(inDir, outDir);// Copy doc-files folder if it exist
+ }
+ }
+
private static AsmManager callAjc(File[] inputFiles) {
ajcOptions.addElement("-noExit");
ajcOptions.addElement("-XjavadocsInModel"); // TODO: wrong option to force model gen
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java b/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java
index e07a294bb..59e099229 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/StubFileGenerator.java
@@ -25,6 +25,7 @@ import java.util.List;
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IProgramElement;
+import org.aspectj.util.FileUtil;
/**
* @author Mik Kersten
@@ -42,6 +43,12 @@ class StubFileGenerator {
static void processFile(AsmManager model, File inputFile, File signatureFile) throws DocException {
try {
+ // Special Case for package-info.java just copy file directly.
+ if(signatureFile.getName().equals("package-info.java")) {
+ FileUtil.copyFile(inputFile, signatureFile);
+ return;
+ }
+
String path = StructureUtil.translateAjPathName(signatureFile.getCanonicalPath());
PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(path)));