This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
mirrored from https://chromium.googlesource.com/chromium/dom-distiller
-
Notifications
You must be signed in to change notification settings - Fork 82
/
build.xml
299 lines (259 loc) · 10.5 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
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2014 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<project name="DomDistiller" default="build" basedir=".">
<property environment="env"/>
<!-- Arguments to gwtc and devmode targets -->
<property name="gwt.args" value="-XclosureCompiler -XnoclassMetadata -XnocheckCasts -style OBF" />
<property
name="gwt.test.args"
value="
-XnoclosureCompiler -optimize 0 -draftCompile
-style DETAILED
-saveSource -saveSourceOutput out/debug
-XmethodNameDisplayMode ABBREVIATED
"/>
<property name="gwt.shared.args" value="-failOnError -war war -XjsInteropMode JS -gen out/gen" />
<property name="gwt.custom.args" value="" />
<!-- Configure path to GWT SDK -->
<property name="gwt.sdk" location="third_party/gwt-2.7.0" />
<property name="test.filter" value="*" />
<property name="test.repeat" value="1" />
<property name="test.debug_level" value="0" />
<property name="test.shuffle" value="0" />
<property name="test.no_sandbox" value="0" />
<condition property="isLinux">
<and>
<os family="unix" />
<not>
<os family="mac" />
</not>
</and>
</condition>
<condition property="isMac">
<os family="mac" />
</condition>
<path id="project.class.path">
<pathelement location="war/WEB-INF/classes"/>
<pathelement location="${gwt.sdk}/gwt-user.jar"/>
<fileset dir="${gwt.sdk}" includes="gwt-dev*.jar"/>
<pathelement location="" />
</path>
<target name="setup">
<mkdir dir="out"/>
<mkdir dir="out/gen"/>
<mkdir dir="out/debug"/>
</target>
<path id="project.java.path">
<pathelement location="java"/>
</path>
<path id="project.java.test.path">
<pathelement location="test" />
<pathelement location="war/WEB-INF/test/classes"/>
</path>
<path id="project.java.jstest.path">
<pathelement location="javatests" />
<pathelement location="war/WEB-INF/jstest/classes"/>
</path>
<path id="protoc.java.output">
<pathelement location="out/proto/java" />
</path>
<path id="protoc.test.java.output">
<pathelement location="out/test/proto" />
</path>
<target name="protoc.plugin.base"
description="Generate proto stuff needed for the gwt_overlay plugin">
<mkdir dir="out/proto/python" />
<exec executable="protoc" failonerror="true">
<arg value="--python_out=out/proto/python"/>
<arg value="--proto_path=third_party/protobuf"/>
<arg value="third_party/protobuf/google/protobuf/compiler/plugin.proto"/>
</exec>
</target>
<target name="protoc" depends="protoc.plugin.base"
description="Generate JavascriptObject proto classes">
<mkdir dir="out/proto/java" />
<apply executable="protoc" failonerror="true" relative="true">
<arg value="--plugin=protoc-gen-gwt_overlay=protoc_plugins/gwt_overlay.py"/>
<arg value="--gwt_overlay_out=out/proto/java"/>
<arg value="--proto_path=proto"/>
<fileset dir="." includes="proto/**/*.proto"/>
</apply>
</target>
<target name="javac" depends="setup, protoc" description="Compile java source to bytecode">
<mkdir dir="war/WEB-INF/classes"/>
<javac includes="**" encoding="utf-8"
destdir="war/WEB-INF/classes"
source="1.7" target="1.7" nowarn="true"
debug="true" debuglevel="lines,vars,source">
<src refid="project.java.path"/>
<src refid="protoc.java.output" />
<classpath refid="project.class.path"/>
</javac>
</target>
<target name="gwtc" depends="javac" description="GWT compile to JavaScript (production mode)">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<path refid="project.java.path"/>
<path refid="project.class.path"/>
<path refid="protoc.java.output" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx256M"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.shared.args}"/>
<arg line="${gwt.args}"/>
<arg line="${gwt.custom.args}"/>
<arg value="DomDistiller"/>
</java>
</target>
<target name="extractjs" depends="gwtc" description="Extract standalone JavaScript from compiled JavaScript">
<exec executable="python" failonerror="true">
<arg value="create_standalone_js.py"/>
<arg line="--module domdistiller"/>
<arg value="--auto"/>
</exec>
</target>
<target name="extractwrappedjs" depends="extractjs"
description="Create wrapped standalone JavaScript from compiled JavaScript for direct inclusion in Chrome">
<exec executable="python" failonerror="true">
<arg value="create_wrapped_standalone_js.py"/>
<arg value="--templatefile=war/wrapped_domdistiller_template.js"/>
<arg value="--infile=out/domdistiller.js"/>
<arg value="--outfile=out/domdistiller_wrapped.js"/>
</exec>
</target>
<target name="package" depends="extractjs, extractwrappedjs, extractjs.jstests"
description="Copy the main build artifacts into the out/package directory" >
<mkdir dir="out/extension"/>
<mkdir dir="out/package"/>
<mkdir dir="out/package/js"/>
<mkdir dir="out/package/proto"/>
<mkdir dir="out/package/python"/>
<mkdir dir="out/package/test"/>
<mkdir dir="out/package/test/data"/>
<mkdir dir="out/package/test/data/out"/>
<mkdir dir="out/package/test/data/war"/>
<copy file="out/domdistiller.js" todir="out/package/js" />
<copy file="out/domdistiller_wrapped.js" todir="out/package/js" />
<copy todir="out/package/proto">
<fileset dir="proto"/>
</copy>
<copy file="out/proto/python/google/protobuf/compiler/plugin_pb2.py" todir="out/package/python" />
<copy file="out/domdistiller.js" todir="out/extension" />
<copy todir="out/extension">
<fileset dir="extension"/>
</copy>
<copy file="out/domdistillerjstest.js" todir="out/package/test/data/out" />
<copy file="war/test.html" todir="out/package/test/data/war" />
</target>
<target name="protoc.tests" depends="protoc.plugin.base" description="Generate test proto code">
<mkdir dir="out/test/proto" />
<apply executable="protoc" failonerror="true" relative="true">
<arg value="--plugin=protoc-gen-gwt_overlay=protoc_plugins/gwt_overlay.py"/>
<arg value="--gwt_overlay_out=out/test/proto"/>
<arg value="--proto_path=test/proto"/>
<fileset dir="." includes="test/proto/**/*.proto"/>
</apply>
</target>
<target name="javac.jstests" depends="javac, protoc.tests" description="Compile test code">
<mkdir dir="war/WEB-INF/jstest/classes"/>
<javac includes="**" encoding="utf-8"
source="1.7" target="1.7" nowarn="true"
destdir="war/WEB-INF/jstest/classes"
debug="true" debuglevel="lines,vars,source">
<src refid="project.java.jstest.path" />
<src refid="protoc.test.java.output" />
<classpath refid="project.class.path"/>
</javac>
</target>
<target name="gwtc.jstests" depends="javac.jstests" description="GWT compile to JavaScript (production mode)">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<path refid="project.class.path"/>
<path refid="project.java.path"/>
<path refid="project.java.jstest.path" />
<path refid="protoc.java.output" />
<pathelement location="tools" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx256M"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.shared.args}"/>
<arg line="${gwt.test.args}"/>
<arg line="${gwt.custom.args}"/>
<arg value="DomDistillerJsTest"/>
</java>
</target>
<target name="extractjs.jstests" depends="gwtc.jstests" description="Extract standalone JavaScript from compiled JavaScript">
<exec executable="python" failonerror="true">
<arg value="create_standalone_js.py"/>
<arg line="--module domdistillerjstest"/>
<arg value="--auto"/>
<arg value="--sourcemaps"/>
</exec>
</target>
<!-- Run jstests for the Linux platform -->
<target name="-jstests.linux" if="isLinux">
<exec executable="xvfb-run" failonerror="true">
<env key="PATH" path="${basedir}/buildtools:${env.PATH}"/>
<arg value="--auto-servernum"/>
<arg value="-s"/>
<arg value="-screen 0 1024x768x24"/>
<arg value="./run_jstests.py"/>
<arg line="--filter=${test.filter}
--debug_level ${test.debug_level}
--no_sandbox ${test.no_sandbox}
--shuffle ${test.shuffle}
--repeat ${test.repeat}"/>
</exec>
</target>
<!-- Run jstests for the Mac OS X platform -->
<target name="-jstests.mac" if="isMac">
<exec executable="python" failonerror="true">
<env key="PATH" path="${basedir}/buildtools:${env.PATH}"/>
<arg value="./run_jstests.py"/>
<arg line="--filter=${test.filter}
--debug_level ${test.debug_level}
--shuffle ${test.shuffle}
--repeat ${test.repeat}"/>
</exec>
</target>
<!-- Run jstests -->
<target name="-jstests" depends="-jstests.linux, -jstests.mac" />
<target name="test"
depends="extractjs.jstests, -jstests"
description="Run tests">
</target>
<target name="runtest"
depends="-jstests"
description="Run tests without recompilation">
</target>
<target name="build" depends="gwtc" description="Build this project" />
<target name="javadoc">
<javadoc
destdir="out/javadoc"
sourcepathref="project.java.path"
classpathref="project.class.path">
</javadoc>
</target>
<target name="clean" description="Clean this project">
<delete dir="war/WEB-INF" failonerror="false" />
<delete dir="war/domdistiller" failonerror="false" />
<delete dir="war/domdistillerjs" failonerror="false" />
<delete dir="war/domdistillerjstest" failonerror="false" />
<delete file="war/DomDistiller.war" failonerror="false" />
<delete dir="gwt-unitCache" failonerror="false" />
<delete dir="out" failonerror="false" />
<delete failonerror="false" includeemptydirs="true">
<fileset dir="war" includes="*JUnit/**"/>
</delete>
</target>
</project>