forked from Fabrik/fabrik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_js.xml
136 lines (128 loc) · 4.75 KB
/
build_js.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
<?xml version="1.0" encoding="UTF-8"?>
<project name="fabrik_js" default="build_js">
<!--Build -->
<target name="js" description="lints and builds js project files for production use"
depends="load.properties">
<antcall target="js.lint"></antcall>
<antcall target="js.minify"></antcall>
</target>
<target name="load.properties" description="Set properties for this build">
<echo>load properties</echo>
<!--YUI Compressor location -->
<property name="yui.dir"
value="${basedir}/fabrik_build/yuicompressor/build/yuicompressor-2.4.6.jar" />
<!--Source JS dir -->
<property name="src.js.dir" value="${basedir}/media/com_fabrik/js" />
<!--Source CSS dir -->
<property name="src.css.dir" value="${basedir}/media/com_fabrik/css" />
<!--Source Lint/Hint dir -->
<property name="jslint.js" value="${basedir}/fabrik_build/lint/jshint.js" />
<!--Rhino dir -->
<property name="js.jar" value="${basedir}/fabrik_build/lint/rhino/js.jar" />
<!-- Rhino lint -->
<property name="jshint-rhino.js" value="${basedir}/fabrik_build/lint/jshint-rhino.js" />
<!--Output dir -->
<property name="build.dir" value="${basedir}/media/com_fabrik/" />
<!--Build version information -->
<property name="build.major" value="1" />
<property name="build.minor" value="1" />
<property name="jshint.flags"
value="browser=true,mootools=true,white=true,loopfunc=true,expr=true,evil=true,boss=true,maxerr=25,undef=false,curly=true,debug=false,eqeqeq=true,immed=true,newcap=true" />
<property name="jshint.predef"
value="console,confirm" />
<property name="jshint.predef.test"
value="${jshint.predef},icon" />
</target>
<!--JS Lint -->
<target name="js.lint">
<antcall target="js.lint.do">
<param name="dir" value="${basedir}/administrator/components/com_fabrik/" />
</antcall>
<antcall target="js.lint.do">
<param name="dir" value="${src.js.dir}" />
</antcall>
<antcall target="js.lint.do">
<param name="dir" value="${basedir}/plugins/fabrik_cron/" />
</antcall>
<antcall target="js.lint.do">
<param name="dir" value="${basedir}/plugins/fabrik_element/" />
</antcall>
<antcall target="js.lint.do">
<param name="dir" value="${basedir}/plugins/fabrik_form/" />
</antcall>
<antcall target="js.lint.do">
<param name="dir" value="${basedir}/plugins/fabrik_list/" />
</antcall>
<antcall target="js.lint.do">
<param name="dir" value="${basedir}/plugins/fabrik_validationrule/" />
</antcall>
<antcall target="js.lint.do">
<param name="dir" value="${basedir}/plugins/fabrik_visualization/" />
</antcall>
</target>
<target name="js.lint.do">
<echo>dir = ${dir}</echo>
<apply dir="${basedir}/fabrik_build/lint" failonerror="true" executable="java" errorproperty="linterror" resultproperty="lintresult">
<fileset dir="${dir}">
<include name="**/*.js" />
<exclude name="**/lib/" />
<exclude name="**/*-min.js" />
<exclude name="**/libs/" />
<exclude name="**/swatches/" />
</fileset>
<arg line="-jar ${js.jar} ${jshint-rhino.js}" />
<srcfile />
<arg value="${jshint.flags}" />
<arg value="${jshint.predef}" />
</apply>
<echo>lint error: ${linterror}</echo>
<echo>lint result: ${lintresult}</echo>
<!-- 0 is no errors - > 0 is an erorr count -->
<echo>${dir} JSHint Passed</echo>
</target>
<target name="js.minify">
<antcall target="js.minify.do">
<param name="dir" value="${basedir}/administrator/components/com_fabrik/" />
</antcall>
<antcall target="js.minify.do">
<param name="dir" value="${src.js.dir}" />
</antcall>
<antcall target="js.minify.do">
<param name="dir" value="${basedir}/plugins/fabrik_cron/" />
</antcall>
<antcall target="js.minify.do">
<param name="dir" value="${basedir}/plugins/fabrik_element/" />
</antcall>
<antcall target="js.minify.do">
<param name="dir" value="${basedir}/plugins/fabrik_form/" />
</antcall>
<antcall target="js.minify.do">
<param name="dir" value="${basedir}/plugins/fabrik_list/" />
</antcall>
<antcall target="js.minify.do">
<param name="dir" value="${basedir}/plugins/fabrik_validationrule/" />
</antcall>
<antcall target="js.minify.do">
<param name="dir" value="${basedir}/plugins/fabrik_visualization/" />
</antcall>
</target>
<!--Minify JS files -->
<target name="js.minify.do" description="Minifies JavaScript files">
<echo>${dir}</echo>
<apply executable="java" parallel="false" dest="${dir}" failonerror="true" >
<fileset dir="${dir}">
<include name="**/*.js" />
<exclude name="**/lib/" />
<exclude name="**/*-min.js" />
<exclude name="**/swatches/" />
</fileset>
<arg line="-jar" />
<arg path="${yui.dir}" />
<srcfile />
<arg line="-o" />
<mapper type="glob" from="*.js" to="*-min.js" />
<targetfile />
</apply>
<echo>Finished</echo>
</target>
</project>