This repository has been archived by the owner on Jan 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
/
module.xml
132 lines (110 loc) · 7.14 KB
/
module.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
<?xml version="1.0" encoding="UTF-8"?>
<project name="YuiModuleTargets">
<dirname property="module.basedir" file="${ant.file.YuiModuleTargets}"/>
<import file="${module.basedir}/../shared/targets.xml" description="Targets common to Rollup/Module" />
<target name="build" depends="buildcore, -rollupjs, buildskins, buildlangs" />
<target name="buildskins" depends="-buildskins, -rollupcss" />
<target name="buildlangs" depends="-buildlangs, -rolluplangs" />
<!-- CORE -->
<target name="buildcore" depends="builddebug, -createcore, -loggerregex" description="Create component.js">
<fixcrlf srcdir="${component.builddir}" includes="${component.basefilename}.js" eol="${buildfiles.eol}" />
</target>
<target name="-createcore">
<copy file="${component.builddir}/${component.basefilename}-debug.js" tofile="${component.builddir}/${component.basefilename}.js" />
</target>
<target name="-loggerregex" description="Replace logger statements" unless="component.logger.regex.skip">
<echo level="info">Replacing Logger Statements in ${component.builddir}/${component.basefilename}.js</echo>
<replaceregexp file="${component.builddir}/${component.basefilename}.js"
byline="${component.logger.regex.byline}"
match="${component.logger.regex}"
replace="${component.logger.regex.replace}"
flags="${component.logger.regex.flags}" />
</target>
<!-- DEBUG -->
<target name="builddebug" depends="-concatdebug, -registerdebug, -prependdebug, -appenddebug" description="Create component-debug.js">
<fixcrlf srcdir="${component.builddir}" includes="${component.basefilename}-debug.js" eol="${buildfiles.eol}" />
</target>
<target name="-concatdebug">
<concatsource destfile="${component.builddir}/${component.basefilename}-debug.js" sourcedir="${component.jsfiles.base}" sourcefiles="${component.jsfiles}" />
</target>
<target name="-registerdebug" unless="register.skip">
<addmodule module="${component.module}" file="${component.builddir}/${component.basefilename}-debug.js" details="${component.details.hash}" />
</target>
<target name="-rollupjs" if="rollup">
<if>
<isset property="rollup.sub"/>
<then>
<echo level="info">Module: Build a rollup of a rollup; moving rollup.sub properties into rollup properties.</echo>
<var name="rollup.builddir" unset="true"/>
<var name="rollup.component" unset="true"/>
<var name="rollup.component.basefilename" unset="true"/>
<propertycopy name="rollup.builddir" from="rollup.sub.builddir"/>
<propertycopy name="rollup.component" from="rollup.sub.component"/>
<propertycopy name="rollup.component.basefilename" from="rollup.sub.component.basefilename"/>
</then>
</if>
<echo level="info">Module: Rolling up ${component.basefilename}-debug.js into ${rollup.component.basefilename}-debug.js</echo>
<concat destfile="${rollup.builddir}/${rollup.component.basefilename}.js" append="true" fixlastline="true">
<filelist dir="${component.builddir}" files="${component.basefilename}.js" />
</concat>
<concat destfile="${rollup.builddir}/${rollup.component.basefilename}-debug.js" append="true" fixlastline="true">
<filelist dir="${component.builddir}" files="${component.basefilename}-debug.js" />
</concat>
</target>
<!-- SKINS -->
<target name="-buildskins" depends="-concatskins" description="Create skin rollup in local component build directory" if="component.skins.exist">
<fixcrlf srcdir="${component.builddir}/assets/skins/sam" includes="${component}.css" eol="${buildfiles.eol}" />
</target>
<target name="-buildlangs" description="Create language packs in the local component build directory" if="component.langs.exist">
<mkdir dir="${component.builddir}/lang" />
<for list="${component.lang}" param="lang" trim="true">
<sequential>
<addlang dir="${component.lang.base}" module="${component}" lang="@{lang}" dest="${component.builddir}/lang" />
</sequential>
</for>
<addlang dir="${component.lang.base}" module="${component}" lang="" dest="${component.builddir}/lang/" />
</target>
<target name="-rolluplangs" if="rolluplangs">
<for list="${component.lang}" param="lang" trim="true">
<sequential>
<concat destfile="${rollup.builddir}/lang/${rollup.component}_@{lang}.js" append="true" fixlastline="true">
<fileset dir="${component.builddir}/lang" includes="*_@{lang}.js" />
</concat>
</sequential>
</for>
<concat destfile="${rollup.builddir}/lang/${rollup.component}.js" append="true" fixlastline="true">
<filelist dir="${component.builddir}/lang" files="${component}.js" />
</concat>
</target>
<target name="-concatskins" if="component.skins.exist">
<concatsource destfile="${component.builddir}/assets/skins/sam/${component}.css" sourcedir="${component.assets.base}" sourcefiles="${component}-core.css, skins/sam/${component}-skin.css" />
<yuicompress type="css" src="${component.builddir}/assets/skins/sam/${component}.css" dest="${component.builddir}/assets/skins/sam/${component}.css" args="${yuicompressor.css.args.internal}" />
</target>
<target name="-rollupcss" if="rollupskins">
<echo level="info">Rolling up ${component}.css into ${rollup.component}.css</echo>
<concat destfile="${rollup.builddir}/assets/skins/sam/${rollup.component}.css" append="true" fixlastline="true">
<filelist dir="${component.builddir}/assets/skins/sam" files="${component}.css" />
</concat>
</target>
<!-- Tests -->
<target name="tests" depends="-lint-server">
<echo level="info">Generating test module for ${component}</echo>
<echo level="info"> Test module: ${tests.component}</echo>
<echo level="info"> Test module source directory: ${tests.srcdir}</echo>
<echo level="info"> Test module source files: ${tests.jsfiles}</echo>
<echo level="info"> Test module output directory: ${tests.builddir}</echo>
<echo level="info"> Test module file: ${tests.builddir}/${tests.component}.js</echo>
<echo level="info"> </echo>
<available file="${tests.srcdir}" type="dir" property="tests.srcdir.exists"/>
<var name="buildfile" value="${tests.builddir}/${tests.component}.js"/>
<arrayliteral from="tests.requires" to="tests.details.requires" key="requires"/>
<concatsource destfile="${buildfile}" sourcedir="${tests.srcdir}" sourcefiles="${tests.jsfiles}"/>
<addmodule file="${buildfile}" module="${tests.component}" details="{${tests.details.requires}}"/>
<jslint>
<jsfiles>
<fileset file="${buildfile}"/>
</jsfiles>
</jslint>
<echo level="info">Test module ${tests.component} created</echo>
</target>
</project>