-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.xml
More file actions
203 lines (184 loc) · 7.41 KB
/
build.xml
File metadata and controls
203 lines (184 loc) · 7.41 KB
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<!--
Copyright 2009 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="compiler" basedir="." default="jar">
<!-- define other variables -->
<property name="src.dir" value="${basedir}/src" />
<property name="gen.dir" value="${basedir}/gen" />
<property name="test.dir" value="${basedir}/test" />
<property name="externs.dir" value="${basedir}/externs" />
<property name="build.dir" value="${basedir}/build" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="testClasses.dir" value="${build.dir}/test" />
<property name="javadoc.dir" value="${build.dir}/javadoc" />
<property name="stylesheetfile" value="" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="tools.dir" value="${basedir}/tools" />
<property name="jarfile" value="${build.dir}/${ant.project.name}.jar" />
<property name="num-fuzz-tests" value="10000"/>
<!-- set the classpath for the project -->
<!-- this includes the generated source class files -->
<!-- and every jar in the /lib directory -->
<path id="classpath.path">
<pathelement location="${classes.dir}" />
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<target name="clean" description="delete generated files">
<delete dir="${build.dir}" />
</target>
<target name="compile" description="compile the source code">
<mkdir dir="${classes.dir}" />
<javac srcdir="${gen.dir}"
destdir="${classes.dir}"
excludes=".svn">
<classpath refid="classpath.path" />
</javac>
<javac srcdir="${src.dir}"
destdir="${classes.dir}"
excludes=".svn">
<classpath refid="classpath.path" />
</javac>
<!-- Move Messages.properties where ScriptRuntime.java expects it. -->
<mkdir dir="${classes.dir}/rhino_ast/java/com/google/javascript/rhino/" />
<copy file="${src.dir}/com/google/javascript/rhino/Messages.properties"
todir="${classes.dir}/rhino_ast/java/com/google/javascript/rhino/" />
<!-- Move ParserConfig.properties where ParserRunner.java expects it. -->
<copy file="${src.dir}/com/google/javascript/jscomp/parsing/ParserConfig.properties"
todir="${classes.dir}/com/google/javascript/jscomp/parsing" />
<!-- Move runtime_type_check.js where RuntimeTypeCheck.java expects it. -->
<mkdir dir="${classes.dir}/com/google/javascript/jscomp/js" />
<copy file="${src.dir}/com/google/javascript/jscomp/js/runtime_type_check.js"
todir="${classes.dir}/com/google/javascript/jscomp/js" />
</target>
<target name="jar"
depends="compile"
description="package compiler as an executable jar">
<zip destfile="${build.dir}/externs.zip" basedir="${externs.dir}" />
<jar destfile="${jarfile}" update="true">
<zipfileset src="${lib.dir}/args4j_deploy.jar" />
<zipfileset src="${lib.dir}/google_common_deploy.jar" />
<zipfileset src="${lib.dir}/protobuf_deploy.jar" />
<zipfileset src="${lib.dir}/libtrunk_rhino_parser_jarjared.jar" />
<fileset dir="${classes.dir}" />
<fileset dir="${build.dir}" includes="externs.zip" />
<manifest>
<attribute name="Main-Class"
value="com.google.javascript.jscomp.CommandLineRunner" />
</manifest>
</jar>
</target>
<target name="compile-tests"
depends="compile"
description="compile the JUnit tests">
<mkdir dir="${testClasses.dir}" />
<javac srcdir="${test.dir}"
destdir="${testClasses.dir}"
excludes=".svn">
<classpath refid="classpath.path" />
</javac>
</target>
<target name="all-classes-jar"
depends="compile,compile-tests"
description="package the compiler and its tests into one jar">
<jar destfile="${jarfile}" update="true">
<zipfileset src="${lib.dir}/ant_deploy.jar" />
<zipfileset src="${lib.dir}/args4j_deploy.jar" />
<zipfileset src="${lib.dir}/junit.jar" />
<zipfileset src="${lib.dir}/hamcrest-core-1.1.jar" />
<zipfileset src="${lib.dir}/google_common_deploy.jar" />
<zipfileset src="${lib.dir}/protobuf_deploy.jar" />
<zipfileset src="${lib.dir}/libtrunk_rhino_parser_jarjared.jar" />
<fileset dir="${classes.dir}" />
<fileset dir="${testClasses.dir}" />
</jar>
</target>
<target name="test-forkless"
depends="compile-tests"
description="execute JUnit tests without forking the process">
<junit>
<classpath refid="classpath.path" />
<classpath>
<pathelement location="${build.dir}/test" />
</classpath>
<formatter type="plain" usefile="false" />
<batchtest>
<fileset dir="${build.dir}/test">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</target>
<target name="test"
depends="compile-tests"
description="compile and execute JUnit tests">
<junit printsummary="on" fork="true" forkmode="once" showoutput="true">
<classpath refid="classpath.path" />
<classpath>
<pathelement location="${build.dir}/test" />
</classpath>
<formatter type="plain" usefile="false" />
<batchtest>
<fileset dir="${build.dir}/test">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</target>
<target name="fuzz-test"
depends="all-classes-jar"
description="checks the compiler against a variety of js programs">
<exec executable="java" failonerror="true">
<arg value="-cp" />
<arg value="${jarfile}" />
<arg value="com.google.javascript.jscomp.regtests.CompileEachLineOfProgramOutput" />
<arg value="generatejs"/>
<arg value="--stdout"/>
<arg value="${num-fuzz-tests}"/>
</exec>
</target>
<target name="javadoc"
description="generate Javadoc">
<mkdir dir="${javadoc.dir}" />
<javadoc
destdir="${javadoc.dir}"
author="false"
protected="true"
windowtitle="Compiler"
additionalparam=" -notimestamp "
stylesheetfile="${stylesheetfile}">
<sourcepath>
<pathelement location="${src.dir}" />
<pathelement location="${gen.dir}" />
</sourcepath>
<classpath refid="classpath.path" />
<link href="http://java.sun.com/javase/6/docs/api/" />
<bottom><![CDATA[
<div id="footer">
<div id="footerlogo">
<img src="http://www.google.com/images/art.gif"
alt="Google colored balls">
</div>
<div id="copyright">
<p>© 2009 Google -
<a href="http://www.google.com/privacy.html">Privacy Policy</a> -
<a href="http://www.google.com/terms_of_service.html">Terms and Conditions</a> -
<a href="http://www.google.com/about.html">About Google</a>
</p>
</div>
</div>
]]>
</bottom>
</javadoc>
</target>
</project>