blob: 3c501c28ba126ac79e50b18823f82b9a7320a9fa [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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 default="build-widget" basedir="." name="Wookie_widgets_build_file">
<property name="wookie.root.dir" location="../"/>
<property file="local.build.properties"/>
<property file="build.properties"/>
<property name="project.build.dir" location="./build"/>
<property name="widget.deploy.dir" location="../wookie-server/target/tomcat6x/webapps/wookie/deploy"/>
<property name="wookie.widgets.dir" location="${wookie.root.dir}/wookie-widgets/"/>
<property name="widget.template.dir" value="${wookie.widgets.dir}/widget-template"/>
<property name="widget.build.dir" value="${wookie.widgets.dir}/build/widgets"/>
<property name="widget.deploy.compressed" value="true" />
<target name="_get-widget-name" unless="widget.shortname">
<input message="What is the short name of the widget you wish to work with?"
addproperty="widget.shortname"/>
</target>
<target name="_get-widget-type"
description="get the type of widget required from the user, unless it has been supplied in the command line"
unless="widget.type">
<input message="What type of widget template do you want to use?"
validargs="basic,settings,wave,jqueryMobile,s5"
defaultvalue="basic"
addproperty="widget.type"/>
</target>
<target name="_get-widget-description"
description="get the description from the user, unless it has been supplied in the command line"
unless="widget.description">
<input message="Provide a brief description of the purpose of the ${widget.shortname} widget"
addproperty="widget.description"/>
</target>
<target name="_get-widget-height"
description="get the height of the widget from the user, unless it has been supplied in the command line"
unless="widget.height">
<input message="What is the default height of the ${widget.shortname} widget?"
addproperty="widget.height"
defaultvalue="480"/>
</target>
<target name="_get-widget-width"
description="get the width of the widget from the user, unless it has been supplied in the command line"
unless="widget.width">
<input message="What is the default width of the widget you wish to create?" addproperty="widget.width" defaultvalue="320"/>
</target>
<target name="_clean">
<delete dir="${widget.build.dir}" failonerror="false"/>
<mkdir dir="${widget.build.dir}"/>
</target>
<target name="_init" depends="_get-widget-name, _clean">
<mkdir dir="${widget.build.dir}"/>
</target>
<target name="seed-widget" description="Seed a new widget"
depends="_get-widget-type, _get-widget-name, _get-widget-description, _get-widget-height, _get-widget-width">
<mkdir dir="${wookie.widgets.dir}/${widget.shortname}"/>
<copy todir="${wookie.widgets.dir}/${widget.shortname}" filtering="true">
<fileset dir="${widget.template.dir}/${widget.type}">
<exclude name="**/*.png"/>
<exclude name="**/*.zip"/>
</fileset>
<filterset>
<filter token="widget.shortname" value="${widget.shortname}"/>
<filter token="widget.description" value="${widget.description}"/>
<filter token="widget.height" value="${widget.height}"/>
<filter token="widget.width" value="${widget.width}"/>
</filterset>
</copy>
<copy todir="${wookie.widgets.dir}/${widget.shortname}">
<fileset dir="${widget.template.dir}/${widget.type}">
<include name="**/*.png"/>
<include name="**/*.zip"/>
</fileset>
</copy>
</target>
<target name="build-test-widget" description="Build a test widget that uses sensible settings. This is used when developing the widget template scripts.">
<property name="widget.type" value="basic"/>
<property name="widget.shortname" value="TemplateTest"/>
<property name="widget.description" value="A widget built from the standard widget template and using sensible default options for all configuration settings. This is used during development of the widget template"/>
<property name="widget.height" value="480"/>
<property name="widget.width" value="320"/>
<antcall target="_create-widget-from-template"/>
<antcall target="build-widget"/>
</target>
<target name="build-widget" depends="_init">
<zip destfile="${widget.build.dir}/${widget.shortname}.wgt"
basedir="${wookie.widgets.dir}/${widget.shortname}"
/>
<echo>Widget package created at ${widget.build.dir}/${widget.shortname}.wgt</echo>
</target>
<target name="deploy-widget" depends="build-widget"
if="widget.deploy.compressed">
<copy tofile="${widget.deploy.dir}/${widget.shortname}.wgt"
file="${widget.build.dir}/${widget.shortname}.wgt"/>
<echo>Deployed "${widget.shortname}" in compressed form to ${widget.deploy.dir}/${widget.shortname}.wgt</echo>
</target>
<target name="deploy-expanded-widget" depends="build-widget"
if="widget.deploy.expanded">
<mkdir dir="${widget.deploy.dir}/${widget.shortname}"/>
<copy todir="${widget.deploy.dir}/${widget.shortname}">
<fileset dir="${widget.build.dir}/${widget.shortname}"/>
</copy>
<echo>Deployed "${widget.shortname}" in expanded form to ${widget.deploy.dir}/${widget.shortname}/</echo>
</target>
<target name="deploy-all" description="deploy all widgets in the base directory">
<echo>Deploying widgets from ${wookie.widgets.dir}
include: */build.xml
exclude: none</echo>
<subant antfile="build.xml" target="deploy-widget" inheritall="true">
<fileset dir="${wookie.widgets.dir}">
<include name="*/build.xml"/>
<exclude name="templates/build.xml"/>
</fileset>
</subant>
</target>
</project>