forked from CSSLint/csslint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
177 lines (149 loc) · 6.7 KB
/
build.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
<project name="csslint" default="all">
<!-- version number -->
<property name="csslint.version" value="0.5.0" />
<!-- the directories containing the source files -->
<property name="src.dir" value="./src" />
<property name="npm.dir" value="./npm" />
<property name="tests.dir" value="./tests" />
<!-- the directories and files to output to -->
<property name="build.dir" value="./build" />
<property name="release.dir" value="./release" />
<property name="build.npm.dir" value="${build.dir}/npm" />
<!-- the directory containing library files -->
<property name="lib.dir" value="./lib" />
<!-- library files -->
<property name="jshint.js" value="jshint.js" />
<property name="parserlib.js" value="parserlib.js" />
<property name="yuitest.js" value="yuitest.js" />
<!-- external resources -->
<property name="parser.url" value="https://raw.github.com/nzakas/parser-lib/master/build/parserlib.js"/>
<!-- output filenames -->
<property name="core.build.file" value="csslint.js"/>
<property name="node.build.file" value="csslint-node.js"/>
<property name="worker.build.file" value="csslint-worker.js"/>
<property name="tests.build.file" value="csslint-tests.js"/>
<property name="rhino.build.file" value="csslint-rhino.js"/>
<!-- embeddable license -->
<loadfile property="license.text" srcfile="LICENSE" />
<!-- get a timestamp -->
<tstamp>
<format property="RIGHT_NOW"
pattern="d-MMMM-yyyy hh:mm:ss"
locale="en,US"/>
</tstamp>
<!-- clean -->
<target name="clean">
<delete dir="${build.dir}" />
</target>
<!-- validate JS files with JSHint -->
<target name="lint">
<apply executable="java" parallel="false" failonerror="true">
<fileset dir="${src.dir}" includes="**/*.js" />
<arg line="-jar"/>
<arg path="${lib.dir}/js.jar"/>
<arg path="${lib.dir}/jshint.js" />
<srcfile/>
</apply>
</target>
<!-- build the core library -->
<target name="build.core">
<concat destfile="${build.dir}/${core.build.file}" fixlastline="true">
<header trimleading="yes">/*!
${license.text}
*/
/* Build time: ${RIGHT_NOW} */
var CSSLint = (function(){
</header>
<fileset dir="${lib.dir}" includes="${parserlib.js}" />
<filelist dir="${src.dir}/core" files="CSSLint.js" />
<fileset dir="${src.dir}/core" includes="*.js" excludes="CSSLint.js"/>
<fileset dir="${src.dir}/rules" includes="*.js" />
<fileset dir="${src.dir}/formatters" includes="*.js" />
<footer trimleading="yes">
return CSSLint;
})();
</footer>
</concat>
</target>
<!-- build the web worker library -->
<target name="build.worker">
<concat destfile="${build.dir}/${worker.build.file}" fixlastline="true">
<header trimleading="yes">/*!
${license.text}
*/
/* Build time: ${RIGHT_NOW} */
</header>
<fileset dir="${lib.dir}" includes="${parserlib.js}" />
<filelist dir="${src.dir}/core" files="CSSLint.js" />
<fileset dir="${src.dir}/core" includes="*.js" excludes="CSSLint.js"/>
<fileset dir="${src.dir}/rules" includes="*.js" />
<fileset dir="${src.dir}/formatters" includes="*.js" />
<fileset dir="${src.dir}/worker" includes="*.js" />
</concat>
</target>
<!-- build the Node.js package -->
<target name="build.node">
<concat destfile="${build.dir}/${node.build.file}" fixlastline="true">
<header trimleading="yes">/*!
${license.text}
*/
/* Build time: ${RIGHT_NOW} */
</header>
<fileset dir="${lib.dir}" includes="${parserlib.js}" />
<filelist dir="${src.dir}/core" files="CSSLint.js" />
<fileset dir="${src.dir}/core" includes="*.js" excludes="CSSLint.js"/>
<fileset dir="${src.dir}/rules" includes="*.js" />
<fileset dir="${src.dir}/formatters" includes="*.js" />
<footer trimleading="yes">
exports.CSSLint = CSSLint;
</footer>
</concat>
<mkdir dir="${build.npm.dir}"/>
<mkdir dir="${build.npm.dir}/lib"/>
<copy file="${npm.dir}/package.json" todir="${build.npm.dir}"/>
<concat destfile="${build.npm.dir}/cli.js" fixlastline="true">
<header trimleading="yes">#!/usr/bin/env node
/* Build time: ${RIGHT_NOW} */
</header>
<filelist dir="${src.dir}/cli" files="util.js,node.js" />
</concat>
<copy file="${build.dir}/${node.build.file}" todir="${build.npm.dir}/lib"/>
<!-- CRLF will cause Node version to break -->
<fixcrlf srcdir="${build.dir}" includes="**/*" eol="lf" />
</target>
<!-- build the tests into a single file -->
<target name="build.tests">
<concat destfile="${build.dir}/${tests.build.file}" fixlastline="true">
<fileset dir="${tests.dir}/" includes="**/*.js" />
</concat>
</target>
<!-- build for rhino CLI integration -->
<target name="build.rhino" depends="build.core">
<concat destfile="${build.dir}/${rhino.build.file}" fixlastline="true">
<filelist dir="${build.dir}" files="${core.build.file}" />
<filelist dir="${src.dir}/cli" files="util.js,rhino.js" />
</concat>
</target>
<!-- Create a release with version number embedded -->
<target name="release" depends="all">
<delete dir="${release.dir}" />
<mkdir dir="${release.dir}"/>
<copy todir="${release.dir}">
<fileset dir="${build.dir}" includes="**/*" />
</copy>
<replaceregexp match="@VERSION@" replace="${csslint.version}" flags="g" byline="true">
<fileset dir="${release.dir}" includes="**/*"/>
</replaceregexp>
</target>
<!-- Update CSS parser with the latest -->
<target name="update-parser">
<get src="${parser.url}" dest="${lib.dir}/" />
</target>
<!-- Update JSHint with the latest -->
<target name="update-jshint">
<get src="${jshint-rhino.url}" dest="${lib.dir}/" />
<get src="${jshint.url}" dest="${lib.dir}/" />
</target>
<!-- Build all files -->
<target name="all" depends="clean,build.core,build.worker,build.node,build.tests,build.rhino"/>
</project>