You are viewing a plain text version of this content. The canonical link for it is here.
Posted to zeta-commits@incubator.apache.org by je...@apache.org on 2011/04/11 19:28:59 UTC

[zeta-commits] svn commit: r1091177 - in /incubator/zetacomponents/website: ant/ ant/ivy/ ant/ivy/ivy.xml ant/zetacomponents.properties build.xml

Author: jeromer
Date: Mon Apr 11 19:28:58 2011
New Revision: 1091177

URL: http://svn.apache.org/viewvc?rev=1091177&view=rev
Log:
- Started to migrate the Makefil to Ant
# Nothing is stable yet
# This is still under heavy development !

Added:
    incubator/zetacomponents/website/ant/
    incubator/zetacomponents/website/ant/ivy/
    incubator/zetacomponents/website/ant/ivy/ivy.xml
    incubator/zetacomponents/website/ant/zetacomponents.properties
    incubator/zetacomponents/website/build.xml

Added: incubator/zetacomponents/website/ant/ivy/ivy.xml
URL: http://svn.apache.org/viewvc/incubator/zetacomponents/website/ant/ivy/ivy.xml?rev=1091177&view=auto
==============================================================================
--- incubator/zetacomponents/website/ant/ivy/ivy.xml (added)
+++ incubator/zetacomponents/website/ant/ivy/ivy.xml Mon Apr 11 19:28:58 2011
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ivy-module version="2.0">
+    <info organisation="Ant Contrib" module="build-dependencies"/>
+    <dependencies>
+        <dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" transitive="false"/>
+    </dependencies>
+</ivy-module>
\ No newline at end of file

Added: incubator/zetacomponents/website/ant/zetacomponents.properties
URL: http://svn.apache.org/viewvc/incubator/zetacomponents/website/ant/zetacomponents.properties?rev=1091177&view=auto
==============================================================================
--- incubator/zetacomponents/website/ant/zetacomponents.properties (added)
+++ incubator/zetacomponents/website/ant/zetacomponents.properties Mon Apr 11 19:28:58 2011
@@ -0,0 +1,11 @@
+# user.dir is native properties
+# ant -diagnostics | grep user.dir
+
+zeta.base=${user.dir}/../trunk
+build.dir=${user.dir}/build
+
+wcv.svn.repository=svn://web-content-viewer.org/wcv/trunk
+wcv.paths=classes scripts templates
+wcv.zeta.components=Base Configuration ConsoleTools Database Feed Mail Template
+
+build.name=trunk
\ No newline at end of file

Added: incubator/zetacomponents/website/build.xml
URL: http://svn.apache.org/viewvc/incubator/zetacomponents/website/build.xml?rev=1091177&view=auto
==============================================================================
--- incubator/zetacomponents/website/build.xml (added)
+++ incubator/zetacomponents/website/build.xml Mon Apr 11 19:28:58 2011
@@ -0,0 +1,483 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<project xmlns:ivy="antlib:org.apache.ivy.ant" name="Apache Zeta Components master builder" default="help">
+
+    <description>Apache Zeta Components build file</description>
+
+    <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
+    <!-- for some reason I have to force the For task -->
+    <taskdef classname="net.sf.antcontrib.logic.ForTask" name="for">
+        <classpath>
+            <pathelement location="lib/ant-contrib-1.0b3.jar"/>
+        </classpath>
+    </taskdef>
+
+    <property file="./ant/zetacomponents.properties"/>
+
+    <!-- Default target, show the help message -->
+    <target name="help" description="Shows this help">
+        <echo message="Please run : ant -p to learn more about available targets"/>
+    </target>
+
+    <!-- Shows available properties for this build file -->
+    <target name="show-properties" description="Shows the properties for this build file">
+        <echo message="user.dir            : ${user.dir}"/>
+        <echo message="build.dir           : ${build.dir}"/>
+        <echo message="wcv.paths           : ${wcv.paths}"/>
+        <echo message="wcv.zeta.components : ${wcv.zeta.components}"/>
+        <echo message="build.name          : ${build.name}"/>
+    </target>
+
+    <!-- Creates the build dir -->
+    <target name="init" description="Creates build dir">
+        <mkdir dir="${build.dir}"/>
+    </target>
+
+    <!-- Checks out the required external bits required to re-build the website.       -->
+    <!-- If a valid copy of Zeta Components is specified in the zeta.base property     -->
+    <!-- variable those libraries are used from there. They are checkout out otherwise -->
+    <target name="checkout-wcv" description="Checks out the required external bits required to re-build the website.">
+        <foreach list="${wcv.paths}"
+                 delimiter=" "
+                 target="-checkout-wcv-path"
+                 param="wcv.dir"/>
+
+        <foreach list="${wcv.zeta.components}"
+                 delimiter=" "
+                 target="-checkout-zeta-component"
+                 param="wcv.zeta.component"/>
+    </target>
+
+    <target name="phpdoc" depends="init" description="Builds the API documentation">
+        <echo message="${build.name}"/>
+
+        <exec executable="which" outputproperty="phpdoc.path">
+            <arg value="phpdoc"/>
+        </exec>
+
+        <exec executable="php">
+            <arg value="-d"/>
+            <arg value="memory_limit=2500M"/>
+            <arg value="${phpdoc.path}"/>
+            <arg value="--directory"/>
+            <arg value="${zeta.base}"/>
+            <arg value="--templatebase"/>
+            <arg value="phpdoc/"/>
+            <arg value="--target"/>
+            <arg value="${build.dir}/phpdoc/${build.name}/phpdoc"/>
+            <arg value="--ignore"/>
+            <arg value="autoload/,*autoload.php,tests/,docs/,design/"/>
+            <arg value="--hidden"/>
+            <arg value="false"/>
+            <arg value="--undocumentedelements"/>
+            <arg value="off"/>
+            <arg value="--title"/>
+            <arg value="Apache Zeta Components Manual"/>
+            <arg value="--parseprivate"/>
+            <arg value="off"/>
+            <arg value="--defaultpackagename"/>
+            <arg value="NoPackageName"/>
+            <arg value="--defaultcategoryname"/>
+            <arg value="NoCategoryName"/>
+            <arg value="--output"/>
+            <arg value="HTML:Arbit:arbit"/>
+            <arg value="--sourcecode"/>
+            <arg value="off"/>
+            <arg value="--javadocdesc"/>
+            <arg value="off"/>
+            <arg value="--pear"/>
+            <arg value="off"/>
+        </exec>
+
+        <move todir="${build.dir}" verbose="true">
+            <fileset dir="${build.dir}" casesensitive="yes">
+                <include name="**/classtrees_*.html"/>
+                <include name="**/elementindex_*.html"/>
+            </fileset>
+            <mapper type="regexp"
+                    from="(classtrees|elementindex)_([A-Za-z]*).html"
+                    to="phpdoc/${build.name}/phpdoc/\2/\1.html"/>
+        </move>
+
+        <tar destfile="${build.dir}/phpdoc/${build.name}/${build.name}.tar.bz2"
+            compression="bzip2"
+            longfile="gnu">
+            <tarfileset dir="${build.dir}/phpdoc/${build.name}/phpdoc"
+                        prefix="phpdoc"
+                        preserveLeadingSlashes="true">
+                <include name="**/*"/>
+            </tarfileset>
+        </tar>
+
+        <mkdir dir="content/documentation/${build.name}"/>
+
+        <copy file="${build.dir}/phpdoc/${build.name}/${build.name}.tar.bz2"
+              tofile="content/documentation/${build.name}/phpdoc.tar.bz2"/>
+
+        <delete dir="${build.dir}/phpdoc/${build.name}"/>
+    </target>
+
+    <!-- Copies tutorials for a given release to the website directory. -->
+    <target name="tutorials" description="Copies tutorials for a given release to the website directory.">
+        <copy todir="content/documentation/${build.name}">
+            <fileset dir="${zeta.base}" casesensitive="yes">
+                <include name="**"/>
+                <exclude name="autoload/**"/>
+                <exclude name="run-tests-tmp/**"/>
+                <exclude name="**/tests/**"/>
+                <exclude name=".rat-ignore"/>
+            </fileset>
+        </copy>
+
+        <echo message="Generating index files ..."/>
+
+        <for param="component">
+            <!-- listing components -->
+            <path>
+                <dirset dir="content/documentation/${build.name}">
+                    <include name="*"/>
+                    <exclude name="**/design"/>
+                </dirset>
+            </path>
+            <sequential>
+                <delete file="@{component}/.index.xml"/>
+
+                <var name="xml.string" value="&lt;?xml version='1.0' encoding='utf-8'?&gt;"/>
+                <var name="xml.string" value="${xml.string} &lt;index&gt;"/>
+
+                <if>
+                    <available file="@{component}/docs/tutorial.txt"/>
+                    <then>
+                        <var name="xml.string"
+                             value="${xml.string} &lt;site index='true'&gt;&lt;name&gt;Tutorial&lt;/name&gt;&lt;path&gt;tutorial.txt&lt;/path&gt;&lt;/site&gt;"/>
+                    </then>
+                </if>
+
+                <var name="${xml.string}"
+                     value="${xml.string} &lt;directory&gt;&lt;name&gt;API&lt;/name&gt;&lt;path&gt;phpdoc/&lt;/path&gt;&lt;/directory&gt;"/>
+
+                 <!-- listing .txt files per component -->
+                <for param="file">
+                    <path>
+                        <fileset dir="@{component}">
+                            <include name="*.txt"/>
+                        </fileset>
+                    </path>
+                    <sequential>
+                        <basename file="@{file}" property="local.filename"/>
+
+                        <!-- this is supposed to be the equivalent of ucfirst( foo ) -->
+                        <!-- but for some reason it does not work                    -->
+                        <!--    replace="\\L\\u$&amp;"                               -->
+                        <propertyregex property="name"
+                                input="${local.filename}"
+                                regexp="([a-z]+)[\w-_.]*.txt"
+                                select="\1"
+                                casesensitive="false" />
+
+                        <var name="xml.string"
+                            value="${xml.string} &lt;site&gt;&lt;name&gt;${name}&lt;/name&gt;&lt;path&gt;${local.filename}&lt;/path&gt;&lt;/site&gt;"/>
+
+                         <var name="name" unset="true"/>
+                         <var name="local.filename" unset="true"/>
+                    </sequential>
+                </for>
+
+                <!-- listing specific directories in each component -->
+                <for param="dir">
+                    <path>
+                        <dirset dir="@{component}">
+                            <include name="*"/>
+                            <exclude name="**/design"/>
+                            <exclude name="**/phpdoc"/>
+                            <exclude name="**/tutorial"/>
+                            <exclude name="**/functions"/>
+                        </dirset>
+                    </path>
+                    <sequential>
+                        <basename file="@{dir}" property="local.basename"/>
+
+                        <var name="xml.string"
+                             value="${xml.string} &lt;directory display='false'&gt;&lt;name&gt;${local.basename}&lt;/name&gt;&lt;path&gt;${local.basename}/&lt;/path&gt;&lt;/directory&gt;"/>
+
+                        <var name="local.basename" unset="true"/>
+                    </sequential>
+                </for>
+
+                <var name="xml.string" value="${xml.string} &lt;/index&gt;"/>
+
+                <echo message="${xml.string}" file="@{component}/.index.xml"/>
+                <var name="xml.string" unset="true"/>
+            </sequential>
+        </for>
+
+        <echo message="Done."/>
+    </target>
+
+    <!-- Extract API documentation from archive and copy it -->
+    <!-- to the correct location in the content tree        -->
+    <target name="extract-phpdoc" description="Extract API documentation from archive and copy it to the correct location in the content tree.">
+        <bunzip2 src="content/documentation/${build.name}/phpdoc.tar.bz2"/>
+        <untar src="content/documentation/${build.name}/phpdoc.tar" dest="content/documentation/"/>
+        <for param="component">
+            <path>
+                <dirset dir="content/documentation/${build.name}">
+                    <include name="*"/>
+                    <exclude name="**/design"/>
+                    <exclude name="**/phpdoc"/>
+                    <exclude name="**/Framework"/>
+                </dirset>
+            </path>
+            <sequential>
+                <basename file="@{component}" property="component.name"/>
+                <echo message="Copying API docs for ${component.name}"/>
+
+                <!-- clean everything first, if it exists -->
+                <delete dir="@{component}/phpdoc"/>
+                <mkdir dir="@{component}/phpdoc"/>
+
+                <copy todir="@{component}/phpdoc">
+                    <fileset dir="content/documentation/${build.name}/phpdoc/${component.name}/" casesensitive="yes">
+                        <include name="**"/>
+                    </fileset>
+                </copy>
+
+                <replaceregexp byline="true">
+                    <regexp pattern="\.\."/>
+                    <substitution expression="${component.name}"/>
+                    <fileset dir="@{component}/phpdoc/">
+                        <include name="*.html"/>
+                    </fileset>
+                </replaceregexp>
+
+                <!-- ++ THIS DOES NOT WORK YET ++ -->
+                <replaceregexp byline="true">
+                    <regexp pattern='"(\.\./)?([a-zA-Z]*)"'/>
+                    <substitution expression="/zetacomponents/documentation/${build.name}/\2/phpdoc/"/>
+                    <fileset dir="@{component}/phpdoc/">
+                        <include name="*.html"/>
+                    </fileset>
+                </replaceregexp>
+                <!-- ++++++++++++++++++++++++++++ -->
+
+                <var name="xml.string" value="&lt;?xml version='1.0' encoding='utf-8'?&gt;"/>
+                <var name="xml.string" value="${xml.string} &lt;index&gt;"/>
+                <var name="xml.string" value="${xml.string} &lt;site index='true'&gt;&lt;name&gt;Class tree&lt;/name&gt;&lt;path&gt;classtrees.html&lt;/path&gt;&lt;/site&gt;"/>
+
+                <for param="file">
+                    <path>
+                        <fileset dir="@{component}/phpdoc">
+                            <include name="*.html"/>
+                            <exclude name="classtrees.html"/>
+                        </fileset>
+                    </path>
+                    <sequential>
+                        <basename file="@{file}" property="base.name"/>
+                        <var name="xml.string" value="${xml.string} &lt;site display='false'&gt;&lt;name&gt;${base.name}&lt;/name&gt;&lt;path&gt;${base.name}&lt;/path&gt;&lt;/site&gt;"/>
+                        <var name="base.name" unset="true"/>
+                    </sequential>
+                </for>
+                <var name="xml.string" value="${xml.string} &lt;/index&gt;"/>
+
+                <echo message="${xml.string}" file="@{component}/.index.xml"/>
+
+                <var name="xml.string" unset="true"/>
+                <var name="component.name" unset="true"/>
+                <var name="component.name" unset="true"/>
+            </sequential>
+        </for>
+        <delete dir="content/documentation/${build.name}/phpdoc"/>
+        <delete file="content/documentation/${build.name}/phpdoc.tar"/>
+        <delete file="content/documentation/${build.name}/phpdoc.tar.bz2"/>
+    </target>
+
+    <!-- Build all docs for the release specified by ${zeta.base} -->
+    <target name="doc" depends="extract-phpdoc" description="Build all docs for the release specified by ${zeta.base}">
+        <!-- building content/documentation/${build.name}/.index.xml-->
+        <var name="xml.string" value="&lt;?xml version='1.0' encoding='utf-8'?&gt;"/>
+        <var name="xml.string" value="${xml.string} &lt;index&gt;"/>
+        <var name="xml.string" value="${xml.string} &lt;site index='true'&gt;&lt;name&gt;Overview&lt;/name&gt;&lt;path&gt;overview.txt&lt;/path&gt;&lt;/site&gt;"/>
+
+        <for param="component">
+            <path>
+                <dirset dir="content/documentation/${build.name}">
+                    <include name="*"/>
+                </dirset>
+            </path>
+            <sequential>
+                <basename file="@{component}" property="component.name"/>
+                <var name="xml.string" value="${xml.string} &lt;directory&gt;&lt;name&gt;${component.name}&lt;/name&gt;&lt;path&gt;${component.name}/&lt;/path&gt;&lt;/directory&gt;"/>
+            </sequential>
+        </for>
+
+        <var name="xml.string" value="${xml.string} &lt;/index&gt;"/>
+        <echo message="${xml.string}" file="content/documentation/${build.name}/.index.xml"/>
+        <var name="xml.string" unset="true"/>
+        <var name="component.name" unset="true"/>
+
+        <!-- building content/documentation/${build.name}/overview.txt -->
+        <delete file="content/documentation/${build.name}/overview.txt"/>
+        <copy file="content/documentation/teaser.txt" tofile="content/documentation/${build.name}/overview.txt"/>
+        <var name="overview.string" value=""/>
+        <!-- component list first -->
+        <for param="component">
+            <path>
+                <dirset dir="content/documentation/${build.name}">
+                    <include name="*"/>
+                </dirset>
+            </path>
+            <sequential>
+                <basename file="@{component}" property="component.name"/>
+                <var name="overview.string" value="${overview.string} - ${component.name}__${line.separator}"/>
+                <var name="component.name" unset="true"/>
+            </sequential>
+        </for>
+
+        <var name="overview.string" value="${overview.string}${line.separator}"/>
+
+        <!-- URL to tutorials -->
+        <for param="component">
+            <path>
+                <dirset dir="content/documentation/${build.name}">
+                    <include name="*"/>
+                </dirset>
+            </path>
+            <sequential>
+                <basename file="@{component}" property="component.name"/>
+                <var name="overview.string" value="${overview.string} __ /zetacomponents/documentation/${build.name}/${component.name}/tutorial.html${line.separator}"/>
+                <var name="component.name" unset="true"/>
+            </sequential>
+        </for>
+
+        <echo message="${overview.string}" file="content/documentation/${build.name}/overview.txt" append="true"/>
+        <var name="overview.string" unset="true"/>
+    </target>
+
+    <!-- Builds the website -->
+    <target name="website" depends="checkout-wcv,extract-phpdoc" description="Builds the website">
+        <exec executable="php">
+            <arg value="scripts/updateCache.php"/>
+        </exec>
+
+        <exec executable="php">
+            <arg value="var/scripts/highlight_source.php"/>
+        </exec>
+
+        <!--
+        <antcall target="revert-empty"/>
+        -->
+    </target>
+
+    <!--
+    <target name="revert-empty" description="Reverts all files without real changes">
+        <echo message="Scanning for files to revert ..."/>
+        <exec executable="svn">
+            <arg value="st"/>
+            <arg value="htdocs"/>
+            <redirector outputproperty="redirector.out">
+                <outputfilterchain>
+                    <replacestring from="?       " to=""/>
+                </outputfilterchain>
+            </redirector>
+        </exec>
+        <echo message="${redirector.out}"/>
+    </target>
+    -->
+
+    <!-- Checks out or update requirements for Web Content Viewer -->
+    <target name="-checkout-wcv-path">
+        <if>
+            <available file="${wcv.dir}"/>
+            <then>
+                <echo message="Updating ${wcv.dir}"/>
+                <exec executable="svn" failonerror="true">
+                    <arg value="update"/>
+                    <arg value="--ignore-externals"/>
+                    <arg value="--quiet"/>
+                    <arg value="${wcv.dir}"/>
+                </exec>
+            </then>
+            <else>
+                <echo message="Checking out ${wcv.dir}"/>
+                <exec executable="svn" failonerror="true">
+                    <arg value="checkout"/>
+                    <arg value="--ignore-externals"/>
+                    <arg value="--quiet"/>
+                    <arg value="${wcv.svn.repository}/${wcv.dir}"/>
+                </exec>
+            </else>
+        </if>
+    </target>
+
+    <target name="-checkout-zeta-component">
+        <if>
+            <available file="classes/ezc/${wcv.zeta.component}/src"/>
+            <then>
+                <if>
+                    <available file="${zeta.base}/${wcv.zeta.component}"/>
+                    <then>
+                        <!-- nothing -->
+                    </then>
+                    <else>
+                        <echo message="Linking from ${zeta.base}/${wcv.zeta.component}/src to classes/ezc/${wcv.zeta.component}/src"/>
+                        <symlink link="classes/ezc/${wcv.zeta.component}/src"
+                                 resource="${zeta.base}/${wcv.zeta.component}/src"/>
+                    </else>
+                </if>
+            </then>
+            <else>
+                <echo message="Checking out ${wcv.zeta.component}"/>
+                <exec executable="svn" failonerror="true">
+                    <arg value="checkout"/>
+                    <arg value="--quiet"/>
+                    <arg value="http://svn.ez.no/svn/ezcomponents/trunk/${wcv.zeta.component}/src"/>
+                    <arg value="classes/ezc/${wcv.zeta.component}/src"/>
+                </exec>
+            </else>
+        </if>
+    </target>
+
+    <!-- ================= -->
+    <!-- Ivy related stuff -->
+    <!-- ================= -->
+
+    <property name="ivy.install.version" value="2.1.0" />
+    <condition property="ivy.home" value="${env.IVY_HOME}">
+      <isset property="env.IVY_HOME" />
+    </condition>
+    <property name="ivy.home"         value="${user.home}/.ant" />
+    <property name="ivy.jar.dir"      value="${ivy.home}/lib" />
+    <property name="ivy.jar.file"     value="${ivy.jar.dir}/ivy.jar" />
+    <property name="ivy.download.url" value="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"/>
+
+    <!-- Install dependencies using Ivy -->
+    <!-- http://ant.apache.org/ivy/     -->
+    <target name="install-ant-dependencies" depends="-ivy-resolve-dependencies" description="Install dependencies required by Ant"/>
+
+    <!-- Retrieves dependencies with Ivy -->
+    <target name="-ivy-resolve-dependencies" depends="-ivy-init" unless="offline">
+        <ivy:resolve file="ant/ivy/ivy.xml"/>
+        <ivy:retrieve pattern="${user.home}/.ant/lib/[artifact]-[revision]-[type].[ext]"/>
+    </target>
+
+    <!-- Tries to load ivy here from ivy home, in case the user has not already dropped -->
+    <!-- it into ant's lib dir (note that the latter copy will always take precedence). -->
+    <!-- We will not fail as long as local lib dir exists (it may be empty) and         -->
+    <!-- ivy is in at least one of ant's lib dir or the local lib dir.                  -->
+    <target name="-ivy-init" depends="-ivy-download">
+        <path id="ivy.lib.path">
+            <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
+        </path>
+
+        <taskdef resource="org/apache/ivy/ant/antlib.xml"
+                 uri="antlib:org.apache.ivy.ant"
+                 classpathref="ivy.lib.path"/>
+    </target>
+
+    <!-- Downloads Ivy from web site so that it            -->
+    <!-- can be used even without any special installation -->
+    <target name="-ivy-download" unless="offline">
+        <mkdir dir="${ivy.jar.dir}"/>
+        <get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
+             dest="${ivy.jar.file}" usetimestamp="true"/>
+    </target>
+</project>
\ No newline at end of file