<?xml version="1.0" encoding="utf-8"?>
|
<!--
|
********************************** DO NOT EDIT **********************************
|
|
This file will be replaced during upgrades so DO NOT EDIT this file. If you need to
|
adjust the process, reading and understanding this file is the first step.
|
|
In most cases, the adjustments can be achieved by setting properties or providing one
|
of the "hooks" in the form of a "-before-" or "-after-" target. Whenever possible, look
|
for one of these solutions.
|
|
Failing that, you can copy whole targets to your build.xml file and it will overrride
|
the target provided here. Doing that can create problems for upgrading to newer
|
versions of Cmd so it is not recommended but it will be easier to manage than editing
|
this file in most cases.
|
-->
|
<project>
|
<!--
|
Init-Local
|
-->
|
<target name="-before-init-local"/>
|
<target name="-after-init-local"/>
|
<target name="init-local">
|
<antcall target="-before-init-local"/>
|
|
<property file="${basedir}/../../local.properties"/>
|
|
<script language="javascript">
|
var f = new java.io.File(project.getProperty("basedir"));
|
var sub = ".sencha/workspace/sencha.cfg";
|
|
for (var p = f; p; p = p.getParentFile()) {
|
var t = new java.io.File(p, sub);
|
if (t.exists()) {
|
// we found the workspace folder!
|
|
t = new java.io.File(p, "local.properties");
|
if (t.exists()) {
|
var loader = project.createTask("property");
|
loader.setFile(new java.io.File(t.getCanonicalPath()));
|
loader.execute();
|
}
|
|
break;
|
}
|
}
|
</script>
|
|
<antcall target="-after-init-local"/>
|
</target>
|
|
<!--
|
Find Sencha Cmd
|
-->
|
<target name="find-cmd" unless="cmd.dir">
|
<!--
|
Run "sencha which" to find the Sencha Cmd basedir and get "cmd.dir" setup. We
|
need to execute the command with curdir set properly for Cmd to pick up that we
|
are running for an application.
|
-->
|
<exec executable="sencha" dir="${basedir}">
|
<arg value="which"/><arg value="-o=$cmddir$"/>
|
</exec>
|
|
<!-- Now read the generated properties file and delete it -->
|
<property file="$cmddir$"/>
|
<delete file="$cmddir$"/>
|
|
<echo>Using Sencha Cmd from ${cmd.dir}</echo>
|
</target>
|
|
<!--
|
Init
|
-->
|
<target name="-before-init"/>
|
<target name="-after-init"/>
|
<target name="init" depends="init-local,find-cmd">
|
<antcall target="-before-init"/>
|
|
<taskdef resource="com/sencha/ant/antlib.xml"
|
classpath="${cmd.dir}/sencha.jar"
|
loaderref="senchaloader"/>
|
|
<x-sencha-init prefix=""/>
|
<!-- Some operations require sencha.jar in the Ant classpath -->
|
<x-extend-classpath>
|
<jar path="${cmd.dir}/sencha.jar"/>
|
</x-extend-classpath>
|
|
<!-- default the build environment to production if it is unset by this point -->
|
<property name="args.environment" value="production"/>
|
|
<x-load-properties file="${package.config.dir}/${args.environment}.properties" required="0"/>
|
<x-load-properties file="${package.config.dir}/build.properties" required="1"/>
|
|
<condition property="package.resources.dir.exists">
|
<available file="${package.resources.dir}" type="dir"/>
|
</condition>
|
|
<condition property="package.sass.dir.exists">
|
<available file="${package.sass.dir}" type="dir" />
|
</condition>
|
|
|
<if>
|
<not>
|
<isset property="package.framework"/>
|
</not>
|
<then>
|
<property name="skip.style" value="1"/>
|
</then>
|
</if>
|
|
<if>
|
<isset property="skip.style"/>
|
<then>
|
<property name="skip.sass" value="1"/>
|
<property name="skip.capture" value="1"/>
|
<property name="skip.slice" value="1"/>
|
</then>
|
</if>
|
|
<if>
|
<isset property="package.sass.dir.exists"/>
|
<then>
|
<x-normalize-path path="${build.dir}/resources" property="image.search.path"/>
|
<property name="build.compile.sass.rtl">
|
sass
|
-etc=true
|
-vars=true
|
-rules=true
|
-class-name-vars=true
|
-variable=$image-search-path:'${image.search.path}' !default
|
-variable=$theme-name: '${package.name}' !default
|
-output=${build.all.rtl.scss}
|
and
|
sass
|
-ruby=true
|
-output=${build.all.ruby}
|
</property>
|
<property name="build.compile.sass">
|
sass
|
-etc=true
|
-vars=true
|
-rules=true
|
-class-name-vars=true
|
-variable=$image-search-path:'${image.search.path}' !default
|
-variable=$theme-name: '${package.name}' !default
|
-output=${build.all.scss}
|
and
|
sass
|
-ruby=true
|
-output=${build.all.ruby}
|
</property>
|
</then>
|
</if>
|
|
<property name="build.compile.sass.rtl" value=""/>
|
<property name="build.compile.sass" value=""/>
|
|
<if>
|
<equals arg1="theme" arg2="${package.type}"/>
|
<then>
|
<property name="build.compile.js.filter">
|
union
|
-tag=package-${package.name}
|
and
|
include
|
-tag=package-${package.name}-base
|
</property>
|
</then>
|
</if>
|
|
<property name="build.compile.js.filter">
|
union
|
-tag=package-${package.name}
|
</property>
|
|
<property name="build.compile.js.dev.subcommand">
|
-options=${build.compile.js.dev.options}
|
${build.compile.js.filter}
|
and
|
concat
|
-out=${build.all.dev.js}
|
</property>
|
|
<property name="build.compile.js.debug.subcommand">
|
-options=${build.compile.js.debug.options}
|
${build.compile.js.filter}
|
and
|
concatenate
|
-output-file=${build.all.debug.js}
|
</property>
|
|
<property name="build.compile.js.subcommand">
|
-options=${build.compile.js.options}
|
${build.compile.js.filter}
|
and
|
# TODO: exclude Ext.cmd.derive
|
# optimize
|
# -define-rewrite
|
# and
|
concatenate
|
${build.compile.js.compress}
|
-output-file=${build.all.js}
|
</property>
|
|
<property name="build.compile.js.command">
|
${build.compile.js.dev.subcommand}
|
and
|
${build.compile.js.debug.subcommand}
|
and
|
${build.compile.js.subcommand}
|
</property>
|
|
<property name="build.compile.sass.rtl.filter">
|
include
|
-all
|
</property>
|
|
<property name="build.compile.sass.filter">
|
union
|
-not
|
-namespace=Ext.rtl
|
</property>
|
|
<property name="build.compile.sass.rtl.subcommand">
|
${build.compile.sass.rtl.filter}
|
and
|
${build.compile.sass.rtl}
|
</property>
|
|
<property name="build.compile.sass.subcommand">
|
${build.compile.sass.filter}
|
and
|
${build.compile.sass}
|
</property>
|
|
<property name="build.compile.sass.command">
|
${build.compile.sass.rtl.subcommand}
|
and
|
${build.compile.sass.subcommand}
|
</property>
|
|
<if>
|
<isset property="skip.style"/>
|
<then>
|
<property name="build.compile.command">
|
compile
|
${build.compile.js.command}
|
</property>
|
</then>
|
</if>
|
|
<property name="build.compile.command">
|
compile
|
${build.compile.sass.command}
|
and
|
${build.compile.js.command}
|
</property>
|
|
<property name="build.theme.capture.command">
|
theme
|
capture
|
-page=${build.dir}/example/theme.html
|
-image=${build.dir}/theme-capture.png
|
-manifest=${build.dir}/theme-capture.json
|
</property>
|
|
<property name="build.theme.slice.command">
|
fs
|
slice
|
${build.slice.options}
|
-image=${build.dir}/theme-capture.png
|
-manifest=${build.dir}/theme-capture.json
|
-out=${build.resources.dir}
|
</property>
|
|
<fileset id="pkg.files" dir="${package.dir}" includes="${pkg.includes}">
|
<exclude name="${pkg.excludes}"/>
|
<exclude name="**/.sass-cache/**/*"/>
|
<exclude name="**/.sass-cache"/>
|
<exclude name="**/theme-capture.*"/>
|
</fileset>
|
<property name="build.pkg.manifest" value="pkg.files"/>
|
|
<antcall target="-after-init"/>
|
</target>
|
|
<!--
|
Clean
|
-->
|
<target name="-before-clean"/>
|
<target name="-after-clean"/>
|
<target name="clean" depends="init"
|
description="Removes all build output produced by the 'build' target">
|
<antcall target="-before-clean"/>
|
|
<delete dir="${build.dir}"/>
|
|
<antcall target="-after-clean"/>
|
</target>
|
|
<!--
|
Build SASS
|
-->
|
<target name="-before-sass"/>
|
<target name="-after-sass"/>
|
<target name="sass" depends="init" if="package.sass.dir.exists" unless="skip.sass"
|
description="Builds the SASS files using Compass">
|
<antcall target="-before-sass"/>
|
|
<antcall target="-before-js"/>
|
|
<x-compass-compile
|
dir="${build.dir}"
|
trace="true"
|
boring="true"
|
force="true"
|
sassdir="${build.dir}"
|
cssdir="${build.dir}/resources"
|
config="${build.all.ruby}"/>
|
|
|
<macrodef name="x-compress-css-files">
|
<attribute name="dir"/>
|
<attribute name="prefix"/>
|
<attribute name="outprefix"/>
|
<sequential>
|
<x-split-css file="@{dir}/@{prefix}.css"
|
outdir="${build.resources.dir}"
|
limit="${build.css.selector.limit}"/>
|
|
<for param="cssfile">
|
<fileset dir="@{dir}" includes="@{prefix}*.css"/>
|
<sequential>
|
<local name="css.output.name"/>
|
<local name="pattern"/>
|
<property name="pattern" value="(.*?)(@{prefix})(_\d{1,2})*\.css"/>
|
<propertyregex property="css.output.name"
|
input="@{cssfile}"
|
regexp="${pattern}"
|
select="\1@{outprefix}\3.css"
|
override="true"/>
|
<x-compress-css srcfile="@{cssfile}"
|
outfile="${css.output.name}"/>
|
</sequential>
|
</for>
|
</sequential>
|
</macrodef>
|
|
<x-compress-css-files
|
dir="${build.resources.dir}"
|
prefix="${build.all.css.debug.prefix}"
|
outprefix="${build.all.css.prefix}"/>
|
|
<x-compress-css-files
|
dir="${build.resources.dir}"
|
prefix="${build.all.rtl.css.debug.prefix}"
|
outprefix="${build.all.rtl.css.prefix}"/>
|
|
<antcall target="-after-sass"/>
|
</target>
|
|
<!--
|
Inherit Resources
|
-->
|
<target name="-before-inherit-resources"/>
|
<target name="-after-inherit-resources"/>
|
<target name="inherit-resources" depends="init" if="package.base.names"
|
description="Performs the resource folder inheritance from base theme(s)">
|
<antcall target="-before-inherit-resources"/>
|
|
<for list="${package.base.packages}" param="base">
|
<sequential>
|
<echo>Merging resources from base package @{base}</echo>
|
<local name="base.path"/>
|
<local name="base.resource.path"/>
|
<property name="base.path" location="@{base}"/>
|
<property name="base.resource.path" location="${base.path}/resources"/>
|
<if>
|
<available file="${base.resource.path}" type="dir"/>
|
<then>
|
<copy todir="${build.dir}/resources/" overwrite="true">
|
<fileset dir="${base.resource.path}" includes="**/*"/>
|
</copy>
|
</then>
|
</if>
|
</sequential>
|
</for>
|
|
<antcall target="-after-inherit-resources"/>
|
</target>
|
|
<!--
|
Slice
|
-->
|
<target name="-before-slice"/>
|
<target name="-after-slice"/>
|
<target name="slice" depends="init" if="package.resources.dir.exists" unless="skip.slice"
|
description="Slices CSS3 theme to produce non-CSS3 images and sprites">
|
<antcall target="-before-slice"/>
|
|
<copy todir="${build.dir}/example" overwrite="true">
|
<fileset dir="${package.dir}/sass/example" includes="**/*"/>
|
</copy>
|
|
<echo>Capture theme image to ${build.dir}/theme-capture.png</echo>
|
<x-sencha-command dir="${package.dir}">
|
${build.theme.capture.command}
|
</x-sencha-command>
|
|
<echo>Slicing theme images to ${build.resources.dir}</echo>
|
<x-sencha-command dir="${package.dir}">
|
${build.theme.slice.command}
|
</x-sencha-command>
|
|
<antcall target="-after-slice"/>
|
</target>
|
|
<!--
|
Copy Resources
|
-->
|
<target name="-before-copy-resources"/>
|
<target name="-after-copy-resources"/>
|
<target name="copy-resources" depends="init" if="package.resources.dir.exists"
|
description="Copy theme resources to folder">
|
<antcall target="-before-copy-resources"/>
|
|
<copy todir="${build.dir}/resources" overwrite="true">
|
<fileset dir="${package.resources.dir}" includes="**/*"/>
|
</copy>
|
|
<antcall target="-after-copy-resources"/>
|
</target>
|
|
<!--
|
Build JS
|
-->
|
<target name="-before-js"/>
|
<target name="-after-js"/>
|
<target name="js" depends="init" unless="skip.js"
|
description="Builds the JS files">
|
<antcall target="-before-js"/>
|
|
<!--run compile command to generate concatenated output files for js and scss-->
|
<x-sencha-command dir="${package.dir}">
|
${build.compile.command}
|
</x-sencha-command>
|
|
<antcall target="-after-js"/>
|
</target>
|
|
<!--
|
Build JS
|
-->
|
<target name="-before-pkg"/>
|
<target name="-after-pkg"/>
|
<target name="pkg" depends="init" unless="skip.pkg"
|
description="Builds the PKG file">
|
<antcall target="-before-pkg"/>
|
|
<x-make-pkg dir="${package.dir}"
|
files="${build.pkg.manifest}"
|
pkg="${pkg.build.dir}/${pkg.file.name}"
|
temp="${build.dir}/temp"
|
/>
|
|
<antcall target="-after-pkg"/>
|
</target>
|
|
<!--
|
Build
|
-->
|
<target name="-before-build"/>
|
<target name="-build"
|
depends="js,inherit-resources,copy-resources,sass,slice,pkg"/>
|
<target name="-after-build"/>
|
<target name="build"
|
depends="init,-before-build,-build,-after-build"
|
description="Builds the package"/>
|
|
<!--
|
environment setters
|
-->
|
|
<!--
|
Helpful targets
|
-->
|
<target name=".props" depends="init"
|
description="Lists all properties defined for the build">
|
<echoproperties/>
|
</target>
|
|
<target name=".help" depends="init"
|
description="Provides help on the build script">
|
|
<x-get-project-targets property="help.message"/>
|
|
<echo><![CDATA[${help.message}
|
This is the main build script for your package.
|
|
The following properties can be used to disable certain steps in the build
|
process.
|
|
* skip.pkg Do not build the PKG file
|
* skip.sass Do not build the SASS.
|
* skip.js Do not build the JS files.
|
|
For details about how these options affect your build, see
|
|
${basedir}/.sencha/package/build-impl.xml
|
|
These options can be stored in a local.properties file in this folder or in the
|
local.properties file in the workspace.
|
|
Alternatively, these can be supplied on the command line. For example:
|
|
sencha ant -Dskip.sass=1 build
|
|
To see all currently defined properties, do this:
|
|
sencha ant .props
|
]]></echo>
|
</target>
|
|
</project>
|