|
1 | 1 | <project name="parserlib" default="build.all">
|
2 | 2 |
|
3 | 3 | <!-- version number -->
|
4 |
| - <property name="parserlib.version" value="0.1.9" /> |
| 4 | + <property name="parserlib.version" value="0.2.0" /> |
5 | 5 |
|
6 | 6 | <!-- the directories containing the source files -->
|
7 | 7 | <property name="src.dir" value="./src" />
|
8 | 8 | <property name="tests.dir" value="./tests" />
|
9 | 9 | <property name="npm.dir" value="./npm" />
|
10 |
| - |
| 10 | + |
11 | 11 | <!-- the directories and files to output to -->
|
12 | 12 | <property name="lib.dir" value="./lib" />
|
13 |
| - |
| 13 | + |
14 | 14 | <!-- the directories and files to output to -->
|
15 | 15 | <property name="build.dir" value="./build" />
|
16 | 16 | <property name="release.dir" value="./release" />
|
17 | 17 | <property name="build.npm.dir" value="${build.dir}/npm" />
|
18 |
| - |
| 18 | + |
19 | 19 | <!-- output filenames -->
|
20 | 20 | <property name="full.build.file" value="parserlib.js"/>
|
21 | 21 | <property name="core.build.file" value="parserlib-core.js"/>
|
22 | 22 | <property name="css.build.file" value="parserlib-css.js"/>
|
23 | 23 | <property name="tests.build.file" value="parserlib-tests.js"/>
|
24 | 24 | <property name="node.build.file" value="node-parserlib.js"/>
|
25 |
| - |
| 25 | + |
26 | 26 | <!-- license information -->
|
27 | 27 | <loadfile property="license.text" srcfile="LICENSE" />
|
28 |
| - |
| 28 | + |
29 | 29 | <tstamp>
|
30 | 30 | <format property="RIGHT_NOW"
|
31 | 31 | pattern="d-MMMM-yyyy hh:mm:ss"
|
|
35 | 35 | <format property="SIMPLE_DATE"
|
36 | 36 | pattern="MMMM d, yyyy"
|
37 | 37 | locale="en,US"/>
|
38 |
| - </tstamp> |
39 |
| - |
| 38 | + </tstamp> |
| 39 | + |
40 | 40 | <!-- clean -->
|
41 | 41 | <target name="clean">
|
42 | 42 | <delete dir="${build.dir}" />
|
43 | 43 | </target>
|
44 |
| - |
| 44 | + |
45 | 45 | <target name="changelog.update">
|
46 | 46 | <exec executable="git" failonerror="true" outputproperty="git.tag">
|
47 | 47 | <arg line="tag"/>
|
48 |
| - </exec> |
| 48 | + </exec> |
49 | 49 | <script language="javascript"><![CDATA[
|
50 | 50 | //get the most recent tag to get the diff
|
51 | 51 | var tags = parserlib.getProperty("git.tag").replace("\r", "").split("\n"),
|
52 | 52 | lastTag = tags[tags.length-1];
|
53 | 53 | parserlib.setProperty("git.log.range", lastTag + "..HEAD");
|
54 | 54 | ]]></script>
|
55 |
| - |
| 55 | + |
56 | 56 | <!-- git log -pretty=format:'* %s (%an)' v0.4.0..v0.5.0-->
|
57 | 57 | <exec executable="git" failonerror="true" outputproperty="git.changelog">
|
58 | 58 | <arg line="log --pretty=format:'* %s (%an)' ${git.log.range}"/>
|
59 |
| - </exec> |
60 |
| - |
| 59 | + </exec> |
| 60 | + |
61 | 61 | <concat destfile="CHANGELOG.tmp" fixlastline="true">
|
62 | 62 | <header trimleading="yes">${SIMPLE_DATE} - v${parserlib.version}
|
63 |
| - |
| 63 | + |
64 | 64 | ${git.changelog}
|
65 |
| - |
| 65 | + |
66 | 66 | </header>
|
67 | 67 | <fileset dir="." includes="CHANGELOG" />
|
68 | 68 | </concat>
|
69 |
| - |
| 69 | + |
70 | 70 | <delete file="CHANGELOG"/>
|
71 | 71 | <move file="CHANGELOG.tmp" tofile="CHANGELOG"/>
|
72 |
| - |
| 72 | + |
73 | 73 | </target>
|
74 |
| - |
| 74 | + |
75 | 75 | <!-- validate JS files with JSHint -->
|
76 |
| - <target name="lint"> |
| 76 | + <target name="lint"> |
77 | 77 | <fileset dir="${src.dir}" includes="**/*.js" id="jsfiles.raw"/>
|
78 | 78 | <pathconvert pathsep=" " property="jsfiles.clean" refid="jsfiles.raw" />
|
79 | 79 | <exec executable="java" failonerror="true">
|
80 | 80 | <arg line="-jar"/>
|
81 | 81 | <arg path="${lib.dir}/js.jar"/>
|
82 |
| - <arg path="${lib.dir}/jshint.js" /> |
| 82 | + <arg path="${lib.dir}/jshint.js" /> |
83 | 83 | <arg line="${jsfiles.clean} curly=true,forin=true,latedef=true,evil=true,loopfunc=true,undef=true,rhino=false" />
|
84 |
| - </exec> |
85 |
| - </target> |
86 |
| - |
| 84 | + </exec> |
| 85 | + </target> |
| 86 | + |
87 | 87 | <!-- run tests on the command line -->
|
88 |
| - <target name="test" depends="lint,build.all"> |
| 88 | + <target name="test" depends="lint,build.all"> |
89 | 89 | <apply executable="java" failonerror="true">
|
90 | 90 | <fileset dir="${tests.dir}" includes="**/*.js"/>
|
91 | 91 | <arg line="-jar"/>
|
92 | 92 | <arg path="${lib.dir}/js.jar"/>
|
93 | 93 | <arg path="${lib.dir}/yuitest-rhino-cli.js" />
|
94 | 94 | <arg path="${build.dir}/${full.build.file}" />
|
95 | 95 | <srcfile/>
|
96 |
| - </apply> |
97 |
| - </target> |
98 |
| - |
| 96 | + </apply> |
| 97 | + </target> |
| 98 | + |
99 | 99 | <!-- build the full library -->
|
100 | 100 | <target name="build.full" depends="build.core,build.css">
|
101 | 101 | <concat destfile="${build.dir}/${full.build.file}" fixlastline="true">
|
102 | 102 | <filelist dir="${build.dir}" files="${core.build.file}, ${css.build.file}"/>
|
103 |
| - </concat> |
| 103 | + </concat> |
104 | 104 | </target>
|
105 |
| - |
| 105 | + |
106 | 106 | <!-- build the core library -->
|
107 | 107 | <target name="build.core">
|
108 |
| - |
| 108 | + |
109 | 109 | <concat destfile="${build.dir}/${core.build.file}" fixlastline="true">
|
110 | 110 | <header trimleading="yes">/*!
|
111 | 111 | ${license.text}
|
|
127 | 127 | })();
|
128 | 128 | </footer>
|
129 | 129 | </concat>
|
130 |
| - |
| 130 | + |
131 | 131 | </target>
|
132 |
| - |
| 132 | + |
133 | 133 | <!-- build the CSS library -->
|
134 | 134 | <target name="build.css">
|
135 | 135 | <concat destfile="${build.dir}/${css.build.file}" fixlastline="true">
|
136 |
| - <header trimleading="yes">/* |
| 136 | + <header trimleading="yes">/* |
137 | 137 | ${license.text}
|
138 | 138 | */
|
139 | 139 | /* Version v@VERSION@, Build time: ${RIGHT_NOW} */
|
|
143 | 143 | StringReader = parserlib.util.StringReader,
|
144 | 144 | SyntaxError = parserlib.util.SyntaxError,
|
145 | 145 | SyntaxUnit = parserlib.util.SyntaxUnit;
|
146 |
| - </header> |
| 146 | + </header> |
147 | 147 | <!--<filelist dir="${src.dir}/css" files="CSSTokens.js, CSSSelectorUnit.js, CSSColors.js, CSSValueUnit.js, CSSParser.js"/>-->
|
148 | 148 | <fileset dir="${src.dir}/css" includes="*.js" />
|
149 | 149 | <footer trimleading="yes">
|
150 | 150 | parserlib.css = {
|
151 |
| - Colors :Colors, |
152 |
| - Combinator :Combinator, |
| 151 | + Colors :Colors, |
| 152 | + Combinator :Combinator, |
153 | 153 | Parser :Parser,
|
154 | 154 | PropertyName :PropertyName,
|
155 | 155 | PropertyValue :PropertyValue,
|
|
168 | 168 | </footer>
|
169 | 169 |
|
170 | 170 | </concat>
|
171 |
| - |
| 171 | + |
172 | 172 | </target>
|
173 |
| - |
| 173 | + |
174 | 174 | <!-- build the Node.js package -->
|
175 | 175 | <target name="build.node">
|
176 |
| - |
| 176 | + |
177 | 177 | <concat destfile="${build.dir}/${node.build.file}" fixlastline="true">
|
178 | 178 | <filelist dir="${build.dir}" files="${core.build.file}, ${css.build.file}"/>
|
179 | 179 | <footer trimleading="yes">
|
180 | 180 | (function(){
|
181 | 181 | for(var prop in parserlib){
|
182 |
| - exports[prop] = parserlib[prop]; |
| 182 | + exports[prop] = parserlib[prop]; |
183 | 183 | }
|
184 | 184 | })();
|
185 | 185 | </footer>
|
186 | 186 | </concat>
|
187 |
| - |
| 187 | + |
188 | 188 | <mkdir dir="${build.npm.dir}"/>
|
189 | 189 | <mkdir dir="${build.npm.dir}/lib"/>
|
190 | 190 | <copy file="${npm.dir}/package.json" todir="${build.npm.dir}"/>
|
191 | 191 | <copy file="${build.dir}/${node.build.file}" todir="${build.npm.dir}/lib"/>
|
192 |
| - |
| 192 | + |
193 | 193 | <!-- CRLF will cause Node version to break -->
|
194 | 194 | <fixcrlf srcdir="${build.dir}" includes="**/*" eol="lf" />
|
195 |
| - </target> |
196 |
| - |
| 195 | + </target> |
| 196 | + |
197 | 197 | <!-- build the tests into a single file -->
|
198 |
| - <target name="build.tests"> |
| 198 | + <target name="build.tests"> |
199 | 199 | <concat destfile="${build.dir}/${tests.build.file}" fixlastline="true">
|
200 |
| - <fileset dir="${tests.dir}/" includes="**/*.js" /> |
201 |
| - </concat> |
202 |
| - </target> |
203 |
| - |
| 200 | + <fileset dir="${tests.dir}/" includes="**/*.js" /> |
| 201 | + </concat> |
| 202 | + </target> |
| 203 | + |
204 | 204 | <!-- Create a release with version number embedded -->
|
205 | 205 | <target name="release" depends="test,build.all,changelog.update">
|
206 | 206 | <delete dir="${release.dir}" />
|
|
210 | 210 | </copy>
|
211 | 211 | <replaceregexp match="@VERSION@" replace="${parserlib.version}" flags="g" byline="true">
|
212 | 212 | <fileset dir="${release.dir}" includes="**/*"/>
|
213 |
| - </replaceregexp> |
214 |
| - </target> |
215 |
| - |
| 213 | + </replaceregexp> |
| 214 | + </target> |
| 215 | + |
216 | 216 | <!-- Build all files -->
|
217 | 217 | <target name="build.all" depends="build.full,build.node,build.tests"/>
|
218 | 218 |
|
|
0 commit comments