diff options
author | Eike Stepper | 2011-09-03 10:59:39 +0000 |
---|---|---|
committer | Eike Stepper | 2011-09-03 10:59:39 +0000 |
commit | 5ddc813be91fb426adb5ac6b5f090092ac7642e4 (patch) | |
tree | 94ed02a9e02717d3611d0d8997b29fcaa78b6521 /plugins/org.eclipse.emf.cdo.releng | |
parent | d70c57c18b2e080ca322d93b5ef04a26b9d40d6b (diff) | |
download | cdo-5ddc813be91fb426adb5ac6b5f090092ac7642e4.tar.gz cdo-5ddc813be91fb426adb5ac6b5f090092ac7642e4.tar.xz cdo-5ddc813be91fb426adb5ac6b5f090092ac7642e4.zip |
converted package.html to packe-info.java / added apiviz
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.releng')
3 files changed, 129 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.cdo.releng/javadoc/javadoc.ant b/plugins/org.eclipse.emf.cdo.releng/javadoc/javadoc.ant index 3cbd434240..f1bfbeb8c4 100644 --- a/plugins/org.eclipse.emf.cdo.releng/javadoc/javadoc.ant +++ b/plugins/org.eclipse.emf.cdo.releng/javadoc/javadoc.ant @@ -4,7 +4,7 @@ <property name="releng.project" value="plugins/org.eclipse.emf.cdo.releng" /> <target name="assemble.options"> - <java classname="org.eclipse.emf.cdo.releng.AssembleJavaDocOptions"> + <java classname="org.eclipse.emf.cdo.releng.AssembleJavaDocOptions" failonerror="true"> <classpath path="plugins/org.eclipse.emf.cdo.releng/bin" /> <classpath> <fileset dir="_target/plugins"> diff --git a/plugins/org.eclipse.emf.cdo.releng/javadoc/javadocTemplate.ant b/plugins/org.eclipse.emf.cdo.releng/javadoc/javadocTemplate.ant index 32a00c565c..058556e3bc 100644 --- a/plugins/org.eclipse.emf.cdo.releng/javadoc/javadocTemplate.ant +++ b/plugins/org.eclipse.emf.cdo.releng/javadoc/javadocTemplate.ant @@ -61,6 +61,15 @@ overview="${javadoc.project}/javadocOverview.html" bottom="<i>Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.</i>"> + <doclet name="org.jboss.apiviz.APIviz" path="${additional.jars}/APIVIZ/bin;${additional.jars}/jdepend-2.9.1.jar"> + <!-- + <param name="-sourceclasspath" value="${pathlist}>" /> + <param name="-category" value="<${category}>[:<${fillcolor}>[:<${linecolor}>]]" /> + <param name="-nopackagediagram" /> + <param name="-help" /> + --> + </doclet> + <fileset dir="plugins" defaultexcludes="yes"> <!-- SOURCE FOLDERS --> </fileset> diff --git a/plugins/org.eclipse.emf.cdo.releng/src/org/eclipse/emf/cdo/releng/AssembleJavaDocOptions.java b/plugins/org.eclipse.emf.cdo.releng/src/org/eclipse/emf/cdo/releng/AssembleJavaDocOptions.java index 2d311942d5..c562b3e7fe 100644 --- a/plugins/org.eclipse.emf.cdo.releng/src/org/eclipse/emf/cdo/releng/AssembleJavaDocOptions.java +++ b/plugins/org.eclipse.emf.cdo.releng/src/org/eclipse/emf/cdo/releng/AssembleJavaDocOptions.java @@ -36,6 +36,8 @@ import java.util.Set; import java.util.StringTokenizer;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* @author Eike Stepper
@@ -46,6 +48,11 @@ public class AssembleJavaDocOptions private static final AntLib ANTLIB = new AntLib();
+ private static final Pattern PACKAGE_INFO_PATTERN = Pattern.compile(".*<body[^>]*>\\s*(.*)\\s*<p>\\s*</body>.*",
+ Pattern.MULTILINE | Pattern.DOTALL);
+
+ private static final String NL = System.getProperty("line.separator");
+
private static File workspace;
private static File plugins;
@@ -72,14 +79,24 @@ public class AssembleJavaDocOptions }
}
- Collection<JavaDoc> values = ANTLIB.getJavaDocs();
- for (JavaDoc javaDoc : values)
+ for (JavaDoc javaDoc : ANTLIB.getJavaDocs())
{
javaDoc.generateAnt();
javaDoc.generateToc();
}
ANTLIB.generate();
+ System.out.println();
+
+ for (JavaDoc javaDoc : ANTLIB.getJavaDocs())
+ {
+ for (SourcePlugin sourcePlugin : javaDoc.getSourcePlugins())
+ {
+ sourcePlugin.convertPackageInfos();
+ }
+ }
+
+ System.out.println();
}
private static void assembleJavaDocOptions(File plugin, String javadocProject) throws IOException, BundleException
@@ -333,6 +350,12 @@ public class AssembleJavaDocOptions }
}
+ @Override
+ public String toString()
+ {
+ return projectName;
+ }
+
public File getProject()
{
return new File(plugins, projectName);
@@ -359,6 +382,94 @@ public class AssembleJavaDocOptions {
return getLabel().compareTo(o.getLabel());
}
+
+ public void convertPackageInfos() throws IOException
+ {
+ Set<String> packageNames2 = getPackageNames();
+ for (String packageName : packageNames2)
+ {
+ File packageHtml = new File(getProject(), "src/" + packageName.replace('.', '/') + "/package.html");
+ if (packageHtml.isFile())
+ {
+ convertPackageInfo(packageHtml, packageName);
+ }
+ }
+ }
+
+ private void convertPackageInfo(File packageHtml, String packageName) throws IOException
+ {
+ int length = (int)packageHtml.length();
+ char[] content = new char[length];
+
+ FileReader reader = null;
+
+ try
+ {
+ reader = new FileReader(packageHtml);
+ if (reader.read(content) != length)
+ {
+ throw new IOException("Invalid file length: " + packageHtml.getCanonicalPath());
+ }
+ }
+ finally
+ {
+ if (reader != null)
+ {
+ reader.close();
+ }
+ }
+
+ String input = new String(content);
+ Matcher matcher = PACKAGE_INFO_PATTERN.matcher(input);
+ if (!matcher.matches())
+ {
+ System.err.println("No match: " + packageHtml.getCanonicalPath());
+ return;
+ }
+
+ System.out.println("Converting " + packageHtml.getCanonicalPath());
+ String comment = matcher.group(1);
+ File packageInfo = new File(packageHtml.getParentFile(), "package-info.java");
+ FileWriter out = null;
+
+ try
+ {
+ out = new FileWriter(packageInfo);
+ BufferedWriter writer = new BufferedWriter(out);
+
+ writer.write("/*" + NL);
+ writer.write(" * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others." + NL);
+ writer.write(" * All rights reserved. This program and the accompanying materials" + NL);
+ writer.write(" * are made available under the terms of the Eclipse Public License v1.0" + NL);
+ writer.write(" * which accompanies this distribution, and is available at" + NL);
+ writer.write(" * http://www.eclipse.org/legal/epl-v10.html" + NL);
+ writer.write(" * " + NL);
+ writer.write(" * Contributors:" + NL);
+ writer.write(" * Eike Stepper - initial API and implementation" + NL);
+ writer.write(" */" + NL);
+ writer.write(NL);
+ writer.write("/**" + NL);
+
+ String[] lines = comment.split("\n");
+ for (String line : lines)
+ {
+ writer.write(" * ");
+ writer.write(line);
+ writer.write(NL);
+ }
+
+ writer.write(" */" + NL);
+ writer.write("package " + packageName + ";" + NL);
+ writer.flush();
+ }
+ finally
+ {
+ if (out != null)
+ {
+ out.close();
+ }
+ }
+ }
}
/**
@@ -383,6 +494,12 @@ public class AssembleJavaDocOptions this.projectName = projectName;
}
+ @Override
+ public String toString()
+ {
+ return projectName;
+ }
+
public File getProject()
{
return new File(plugins, projectName);
|