forked from yui/builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
targets.xml
192 lines (168 loc) · 8.97 KB
/
targets.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?xml version="1.0" encoding="UTF-8"?>
<project name="YuiSharedTargets">
<echo level="info">Starting Build For ${component}</echo>
<echo level="info">Ant Properties</echo>
<echo level="info"> Home : ${ant.home}</echo>
<echo level="info"> Ant Version : ${ant.version}</echo>
<echo level="info"> Build File : ${ant.file}</echo>
<echo level="info">Local Build Properties</echo>
<echo level="info"> version : ${yui.version}</echo>
<echo level="info"> srcdir : ${srcdir}</echo>
<echo level="info"> builddir : ${builddir}</echo>
<echo level="info"> component : ${component}</echo>
<echo level="info"> component.basefilename : ${component.basefilename}</echo>
<echo level="info"> component.basedir : ${component.basedir}</echo>
<echo level="info"> component.builddir : ${component.builddir}</echo>
<echo level="info">Global Build Properties</echo>
<echo level="info"> global.build.base : ${global.build.base}</echo>
<echo level="info"> global.build.component : ${global.build.component}</echo>
<echo level="info"> global.build.component.assets : ${global.build.component.assets}</echo>
<dirname property="targets.basedir" file="${ant.file.YuiSharedTargets}"/>
<import file="${targets.basedir}/macrolib.xml" description="Macrodef definitions - jslint, yuicompessor, registerversion" />
<target name="all" depends="local, deploy" description="Build and Deploy to Global Build Directory" />
<target name="local" depends="clean, init, build, minify, lint" description="Build and Deploy to Local Build Directory" />
<target name="init">
<tstamp/>
<mkdir dir="${component.builddir}" />
<createdetails />
<antcall target="-lint-server"/>
</target>
<target name="-lint-server" description="Start JSLint Server" unless="lint.skip">
<antcall target="-node">
<param name="src" value="${builddir}/lib/jslint/jslint-node.js"/>
</antcall>
</target>
<target name="-node" description="Start NodeJS Server" unless="node.spawn">
<if>
<not>
<http url="${node.jslint.url}"/>
</not>
<then>
<!-- You can't set failifexecutionfails if spawn is true. Argh. -->
<!-- Check if it's installed first. -->
<exec resultproperty="node.status" executable="node" failonerror="false" failifexecutionfails="false" searchpath="true" resolveexecutable="true">
<arg value="-v"/>
</exec>
<if>
<equals arg1="${node.status}" arg2="0"/>
<then>
<echo level="info">Spawning Node.js app at: ${src}</echo>
<exec executable="node" spawn="true" failonerror="false" searchpath="true" resolveexecutable="true">
<arg value="${src}"/>
</exec>
</then>
<else>
<echo level="info">For faster builds, install Node.js.</echo>
</else>
</if>
<!-- Don't fail if node doesn't exist, fails to start, etc.
We will fallback to the slow Rhino engine later. -->
</then>
</if>
<!-- Don't try to start again. -->
<property name="node.spawn" value="true"/>
</target>
<target name="clean" description="Clean Local Build Directory" unless="clean.skip">
<delete dir="${component.builddir}" />
</target>
<target name="build" />
<!-- MIN -->
<target name="minify" description="Create component-min.js from component.js">
<yuicompress src="${component.builddir}/${component.basefilename}.js" dest="${component.builddir}/${component.basefilename}-min.js" args="${yuicompressor.js.args.internal}" />
<if>
<available file="${component.builddir}/lang" type="dir" />
<then>
<for param="file">
<path>
<fileset dir="${component.builddir}/lang" includes="*.js"/>
</path>
<sequential>
<yuicompress src="@{file}" dest="@{file}" args="${yuicompressor.js.args.internal}" />
</sequential>
</for>
</then>
</if>
</target>
<target name="lint" description="Run jslint over the local build files (default settings)" unless="lint.skip">
<jslint>
<jsfiles>
<fileset dir="${component.builddir}" includes="*.js" />
</jsfiles>
</jslint>
</target>
<!-- DEPLOY -->
<target name="deploy" description="Copy files to global location" depends="deploybuild, deployassets, deployskins, deploylang, deploydocs"></target>
<target name="deploybuild" description="Copy built files to global build location">
<copy todir="${global.build.component}" overwrite="true" verbose="true">
<fileset dir="${component.builddir}" includes="*.js" />
</copy>
</target>
<target name="deployassets" if="component.assets.exist">
<copy todir="${global.build.component.assets}" flatten="${component.assets.flatten}" overwrite="true" verbose="true">
<fileset dir="${component.assets.base}" includes="${component.assets.files}" excludes="skins/, legacy/" />
</copy>
<copy todir="${global.build.component.assets}" flatten="${component.assets.legacy.flatten}" preservelastmodified="true" failonerror="false" verbose="true">
<fileset dir="${component.assets.legacy.base}" includes="${component.assets.legacy.files}" excludes="skins/" />
</copy>
</target>
<target name="deployskins" if="skins.exist">
<copy todir="${global.build.component.assets}/skins/sam" overwrite="true" verbose="true">
<fileset dir="${component.builddir}/assets/skins/sam" includes="${component}.css" />
</copy>
<copy todir="${global.build.component.assets}/skins/sam" overwrite="true" verbose="true">
<fileset dir="${component.assets.skins.base}/sam" includes="${component.assets.skins.files}" />
</copy>
</target>
<target name="deploylang" description="Copy language bundles to global build location">
<copy todir="${global.build.component}/lang" overwrite="true" failonerror="false" verbose="true">
<fileset dir="${component.builddir}/lang" includes="*.js" />
</copy>
</target>
<target name="deploydocs" description="Copy doc files to global doc locations">
<!-- TODO -->
</target>
<target name="-prepend" if="component.prependfiles">
<concat destfile="${workingdir}/${component.basefilename}.js.tmp" fixlastline="true">
<filelist dir="${component.basedir}" files="${component.prependfiles}" />
<filterchain>
<tokenfilter>
<filetokenizer/>
<replaceregex
pattern="${component.logger.regex}"
replace="${component.logger.regex.replace}"
flags="${component.logger.regex.flags}" />
</tokenfilter>
</filterchain>
</concat>
<concat destfile="${workingdir}/${component.basefilename}.js.tmp" fixlastline="true" append="true">
<filelist dir="${component.builddir}" files="${component.basefilename}.js" />
</concat>
<move file="${workingdir}/${component.basefilename}.js.tmp" tofile="${component.builddir}/${component.basefilename}.js" />
</target>
<target name="-append" if="component.appendfiles">
<concat destfile="${component.builddir}/${component.basefilename}.js" fixlastline="true" append="true">
<filelist dir="${component.basedir}" files="${component.appendfiles}" />
<filterchain>
<tokenfilter>
<filetokenizer/>
<replaceregex
pattern="${component.logger.regex}"
replace="${component.logger.regex.replace}"
flags="${component.logger.regex.flags}" />
</tokenfilter>
</filterchain>
</concat>
</target>
<target name="-prependdebug" if="component.prependfiles">
<concat destfile="${workingdir}/${component.basefilename}-debug.js.tmp" fixlastline="true" >
<filelist dir="${component.basedir}" files="${component.prependfiles}" />
<filelist dir="${component.builddir}" files="${component.basefilename}-debug.js" />
</concat>
<move file="${workingdir}/${component.basefilename}-debug.js.tmp" tofile="${component.builddir}/${component.basefilename}-debug.js" />
</target>
<target name="-appenddebug" if="component.appendfiles">
<concat destfile="${component.builddir}/${component.basefilename}-debug.js" fixlastline="true" append="true">
<filelist dir="${component.basedir}" files="${component.appendfiles}" />
</concat>
</target>
</project>