Wednesday, September 24, 2008

Build some scala-swing documentation for 0.1

Beta? I don't need no stinkin' beta!

One thing about HTML documentation, I love them links. Especially the ability to navigate up and down the inheritence heirarchy. Mmm... hierarchy.

But the new scala-swing project, which looks interesting, and is included in the latest release candidate for scala, has no documentation. Ergo, I went about tweaking the src jar just to get things a goin.

First, I unjarred the scala-swing-src.jar file into the directory scala-swing-src.

Second, I changed the scala.home property to my scala distribution, which I had downloaded.

Third I added this code to the build.xml file.


<taskdef name="scaladoc"
classname="scala.tools.ant.Scaladoc">
<classpath>
<pathelement location="${scala.home}/lib/scala-compiler.jar"/>
<pathelement location="${scala.home}/lib/scala-library.jar"/>
</classpath>
</taskdef>

<property name="docs.dir" value="api" />
<property name="sources.dir" value=".." />

<target name="docs">
<mkdir dir="${docs.dir}" />
<scaladoc
srcdir="${sources.dir}"
destdir="${docs.dir}"
deprecation="yes" unchecked="yes">
<classpath>
<pathelement location="${scala.home}/lib/scala-compiler.jar"/>
<pathelement location="${scala.home}/lib/scala-library.jar"/>
</classpath>
<include name="**/*.scala" />
</scaladoc>


Third, I ran the command ant docs from the scala-swing-src/doc directory, and blammo, I've got scaladoc API.

Note: this is not a true step-by-step howto, because it's getting late. You will have to engage your brain to fill in 1-2 blank spots in the steps above.

No comments: