antville/build.xml

370 lines
15 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<!--
~ The Antville Project
~ http://code.google.com/p/antville
~
~ Copyright 2001-2014 by the Workers of Antville.
~
~ Copyright 20012007 Robert Gaggl, Hannes Wallnöfer, Tobi Schäfer,
~ Matthias & Michael Platzer, Christoph Lincke.
~
~ Licensed under the Apache License, Version 2.0 (the ``License'');
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an ``AS IS'' BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project name="antville" default="usage" basedir=".">
<target name="help" depends="usage"/>
<target name="usage">
<echo message="Antville Build Instructions"/>
<echo message="==========================="/>
<echo message="Available targets are:"/>
<echo message=" all Generate the Antville and AntClick packages"/>
<echo message=" antclick Generate the AntClick packages"/>
<echo message=" antville Generate the Antville packages"/>
<echo message=" clean Clean up build directory"/>
<echo message=" client Build client-side scripts and styles"/>
<echo message=" docs Generate the API documentation"/>
<echo message=" messages Generate JavaScript message files"/>
<echo message=" patch Apply patch file to Antville installation"/>
<echo message=" pot Extract gettext call strings into POT file"/>
<echo message=" release Copy packages to the download server"/>
<echo message=" +patch Scaffolds a new patch, ready for implementation"/>
<echo message=" +trail Scaffolds a new trail, ready for implementation"/>
<echo message=" usage Show these build instructions (default)"/>
</target>
<target name="all" depends="antville, antclick"/>
<target name="init">
<tstamp>
<format property="date" pattern="d MMM yyyy" locale="en"/>
</tstamp>
<tstamp>
<format property="file-date" pattern="yyyyMMdd" locale="en"/>
</tstamp>
<property name="name" value="antville"/>
<property name="year" value="1998-${year}"/>
<property name="version" value="1.5.0ɑ"/>
<property name="package.name" value="${name}-${version}"/>
<property name="antville.src" value="https://code.google.com/p/antville"/>
<property name="helma.src" value="https://github.com/p3k/helma/trunk"/>
<property name="modules.src" value="https://github.com/p3k/helma-modules/trunk"/>
<property name="apps.src" value="https://github.com/p3k/helma-apps/trunk"/>
<property name="jala.src" value="https://github.com/p3k/helma-jala/trunk"/>
<property name="uikit.dir" location="./node_modules/uikit"/>
<property name="build.dir" location="${basedir}/build"/>
<property file="${build.dir}/build.properties"/>
<property name="helma.dir" location="/opt/helma"/>
<property name="extra.dir" location="${build.dir}/extra"/>
<property name="dist.dir" location="${build.dir}/dist"/>
<property name="work.dir" location="${build.dir}/work"/>
<property name="source.dir" location="${work.dir}/src"/>
<property name="export.dir" location="${work.dir}/export"/>
<property name="modules.dir" location="${work.dir}/modules"/>
<property name="apps.dir" location="${work.dir}/apps"/>
<property name="antville.dir" location="${apps.dir}/antville"/>
<property name="hopkit.dir" location="${helma.dir}/modules/jala/util/HopKit"/>
<property name="trails.dir" location="${antville.dir}/trails"/>
<property name="docs.title" value="Antville&amp;#32;${version}&amp;#32;API&amp;#32;Reference"/>
<property name="docs.infiles" location="${basedir}/code"/>
<property name="docs.outfiles" location="${basedir}/docs"/>
<property name="i18n.scan" value="code compat extra"/>
<property name="i18n.destination" location="${basedir}/i18n"/>
<property name="i18n.poDirectory" location="${i18n.destination}"/>
<property name="i18n.template" location="${i18n.destination}/antville.pot"/>
<property name="i18n.namespace" value=""/>
</target>
<target name="export" depends="init">
<mkdir dir="${source.dir}"/>
<exec dir="${source.dir}" executable="git">
<arg line="clone ${antville.src}"/>
</exec>
<mkdir dir="${apps.dir}"/>
<exec dir="${source.dir}/antville" executable="git">
<arg line="checkout-index -f -a --prefix=${antville.dir}/"/>
</exec>
<delete includeemptydirs="true">
<fileset dir="${antville.dir}" includes="build.xml build/** docs/** i18n/*.po*"/>
</delete>
<exec dir="${source.dir}/antville" executable="git" outputproperty="hash">
<arg line="rev-parse --short HEAD"/>
</exec>
<replace file="${antville.dir}/code/Root/Root.js" value="${version}">
<replacetoken><![CDATA[<v>0</v>]]></replacetoken>
</replace>
<replace file="${antville.dir}/code/Root/Root.js" value="${hash}">
<replacetoken><![CDATA[<h>0</h>]]></replacetoken>
</replace>
<replace file="${antville.dir}/code/Root/Root.js" value="${date}">
<replacetoken><![CDATA[<d/>]]></replacetoken>
</replace>
</target>
<target name="ville" depends="antville"/>
<target name="click" depends="antclick"/>
<target name="antville" depends="export">
<antcall target="make-tar">
<param name="filename" value="${package.name}"/>
<param name="path" value="${antville.dir}"/>
</antcall>
<antcall target="make-zip">
<param name="filename" value="${package.name}"/>
<param name="path" value="${antville.dir}"/>
</antcall>
</target>
<target name="antclick" depends="export">
<!-- Export Helma, modules and apps to temporary directory -->
<exec dir="${export.dir}" executable="svn">
<arg line="--force export ${helma.src} helma"/>
</exec>
<exec dir="${export.dir}" executable="svn">
<arg line="--force export ${modules.src} modules"/>
</exec>
<exec dir="${export.dir}" executable="svn">
<arg line="--force export ${jala.src} modules/jala"/>
</exec>
<exec dir="${export.dir}" executable="svn">
<arg line="--force export ${apps.src} apps"/>
</exec>
<!-- Copy exported files to final destinations -->
<copy todir="${work.dir}">
<fileset dir="${export.dir}/helma" includes="lib/** licenses/**"/>
</copy>
<copy todir="${modules.dir}">
<fileset dir="${export.dir}/modules" includes="core/** helma/** jala/**"/>
</copy>
<copy todir="${apps.dir}">
<fileset dir="${export.dir}/apps" includes="manage/**"/>
</copy>
<copy file="${export.dir}/helma/license.txt" tofile="${work.dir}/licenses/helma.txt"/>
<!-- Copy extra files to final destinations -->
<copy todir="${work.dir}">
<fileset dir="${extra.dir}" includes="start.bat apps.properties
server.properties launcher.jar"/>
</copy>
<exec dir="${extra.dir}" executable="cp">
<arg line="-p start.sh ${work.dir}"/>
</exec>
<copy file="${extra.dir}/helma.jar" todir="${work.dir}/lib"/>
<copy file="${extra.dir}/h2-1.3.155.jar" todir="${work.dir}/lib/ext"/>
<copy file="${extra.dir}/h2.txt" todir="${work.dir}/licenses"/>
<copy todir="${build.dir}/work/db">
<fileset dir="${extra.dir}" includes="antville.h2.db"/>
</copy>
<copy todir="${work.dir}/licenses">
<fileset dir="${antville.dir}/legal" includes="**"/>
</copy>
<copy file="${modules.dir}/jala/licenses/jala.txt" todir="${work.dir}/licenses"/>
<!-- Delete unnecessary files -->
<delete>
<fileset dir="${modules.dir}/helma" includes="*.jar Search.js Ssh.js Chart.js"/>
</delete>
<delete includeemptydirs="true">
<fileset dir="${modules.dir}/jala" includes="build.properties docs/**
lib/** licenses/** tests/** util/**"/>
</delete>
<delete dir="${antville.dir}/legal"/>
<delete dir="${export.dir}"/>
<!-- Create the packages -->
<antcall target="make-zip">
<param name="filename" value="antclick-${version}"/>
<param name="path" value="${work.dir}"/>
</antcall>
<antcall target="make-tar">
<param name="filename" value="antclick-${version}"/>
<param name="path" value="${work.dir}"/>
</antcall>
</target>
<target name="client" depends="init">
<copy todir="static/fonts">
<fileset dir="node_modules/uikit-bower/fonts" includes="**"/>
</copy>
<mkdir dir="static/scripts"/>
<exec executable="node_modules/.bin/browserify" output="static/scripts/main.min.js">
<arg line="build/client/main.js"/>
</exec>
<mkdir dir="static/styles"/>
<exec executable="node_modules/.bin/lessc" output="static/styles/main.min.css">
<arg line="-x build/client/main.less"/>
</exec>
</target>
<target name="docs" depends="init">
<exec dir="${build.dir}/jsdoc/toolkit" executable="${build.dir}/jsdoc/jsrunwrapper.sh">
<arg line='-D="title:${docs.title}" -q -r=2 -p -t=../templates/codeview
-d=${docs.outfiles} ${docs.infiles}'/>
</exec>
</target>
<target name="pot" depends="init">
<java dir="${helma.dir}" classpath="${helma.dir}/launcher.jar" classname="helma.main.launcher.Commandline"
fork="true">
<!-- Root.extractMessages is currently located in Global/i18n.js -->
<arg value="antville.extractMessages"/>
<arg value="${build.dir}/MessageParser.js"/>
<arg value="${i18n.scan}"/>
<arg value="${i18n.template}"/>
</java>
</target>
<target name="messages" depends="init">
<java dir="${helma.dir}" classpath="${helma.dir}/lib/rhino.jar"
classname="org.mozilla.javascript.tools.shell.Main">
<arg value="${build.dir}/PoParser.js"/>
<arg value="${i18n.poDirectory}"/>
<arg value="${i18n.destination}"/>
<arg value="${i18n.namespace}"/>
</java>
</target>
<target name="make-tar" depends="init">
<mkdir dir="${dist.dir}"/>
<fixcrlf srcdir="${path}" eol="lf" eof="remove" includes="**/*.txt,
**/*.properties, **/*.hac, **/*.js, **/*.skin, **/.xml, **/.sh"/>
<tar tarfile="${dist.dir}/${filename}.tar" basedir="${path}" excludes="**">
<tarfileset prefix="${filename}" dir="${path}" mode="755">
<include name="**/*.sh"/>
</tarfileset>
<tarfileset prefix="${filename}" dir="${path}">
<include name="**"/>
<exclude name="**/*.sh"/>
</tarfileset>
</tar>
<bzip2 zipfile="${dist.dir}/${filename}.tbz" src="${dist.dir}/${filename}.tar"/>
<delete file="${dist.dir}/${filename}.tar"/>
</target>
<target name="make-zip" depends="init">
<mkdir dir="${dist.dir}"/>
<fixcrlf srcdir="${path}" eol="crlf" includes="**/*.txt, **/*.properties,
**/*.hac, **/*.js, **/*.skin, **/*.xml, **/.bat"/>
<zip zipfile="${dist.dir}/${filename}.zip">
<zipfileset dir="${path}" prefix="${filename}" includes="**"/>
</zip>
</target>
<target name="release" depends="init">
<property name="antville.summary"
value="Helma application providing high performance, full featured weblog hosting"/>
<property name="antclick.summary"
value="The lightweight all-in-one package which contains everything you need to run Antville on your computer"/>
<antcall target="upload">
<param name="file" value="${dist.dir}/${package.name}.tbz"/>
<param name="summary" value="${antville.summary}"/>
<param name="labels" value="Type-Package, OpSys-All, Featured"/>
</antcall>
<antcall target="upload">
<param name="file" value="${dist.dir}/${package.name}.zip"/>
<param name="summary" value="${antville.summary}"/>
<param name="labels" value="Type-Package, OpSys-Windows"/>
</antcall>
<antcall target="upload">
<param name="file" value="${dist.dir}/antclick-${version}.tbz"/>
<param name="summary" value="${antclick.summary}"/>
<param name="labels" value="Type-Package, OpSys-All"/>
</antcall>
<antcall target="upload">
<param name="file" value="${dist.dir}/antclick-${version}.zip"/>
<param name="summary" value="${antclick.summary}"/>
<param name="labels" value="Type-Package, OpSys-Windows, Featured"/>
</antcall>
</target>
<target name="test-upload" depends="init">
<antcall target="upload">
<param name="file" value="/Users/tobi/Desktop/test.txt"/>
<param name="summary" value="Test pls ignore"/>
<param name="labels" value="Deprecated"/>
</antcall>
</target>
<target name="upload" depends="file-exists" if="file.exists">
<taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask"
classpath="${build.dir}/ant-googlecode-0.0.3.jar" name="gcupload"/>
<gcupload username="${google.username}" password="${google.password}" projectname="antville" filename="${file}"
targetfilename="${file}" summary="${summary}" labels="${labels}"/>
</target>
<target name="patch" depends="init">
<input message="Please enter the patch ID: " addproperty="patch.id"/>
<loadfile property="patch" srcFile="${basedir}/extra/updater/patch-${patch.id}.js"/>
<echo message="${patch}"/>
<input message="Apply the displayed patch? " validargs="y,n" addproperty="patch.confirm"/>
<condition property="patch.abort">
<equals arg1="${patch.confirm}" arg2="n" casesensitive="false" trim="true"/>
</condition>
<fail if="patch.abort">Build aborted by user.</fail>
<java dir="${helma.dir}" classpath="${helma.dir}/launcher.jar" classname="helma.main.launcher.Commandline"
fork="true">
<arg value="antville.patch"/>
<arg value="${patch}"/>
</java>
</target>
<target name="+patch" depends="init">
<property name="patch.dir" value="extra/updater"/>
<echo file="${patch.dir}/patch-${file-date}.js">// Apply with enabled updater repository using `ant patch -Dpatch.id=${file-date}`${line.separator}<!--
-->var sql = new Sql();
</echo>
</target>
<target name="+trail" depends="init">
<property name="trail.dir" value="trails/${trail.name}/${trail.title}"/>
<input message="Please enter the name of the trail: " addproperty="trail.name"/>
<script language="javascript"><![CDATA[
name = project.getProperty('trail.name');
firstLetter = name.substr(0, 1).toUpperCase();
title = firstLetter + name.substr(1);
project.setProperty('trail.title', title);
]]></script>
<mkdir dir="${trail.dir}"/>
<echo file="${trail.dir}/${trail.title}.properties" append="true">#sites = collection(Site)</echo>
<echo file="${trail.dir}/${trail.title}.js" append="true">${trail.title}.prototype.main_action = function () {${line.separator}<!--
--> //res.debug(this.sites.count());${line.separator}<!--
-->};${line.separator}</echo>
<mkdir dir="${trail.dir}/../Trails"/>
<echo file="${trail.dir}/../Trails/Trails.properties" append="true">${trail.name} = mountpoint(${trail.title})${line.separator}</echo>
</target>
<target name="clean" depends="init">
<delete dir="${work.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="file-exists" unless="file.exists">
<available property="file.exists" file="${file}"/>
</target>
<target name="debug" depends="init">
<!-- For debugging and testing purposes -->
</target>
</project>