Skip to content

Commit

Permalink
Created Ant Build Script for Project Distribution.
Browse files Browse the repository at this point in the history
  • Loading branch information
limcheekin committed Jan 4, 2011
1 parent a4aa93e commit 0e2fbdd
Show file tree
Hide file tree
Showing 18 changed files with 6,197 additions and 0 deletions.
1 change: 1 addition & 0 deletions VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1
184 changes: 184 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
<project name="jquery-form-builder-plugin" default="all" basedir=".">

<loadfile property="version" srcfile="VERSION.txt" />

<property name="BUILD_DIR" value="./build" description="Build folder" />
<property name="SRC_JS_DIR" value="./src/js" description="JavaScript Source folder" />
<property name="SRC_CSS_DIR" value="./src/css" description="CSS Source folder" />
<property name="DIST_DIR" value="./dist" description="Compiled jquery-form-builder-plugin folder" />
<property name="IMG_DIR" value="./images" description="Images folder" />

<property name="JQUERY_FORM_BUILDER" value="${DIST_DIR}/jquery-formbuilder-${version}.js" />
<property name="JQUERY_FORM_BUILDER_MIN" value="${DIST_DIR}/jquery-formbuilder-${version}.min.js" />
<property name="JQUERY_FORM_BUILDER_PACK" value="${DIST_DIR}/jquery-formbuilder-${version}.pack.js" />
<property name="JQUERY_FORM_BUILDER_CSS" value="${DIST_DIR}/jquery-formbuilder-${version}.css" />
<property name="JQUERY_FORM_BUILDER_IMG" value="${DIST_DIR}/images" />

<property name="PLUGINS" value="textfield" />

<path id="svnant.classpath">
<pathelement path="${BUILD_DIR}/svnant.jar" />
<pathelement path="${BUILD_DIR}/svnClientAdapter.jar" />
<pathelement path="${BUILD_DIR}/svnjavahl.jar" />
<pathelement path="${BUILD_DIR}/svnkit.jar" />
</path>

<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.classpath" />

<target name="plugins">
<script language="groovy" classpath="${BUILD_DIR}/groovy-all-1.7.4.jar">
<![CDATA[
def pluginNames = project.getProperty("PLUGINS").split(",")
String jsDir = project.getProperty("SRC_JS_DIR")
String cssDir = project.getProperty("SRC_CSS_DIR")
String pluginJavaScriptFiles = ''
String pluginCssFiles = ''
pluginNames.each { name ->
name = name.trim()
pluginJavaScriptFiles += "${jsDir}/jquery.formbuilder.${name}.js "
pluginCssFiles += "${cssDir}/jquery.formbuilder.${name}.css "
}
project.setProperty("PLUGINS_JS", pluginJavaScriptFiles)
project.setProperty("PLUGINS_CSS", pluginCssFiles)
]]>
</script>
<echo message="PLUGINS_JS: ${PLUGINS_JS}" />
<echo message="PLUGINS_CSS: ${PLUGINS_CSS}" />
</target>
<target name="all" depends="clean,svninfo,plugins,formbuilder,lint,css,images,min,pack" description="Builds jquery-form-builder-plugin including minified, packed JS files, as well as images and CSS" />

<target name="svninfo">
<svn javahl="false" svnkit="true">
<update dir="." />
<info target="." />
</svn>
<echo message="svn.info.lastRev: ${svn.info.lastRev}" />
<echo message="svn.info.lastDate: ${svn.info.lastDate}" />
</target>

<target name="dir" description="Builds distribution directory">
<mkdir dir="${DIST_DIR}" />
</target>

<target name="formbuilder" depends="dir" description="Main jquery-form-builder-plugin build. Concatenates source and css files and replaces @VERSION/Date">
<echo message="Building ${JQUERY_FORM_BUILDER}" />

<concat destfile="${JQUERY_FORM_BUILDER}">
<fileset file="${SRC_JS_DIR}/../HEADER.txt" />
<!--fileset file="${SRC_JS_DIR}/intro.js" /-->
<fileset file="${SRC_JS_DIR}/jquery.formbuilder.core.js" />
<filelist files="${PLUGINS_JS}" />
<!--fileset file="${SRC_JS_DIR}/outro.js" /-->
</concat>
<replaceregexp match="@REVISION" replace="${svn.info.lastRev}" flags="g" byline="true" file="${JQUERY_FORM_BUILDER}" />
<replaceregexp match="@VERSION" replace="${version}" flags="g" byline="true" file="${JQUERY_FORM_BUILDER}" />
<replaceregexp match="Date: " replace="Date: ${svn.info.lastDate}" file="${JQUERY_FORM_BUILDER}" />

<echo message="${JQUERY_FORM_BUILDER} built." />
</target>

<target name="min" depends="formbuilder" description="Remove all comments and whitespace, no compression, great in combination with GZip">
<echo message="Building ${JQUERY_FORM_BUILDER_MIN}" />

<apply executable="java" parallel="false" verbose="true" dest="${DIST_DIR}">
<fileset dir="${DIST_DIR}">
<include name="jquery.formbuilder.js" />
</fileset>

<arg line="-jar" />
<arg path="${BUILD_DIR}/compiler.jar" />
<arg value="--warning_level" />
<arg value="QUIET" />
<arg value="--js_output_file" />
<targetfile />
<arg value="--js" />
<mapper type="glob" from="jquery.formbuilder.js" to="tmpmin" />
</apply>

<concat destfile="${JQUERY_FORM_BUILDER_MIN}">
<filelist files="${JQUERY_FORM_BUILDER}, dist/tmpmin" />
<filterchain>
<headfilter lines="12" />
</filterchain>
</concat>

<concat destfile="${JQUERY_FORM_BUILDER_MIN}" append="yes">
<filelist files="dist/tmpmin" />
</concat>
<delete file="dist/tmpmin" />

<echo message="${JQUERY_FORM_BUILDER_MIN} built." />
</target>

<target name="pack" depends="min" description="Compresses minified jquery-form-builder-plugin source for even smaller file-sizes">
<echo message="Building ${JQUERY_FORM_BUILDER_PACK}" />

<apply executable="java" parallel="false" verbose="true">
<fileset dir="${DIST_DIR}">
<include name="jquery.formbuilder.js" />
</fileset>

<arg line="-jar" />
<arg path="${BUILD_DIR}/js.jar" />
<arg value="${BUILD_DIR}/packer.js" />
<arg value="${JQUERY_FORM_BUILDER_MIN}" />
<arg value="${JQUERY_FORM_BUILDER_PACK}.tmp" />
</apply>

<concat destfile="${JQUERY_FORM_BUILDER_PACK}">
<filelist files="${JQUERY_FORM_BUILDER}, ${JQUERY_FORM_BUILDER_PACK}.tmp" />
<filterchain>
<headfilter lines="12" />
</filterchain>
</concat>

<concat destfile="${JQUERY_FORM_BUILDER_PACK}" append="yes">
<filelist files="${JQUERY_FORM_BUILDER_PACK}.tmp" />
</concat>
<delete file="${JQUERY_FORM_BUILDER_PACK}.tmp" />

<echo message="${JQUERY_FORM_BUILDER_PACK} built." />
</target>

<target name="css" depends="dir" description="Builds jquery-form-builder-plugin CSS file">
<echo message="Building ${JQUERY_FORM_BUILDER_CSS}" />

<concat destfile="${JQUERY_FORM_BUILDER_CSS}">
<fileset file="${SRC_CSS_DIR}/../HEADER.txt" />
<filelist files="${PLUGINS_CSS}" />
</concat>

<replaceregexp match="@REVISION" replace="${svn.info.lastRev}" flags="g" byline="true" file="${JQUERY_FORM_BUILDER_CSS}" />
<replaceregexp match="@VERSION" replace="${version}" flags="g" byline="true" file="${JQUERY_FORM_BUILDER_CSS}" />
<replaceregexp match="Date: " replace="Date: ${svn.info.lastDate}" file="${JQUERY_FORM_BUILDER_CSS}" />

<echo message="${JQUERY_FORM_BUILDER_CSS} built." />
</target>

<target name="images" depends="dir" description="Builds images directory">
<echo message="Building ${JQUERY_FORM_BUILDER_IMG}" />

<mkdir dir="${JQUERY_FORM_BUILDER_IMG}" />
<copy todir="${JQUERY_FORM_BUILDER_IMG}">
<fileset dir="${IMG_DIR}">
<include name="**/*.png" />
</fileset>
</copy>

<echo message="${JQUERY_FORM_BUILDER_IMG} built." />
</target>

<target name="lint" description="Builds and checks the jquery-form-builder-plugin source with JSLint">
<echo message="Checking jquery-form-builder-plugin against JSLint..." />

<exec executable="java">
<arg line="-jar" />
<arg path="${BUILD_DIR}/js.jar" />
<arg value="${BUILD_DIR}/jslint-check.js" />
</exec>
</target>

<target name="clean">
<delete dir="${DIST_DIR}" />
</target>
</project>
15 changes: 15 additions & 0 deletions build/GROOVY-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* 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.
*
*/

55 changes: 55 additions & 0 deletions build/JAVAHL-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
This license applies to all portions of Subversion which are not
externally-maintained libraries (e.g. apr/, apr-util/, and neon/).
Such libraries have their own licenses; we recommend you read them, as
their terms may differ from the terms below.

This is version 1 of this license. It is also available online at
http://subversion.tigris.org/license-1.html. If newer versions of
this license are posted there (the same URL, but with the version
number incremented: .../license-2.html, .../license-3.html, and so
on), you may use a newer version instead, at your option.

====================================================================
Copyright (c) 2000-2005 CollabNet. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. The end-user documentation included with the redistribution, if
any, must include the following acknowledgment: "This product includes
software developed by CollabNet (http://www.Collab.Net/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.

4. The hosted project names must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact info@collab.net.

5. Products derived from this software may not use the "Tigris" name
nor may "Tigris" appear in their names without prior written
permission of CollabNet.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL COLLABNET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
====================================================================

This software consists of voluntary contributions made by many
individuals on behalf of CollabNet.

64 changes: 64 additions & 0 deletions build/SVNANT-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
SvnAnt license

This license applies to all portions of svnant library, which
are not externally-maintained libraries (e.g. svnClientAdapter, JavaHL or SVNKit).

Such libraries have their own licenses; we recommend you read them, as
their terms may differ from the terms below.

/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/


Loading

0 comments on commit 0e2fbdd

Please sign in to comment.