forked from Fabrik/fabrik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_one_js.xml
85 lines (77 loc) · 3.03 KB
/
build_one_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
<?xml version="1.0" encoding="UTF-8"?>
<project name="fabrik_js" default="build_js">
<!--Build -->
<target name="build_js" description="lints and builds js project files for production use"
depends="load.properties">
<antcall target="js.lint"></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">
<input message="JS Dir?" addproperty="dir" defaultvalue="media/com_fabrik/js/" />
<input message="JS file?" addproperty="jsfile" defaultvalue="media/com_fabrik/js/list.js" />
<antcall target="js.lint.do">
<param name="file" value="${jsfile}" />
</antcall>
<antcall target="js.minify.do">
<param name="file" value="${jsfile}" />
<param name="dir" value="${dir}" />
</antcall>
</target>
<target name="js.lint.do">
<echo>file = ${file}</echo>
<apply dir="${basedir}/fabrik_build/lint" failonerror="true" executable="java" errorproperty="linterror" resultproperty="lintresult">
<fileset file="${file}">
</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>${file} JSHint Passed</echo>
</target>
<!--Minify JS files -->
<target name="js.minify.do" description="Minifies JavaScript files">
<echo>file = ${file}</echo>
<apply executable="java" parallel="false" dest="${dir}" failonerror="true" >
<fileset file="${file}">
</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>