My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
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
<project name="closure-experiments" basedir=".">

<property name="src.dir" value="${basedir}/src" />
<property name="js-src.dir" value="${basedir}/js-src" />
<property name="closure-compiler.dir" value="${basedir}/../closure-compiler" />
<property name="closure-library.dir" value="${basedir}/../closure-library" />
<property name="yuicompressor.dir" value="${basedir}/../yuicompressor-2.4.2" />
<property name="build.dir" value="${basedir}/build" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="outputwrapper"
value='"// Copyright 2010&#10;(function(){%output%})();"' />

<target name="clean" description="delete generated files">
<delete dir="${build.dir}" />
</target>

<target name="closure-compiler-jar"
description="builds the Closure Compiler jar">
<ant dir="${closure-compiler.dir}"
antfile="${closure-compiler.dir}/build.xml"
target="jar"
inheritAll="false"
/>
</target>

<target name="java-compile"
depends="closure-compiler-jar"
description="compiles the com.bolinfest.closure package">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}"
destdir="${classes.dir}"
classpath="${closure-compiler.dir}/build/compiler.jar"
/>
</target>

<macrodef name="compilerjar"
description="builds a custom Closure Compiler jar using com.bolinfest.closure">
<attribute name="mainclassname" />
<attribute name="jarfilename" />
<sequential>
<antcall target="java-compile" />
<jar destfile="${build.dir}/@{jarfilename}" update="false">
<zipfileset src="${closure-compiler.dir}/build/compiler.jar" />
<fileset dir="${classes.dir}" />
<manifest>
<attribute name="Main-Class" value="@{mainclassname}" />
</manifest>
</jar>
</sequential>
</macrodef>

<target name="jar"
description="builds a custom Closure Compiler jar using com.bolinfest.closure">
<compilerjar mainclassname="com.bolinfest.closure.DebugStrippingCompilerRunner"
jarfilename="compiler.jar" />
</target>

<target name="awesomebar-concat">
<mkdir dir="${build.dir}" />
<exec executable="${closure-library.dir}/closure/bin/calcdeps.py"
output="${build.dir}/awesomebar-concat.js"
errorproperty="/dev/null">
<arg line="-i ${js-src.dir}/awesomebar.js" />
<arg line="-p ${closure-library.dir}" />
<arg line="-o script" />
</exec>
</target>

<target name="awesomebar-concat-anonymized" depends="awesomebar-concat">
<mkdir dir="${build.dir}" />
<concat destfile="${build.dir}/awesomebar-concat-anonymized.js">
<header>(function(){</header>
<filelist dir="${build.dir}" files="awesomebar-concat.js" />
<footer>})();</footer>
</concat>
</target>

<macrodef name="yui">
<attribute name="inputfile" />
<attribute name="outputfile" />
<sequential>
<mkdir dir="${build.dir}" />
<ant dir="${yuicompressor.dir}"
antfile="${yuicompressor.dir}/build.xml"
target="build.jar"
inheritAll="false"
/>
<java jar="${yuicompressor.dir}/build/yuicompressor-2.4.2.jar"
fork="true"
output="@{outputfile}"
errorproperty="/dev/null">
<arg value="@{inputfile}" />
</java>
</sequential>
</macrodef>

<target name="awesomebar-yui"
depends="awesomebar-concat">
<yui inputfile="${build.dir}/awesomebar-concat.js"
outputfile="${build.dir}/awesomebar-yui.js" />
</target>

<target name="awesomebar-anonymized-yui"
depends="awesomebar-concat-anonymized">
<yui inputfile="${build.dir}/awesomebar-concat-anonymized.js"
outputfile="${build.dir}/awesomebar-anonymized-yui.js" />
</target>

<macrodef name="calcdeps">
<attribute name="inputfile" default="${js-src.dir}/awesomebar.js" />
<attribute name="outputfile" />
<attribute name="compilerjarfile" default="${closure-compiler.dir}/build/compiler.jar" />
<attribute name="compilationlevel" default="ADVANCED_OPTIMIZATIONS" />
<attribute name="outputmode" default="compiled" />
<element name="extraflags" optional="yes" />
<sequential>
<mkdir dir="${build.dir}" />
<exec executable="python"
failonerror="true"
logError="true"
output="${build.dir}/@{outputfile}"
>
<arg value="${closure-library.dir}/closure/bin/calcdeps.py" />
<!-- Double-quote file arguments in case they contain spaces. -->
<arg line='-i "@{inputfile}"' />
<arg line='-p "${closure-library.dir}"' />
<arg line="-o @{outputmode}" />
<arg line='-c "@{compilerjarfile}"' />
<arg line='-f "--compilation_level=@{compilationlevel}"' />
<extraflags />
</exec>
</sequential>
</macrodef>

<target name="awesomebar-advanced-no-debug" depends="jar">
<calcdeps outputfile="awesomebar-advanced-no-debug.js" compilerjarfile="${build.dir}/compiler.jar" />
</target>

<target name="awesomebar-advanced" depends="closure-compiler-jar">
<calcdeps outputfile="awesomebar-advanced.js" />
</target>

<target name="awesomebar-simple" depends="closure-compiler-jar">
<calcdeps outputfile="awesomebar-simple.js" compilationlevel="SIMPLE_OPTIMIZATIONS" />
</target>

<target name="awesomebar-whitespace-only" depends="closure-compiler-jar">
<calcdeps outputfile="awesomebar-whitespace-only.js" compilationlevel="WHITESPACE_ONLY" />
</target>

<target name="awesomebar-all"
depends="awesomebar-advanced-no-debug,
awesomebar-advanced,
awesomebar-simple,
awesomebar-whitespace-only,
awesomebar-concat,
awesomebar-yui,
awesomebar-anonymized-yui" />

<target name="closure-lite-deps-list"
description="creates list of Library files included in Closure Lite">
<calcdeps inputfile="${basedir}/js-src/closure-lite/all-requires.js"
outputfile="closure-lite-deps-list.js"
outputmode="list"
/>
</target>

<target name="closure-lite" depends="jar">
<!-- Use one compilation pass to generate goog.exportSymbol() calls and -->
<!-- an externs file for properties that should not be renamed. -->
<compilerjar mainclassname="com.bolinfest.closure.ExportPublicMembersCompilerRunner"
jarfilename="exporter.jar" />
<calcdeps inputfile="${basedir}/js-src/closure-lite/all-requires.js"
outputfile="closure-lite-no-exports.js"
compilerjarfile="${build.dir}/exporter.jar"
/>

<!-- Combine the generate goog.exportSymbol() calls with all-requires.js -->
<!-- to produce the one JS input file for the debug-stripping compiler. -->
<concat destfile="${build.dir}/closure-lite-precompiled.js">
<filelist dir="${basedir}/js-src/closure-lite/" files="all-requires.js" />
<filelist dir="${build.dir}" files="closure-lite-exports.js" />
</concat>

<!-- Use the debug-stripping compiler to produce closure-lite.js. -->
<calcdeps inputfile="${build.dir}/closure-lite-precompiled.js"
outputfile="closure-lite.js"
compilerjarfile="${build.dir}/compiler.jar">
<extraflags>
<arg line='-f "--externs=${build.dir}/closure-lite-externs.js"' />
<arg line='-f "--output_wrapper=${outputwrapper}"' />
</extraflags>
</calcdeps>
</target>

</project>

Change log

r26 by bolinfest on Apr 12, 2010   Diff
fixed some issues so now "ant closure-
lite" should work again
Go to: 
Project members, sign in to write a code review

Older revisions

r22 by bolinfest on Feb 28, 2010   Diff
Updated code to use CommandLineRunner
(formerly CompilerRunner) and added
goog.asserts to the list of type
prefixes to strip.
r19 by bolinfest on Dec 21, 2009   Diff
Added a description to a target in
build.xml for the benefit of ant
-projecthelp
r17 by bolinfest on Dec 21, 2009   Diff
changed argument quoting to tolerate
"Documents and Settings"
All revisions of this file

File info

Size: 7680 bytes, 196 lines
Powered by Google Project Hosting