Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

245 lines (212 sloc) 9.576 kb
<project name="autodoc" default="all">
<description>
Generate documentation for a project and post it to the github pages for that project.
(See the properties at the top of build.xml for info on how to customize it
for different projects.)
</description>
<!-- set force to true to build and checkin even if the source hasn't changed -->
<property name="force" value="false"/>
<!-- Properties that are (potentially) redefined for each project that we document -->
<property name="work-root-dir" value="../autodoc-work-area/clojure-contrib"/>
<property name="src-dir" value="${work-root-dir}/src/"/>
<property name="output-dir" value="${work-root-dir}/autodoc/"/>
<property name="extra-doc" value="${src-dir}/doc"/>
<property name="src-files" value="."/>
<property name="ext-dir" value="templates"/> <!-- just a dummy -->
<!-- These properties are special-cased when we're documenting clojure
contrib itself -->
<!-- <property name="clojure-contrib-jar" location="${src-dir}/clojure-contrib-slim.jar"/> -->
<property name="clojure-contrib-jar" location="../clojure-contrib/clojure-contrib.jar"/>
<property name="clojure-contrib-classes" location="${src-dir}/classes"/>
<!-- Properties that define where various resources are that we need -->
<property name="clojure-jar" location="../clojure/clojure.jar"/>
<property name="enlive-src" location="../enlive/src"/>
<property name="tagsoup-jar" location="../enlive/lib/tagsoup-1.2.jar"/>
<property name="clojure-json-jar" location="../clojure/clojure-json/clojure-json.jar"/>
<property name="ant-jar" location="/usr/share/ant/lib/ant.jar"/>
<property name="ant-launcher-jar" location="/usr/share/ant/lib/ant-launcher.jar"/>
<property name="ant-nodeps-jar" location="/usr/share/ant/lib/ant-nodeps.jar"/>
<property name="doc-tmp" value="/tmp/autodoc"/>
<!-- When building doc for clojure-core we override this in params.
Otherwise, leave it be -->
<property name="built-clojure-jar" location="${clojure-jar}"/>
<!-- Tasks for running git and deciding if we have to do work -->
<target name="pull-src"
description="do a git pull origin master of the project source">
<exec executable="git" dir="${src-dir}">
<arg value="pull"/>
<arg value="origin"/>
<arg value="master"/>
</exec>
</target>
<target name="set-is-uptodate" depends="set-base-is-uptodate"
description="Set the is-uptodate property">
<condition property="is-uptodate">
<equals arg1="${base-is-uptodate}" arg2="yes"/>
</condition>
<condition property="do-build">
<or>
<equals arg1="${base-is-uptodate}" arg2="no"/>
<equals arg1="${force}" arg2="true"/>
</or>
</condition>
<echo message="up-to-date?: ${base-is-uptodate}"/>
<echo message="force?: ${force}"/>
</target>
<target name="set-base-is-uptodate"
description="run the external program and get back a yes or no">
<exec executable="sh" outputproperty="base-is-uptodate">
<arg value="./is-uptodate.sh"/>
<arg value="${src-dir}"/>
</exec>
</target>
<target name="update-last-commit"
description="update the last version that we ran autodoc on">
<exec executable="sh">
<arg value="./update-last.sh"/>
<arg value="${src-dir}"/>
</exec>
</target>
<target name="set-commit-hash" description="Set the current commit hash!">
<exec executable="git" dir="${src-dir}" outputproperty="commit-hash">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
</target>
<target name="set-commit-comment" depends="set-commit-hash,set-is-uptodate"
description="Create an appropriate commit comment for the HTML page checkin">
<condition property="commit-comment"
value="Updated documentation for commit ${commit-hash}"
else="Manual (forced) documentation build for commit ${commit-hash}">
<equals arg1="${base-is-uptodate}" arg2="no"/>
</condition>
</target>
<target name="stage-new-api-files" description="Stage files for new namespaces">
<exec executable="git" dir="${output-dir}">
<arg value="add"/>
<arg value="*-api.html"/>
</exec>
</target>
<target name="stage-new-doc-files"
description="Stage new files added to the extra doc directory">
<exec executable="git" dir="${output-dir}">
<arg value="add"/>
<arg value="doc/*"/>
</exec>
</target>
<target name="commit-html" depends="set-commit-comment,stage-new-doc-files,stage-new-api-files"
description="Commit the rebuild HTML back to github">
<exec executable="git" dir="${output-dir}">
<arg value="commit"/>
<arg value="-a"/>
<arg value="-m${commit-comment}"/>
</exec>
<exec executable="git" dir="${output-dir}">
<arg value="push"/>
<arg value="origin"/>
<arg value="gh-pages"/>
</exec>
</target>
<target name="build-src"
description="Build the project src files, using the per-project build file">
<ant dir="${param-dir}" inheritAll="true"/>
</target>
<!-- Build the documentation stored in the extra doc directory -->
<target name="clean-doc"
description="Delete existing doc files">
<delete dir="${output-dir}/doc"/>
<delete dir="${doc-tmp}/doc"/>
</target>
<target name="set-has-doc" description="Set the has-doc variable if we have extra doc for this project">
<available property="has-doc" file="${extra-doc}"/>
</target>
<target name="make-doc-directories"
description="Make the output directories for doc files pulled from the source area"
if="has-doc">
<!-- first make the temporary directory tree -->
<apply executable="mkdir" verbose="true" force="true" addsourcefile="false"
dest="${doc-tmp}/doc">
<fileset dir="${extra-doc}"/>
<mapper type="regexp" from="(.*)/[^/]+" to="\1"/>
<arg value="-p"/>
<targetfile/>
</apply>
<!-- now make the eventual targets in the output area -->
<apply executable="mkdir" verbose="true" force="true" addsourcefile="false"
dest="${output-dir}/doc">
<fileset dir="${extra-doc}"/>
<mapper type="regexp" from="(.*)/[^/]+" to="\1"/>
<arg value="-p"/>
<targetfile/>
</apply>
</target>
<target name="build-markdown"
description="Convert additional markdown files to HTML in the dest directory."
if="has-doc">
<apply executable="markdown" verbose="true" force="true">
<fileset dir="${extra-doc}/" includes="**/*.markdown"/>
<redirector>
<outputmapper type="glob" from="*.markdown" to="${doc-tmp}/doc/*.html"/>
</redirector>
</apply>
</target>
<target name="build-extra-doc"
depends="set-has-doc,clean-doc,make-doc-directories,build-markdown"
description="Build the additional documentation that is in extra doc directories"/>
<!-- build the html documentation itself -->
<target name="clean-html-dir"
description="Delete old API files before creating new ones">
<delete>
<fileset dir="${output-dir}" includes="*-api.html"/>
</delete>
</target>
<target name="build-html" depends="set-commit-hash,clean-html-dir,build-extra-doc"
description="Build the HTML documentation and check it in">
<echo message="param-dir ${param-dir}"/>
<echo message="src-files ${src-files}"/>
<java classname="clojure.main"
fork="true" failonerror="true">
<classpath>
<pathelement location="${built-clojure-jar}"/>
<pathelement location="${clojure-contrib-jar}"/>
<pathelement location="${clojure-contrib-classes}"/>
<pathelement location="${enlive-src}"/>
<pathelement location="${tagsoup-jar}"/>
<pathelement location="${clojure-json-jar}"/>
<pathelement location="${src-files}"/>
<pathelement location="."/>
<fileset dir="${ext-dir}">
<include name="**/*.jar"/>
</fileset>
</classpath>
<arg value="-e"/>
<arg value="(use 'com.infolace.gen-docs.gen-docs) (gen-docs &quot;${param-dir}&quot;)"/>
</java>
</target>
<!-- roll-up targets -->
<target name="commit-result" depends="set-commit-comment,commit-html,update-last-commit"/>
<target name="do-build"
depends="build-src,build-html"
description="once everything is up-to-date, build the source, build the html, then commit the new documentation"/>
<target name="main-build" depends="pull-src, set-is-uptodate"
if="do-build"
description="Update the html on github based on the latest source, if appropriate">
<antcall target="do-build"/>
</target>
<target name="all">
<property name="build-target" value="main-build"/>
<antcall target="ant-wrapper"/>
</target>
<target name="ant-wrapper"
description="do a pass-through to clojure so that it can set various project-specific params">
<java classname="clojure.main"
classpath="${clojure-jar}:../clojure-contrib/clojure-contrib.jar:${clojure-contrib-classes}:${ant-jar}:${ant-launcher-jar}:/usr/lib/jvm/java-6-sun-1.6.0.07/lib/tools.jar:${ant-nodeps-jar}:."
fork="true" failonerror="true">
<arg value="-e"/>
<arg value="(use 'com.infolace.gen-docs.ant-wrapper) (ant-wrapper &quot;${param-dir}&quot; &quot;${build-target}&quot; ${force})"/>
</java>
</target>
<!--
Testing targets - should be deleted later
-->
</project>
Jump to Line
Something went wrong with that request. Please try again.