Skip to content

Commit

Permalink
Integrate numbering images and headers in the dist targets. Refactor …
Browse files Browse the repository at this point in the history
…code buildfile.
  • Loading branch information
Jim Hinkey committed Apr 12, 2012
1 parent 53d8715 commit 3210836
Show file tree
Hide file tree
Showing 7 changed files with 415 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,5 +1,6 @@
*~
*.bak
*.class
*.iml
*.swp
*-tmp.html
Expand All @@ -14,6 +15,7 @@ nbbuild.xml
/build.*.properties

**/build/**
**/classes/**
**/dist/**
**nbproject**
*#
55 changes: 53 additions & 2 deletions build-common.xml
Expand Up @@ -14,6 +14,17 @@ directory to convert the userGuide into complete English markdown, html, odt, an
-->

<project name="Markdown Document Conversion" default="echo-props" basedir=".">
<property name="project.dir" value=".." />

<path id="lib.classpath">
<fileset dir="${basedir}/lib" includes="*.jar" />
<fileset dir="${basedir}/code/liferay-doc-utils/lib" includes="*.jar" />
</path>

<path id="project.classpath">
<pathelement path="${classpath}" />
<path refid="lib.classpath" />
</path>

<property environment="env" />

Expand All @@ -31,6 +42,32 @@ directory to convert the userGuide into complete English markdown, html, odt, an

<property name="pandoc.app" location="/home/${user.name}/.cabal/bin/pandoc"/>

<!-- taskdefs -->

<taskdef name="numberheaders" classname="com.liferay.documentation.util.NumberHeadersTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->

<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>

<taskdef name="numberimages" classname="com.liferay.documentation.util.NumberImagesTask">
<classpath>
<fileset dir="${project.dir}/lib" includes="*.jar" />
<!-- Use below instead of above fileset when testing changes to classes
<pathelement path="${project.dir}/code/liferay-doc-utils/classes"/>
-->

<fileset dir="${project.dir}/code/liferay-doc-utils/lib" includes="*.jar" />
</classpath>
</taskdef>

<!-- targets -->

<target name="display-pandoc-version">
<exec executable="${pandoc.app}">
<arg value="-v" />
Expand Down Expand Up @@ -66,7 +103,11 @@ directory to convert the userGuide into complete English markdown, html, odt, an
</copy>
</target>

<target name="prepare-dist" description="creates dist directory copying images and overriding with language specific images">
<target name="prepare-dist" depends="number-images-dir" description="numbers the images in the files, creates dist directory, copies images and overriding with language specific images">
<!-- Replace the above the dependencies with below when liferay portal
supports urlTitle assignement.
depends="number-headers-dir, number-images-dir"
-->
<echo message="... creating ${dist.dir}/${lang} directory"/>
<mkdir dir="${dist.dir}/${lang}"/>
<copy todir="${dist.dir}/${lang}/images">
Expand Down Expand Up @@ -242,7 +283,17 @@ directory to convert the userGuide into complete English markdown, html, odt, an
<target name="markdown-to-all" depends="markdown-to-html,markdown-to-odt,markdown-to-epub" description="converts markdown file to html, odt, and epub files" />

<target name="markdown-to-all-win" depends="markdown-to-html-win,markdown-to-odt-win,markdown-to-epub-win" description="converts markdown file to html, odt, and epub files on windows" />


<target name="number-headers-dir" description="numbers the headers of markdown files found in ${lang}/chapters/">
<numberheaders lang="${lang}" docDir="${doc.dir}">
</numberheaders>
</target>

<target name="number-images-dir" description="numbers the images of markdown files found in ${lang}/chapters/">
<numberimages lang="${lang}" docDir="${doc.dir}">
</numberimages>
</target>

<target name="copy-single-chapter" depends="prepare" description="copies chapter to be converted">
<echo message="... copying ${chapter}"/>
<copy file="./en/chapters/${chapter}.markdown" todir="./${build.dir}/${lang}"/>
Expand Down
60 changes: 55 additions & 5 deletions code/liferay-doc-utils/build.xml
@@ -1,13 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create_run_jar" name="Create Runnable Jar for Project liferay-doc-utils">
<target name="create_run_jar">
<jar destfile="./dist/liferay-doc-utils.jar" filesetmanifest="mergewithoutmain">
<project default="dist">
<property name="project.dir" value="." />

<property name="build.dir" value="${project.dir}/classes" />
<property name="dist.dir" value="${project.dir}/dist" />
<property name="lib.dir" value="${project.dir}/lib" />
<property name="src.dir" value="${project.dir}/src" />

<path id="lib.classpath">
<fileset dir="${lib.dir}" includes="*.jar" />
</path>

<path id="project.classpath">
<pathelement path="${classpath}" />
<path refid="lib.classpath" />
</path>

<!-- targets -->

<target name="clean" description="cleans up" >
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>

<target name="compile" description="compiles the code">
<mkdir dir="${build.dir}" />

<antcall target="compile-java">
<param name="javac.classpathref" value="project.classpath" />
<param name="javac.destdir" value="${build.dir}" />
<param name="javac.srcdir" value="${src.dir}" />
</antcall>
</target>

<target name="compile-java">
<copy todir="${javac.destdir}">
<fileset dir="${javac.srcdir}" excludes="**/*.java" />
</copy>

<javac
classpathref="${javac.classpathref}"
destdir="${javac.destdir}"
includeAntRuntime="false"
srcdir="${javac.srcdir}"
/>
</target>

<target name="dist" depends="compile"
description="compiles the code and creates a runnable JAR file for the project">
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/liferay-doc-utils.jar"
filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="com.liferay.documentation.util.DocUtils"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="./bin"/>
<zipfileset excludes="META-INF/*.SF" src="./lib/commons-io-2.0.1.jar"/>
<fileset dir="${build.dir}"/>
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/commons-io-2.0.1.jar"/>
</jar>
</target>

</project>
Binary file added code/liferay-doc-utils/lib/ant-1-8-2.jar
Binary file not shown.

0 comments on commit 3210836

Please sign in to comment.