-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
173 lines (151 loc) · 7.45 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
<?xml version="1.0" encoding="utf-8"?>
<project name="Rose-Hulman Grid Extension" default="build">
<!-- Defining folder locations and other properties. -->
<property name="closure.dir" value="${basedir}/../../../closure" />
<!-- Required folder structure within the closure folder:
closure/closure-compiler (svn checkout of http://closure-compiler.googlecode.com/svn/trunk/)
closure/closure-library (svn checkout of http://closure-library.googlecode.com/svn/trunk/)
closure/closure-templates (svn checkout of http://closure-templates.googlecode.com/svn/trunk/) -->
<!-- Path to this build file from base.js (used by depswriter.py) -->
<property name="fromBase.dir"
value="../../../workspace2012/Rose-Hulman_WeeklySchedule_ChromeExtension" />
<!-- Set to false for optimized production compiling.
Set to true for un-optimized whitespace only compiling for debugging work. -->
<property name="debug" value="false" />
<!-- Targets -->
<target name="clean"
description="Deletes the contents of the build directory">
<delete dir="${build.dir}" />
</target>
<target name="templates"
description="Generate JavaScript files from the template soy files">
<generate-template>
<inputfilenames>
<!-- Note, these files must be in a folder called templates. -->
<arg value="popup.soy" />
<arg value="course_dialog.soy" />
</inputfilenames>
</generate-template>
</target>
<target name="gen_js_deps"
description="Generate the deps.js file for testing and uncompiled development">
<depswriter
pathFromCurrentDir = 'js'
pathFromLibraryBase = '${fromBase.dir}/js'
outputFile='${build.dir}/deps.js'>
</depswriter>
</target>
<target name="replicate"
description="Copy non-js files into the build folder as necessary">
<copy todir="${build.dir}/files">
<fileset dir=".">
<include name="manifest.json" />
<include name="popup.html" />
<include name="images/**" />
<include name="styles/**" />
</fileset>
</copy>
</target>
<target name="rosegrid-compile" description="generates rosegrid.js">
<closure-builder
root='${basedir}/js/'
outputfile="${build.dir}/files/rosegrid.js"
compilationlevel="${closure.optimizations}" > <!-- Selects value based on debug property -->
<namespaces>
<arg line='--namespace=rosegrid.Main' />
</namespaces>
<extraflags>
<!-- Optional. This turns what would be warnings into errors for type safety. -->
<arg line='--compiler_flags="--jscomp_error=checkTypes"' />
</extraflags>
</closure-builder>
</target>
<target name="build" depends="clean, templates, gen_js_deps, replicate, rosegrid-compile" />
<!-- Ideally you should not need to edit anything beyong this point. -->
<!-- Locations for the closure components based on the closure folder. -->
<property name="compiler.jar" value="${closure.dir}/closure-compiler/build/compiler.jar" />
<property name="closure-library.dir" value="${closure.dir}/closure-library" />
<property name="closure-templates.dir" value="${closure.dir}/closure-templates" />
<!-- Output Build Directory -->
<property name="build.dir" value="${basedir}/build" />
<!-- Conditional properties that are set based on the value of the debug property. -->
<condition property="closure.optimizations" value="WHITESPACE_ONLY" else="ADVANCED_OPTIMIZATIONS">
<equals arg1="${debug}" arg2="true" casesensitive="false"/>
</condition>
<condition property="pretty_print_formatting_arg" value='--compiler_flags="--formatting=PRETTY_PRINT"' else="">
<equals arg1="${debug}" arg2="true" casesensitive="false"/>
</condition>
<condition property="print_input_delimiter_formatting_arg" value='--compiler_flags="--formatting=PRINT_INPUT_DELIMITER"' else="">
<equals arg1="${debug}" arg2="true" casesensitive="false"/>
</condition>
<!-- SoyToJsSrcCompiler command to generate JavaScript code from Soy files -->
<macrodef name="generate-template">
<element name="inputfilenames" optional="no"/>
<sequential>
<java jar="${closure-templates.dir}/build/SoyToJsSrcCompiler.jar"
fork="true" failonerror="true" logError="true">
<arg line='--inputPrefix templates/' /> <!-- Note required folder name -->
<inputfilenames />
<arg line='--outputPathFormat ${build.dir}/templates/{INPUT_FILE_NAME_NO_EXT}.js' />
<arg line="--shouldGenerateJsdoc" />
<arg line="--shouldProvideRequireSoyNamespaces" />
<arg line="--cssHandlingScheme GOOG" />
</java>
</sequential>
</macrodef>
<!-- Used to generate a deps file for testing and uncompiled development -->
<macrodef name="depswriter">
<attribute name="pathFromCurrentDir" />
<attribute name="pathFromLibraryBase" />
<attribute name="outputfile" />
<element name="extraflags" optional="yes"/>
<sequential>
<exec executable="python" failonerror="true" logError="true">
<arg value="${closure-library.dir}/closure/bin/build/depswriter.py" />
<arg line='--root_with_prefix="${closure-templates.dir}/javascript ../../../closure-templates/javascript"' />
<arg line='--root_with_prefix="${build.dir}/templates ${fromBase.dir}/build/templates"' />
<arg line='--root_with_prefix="@{pathFromCurrentDir} @{pathFromLibraryBase}"' />
<arg line='--output_file="@{outputfile}"' />
<extraflags />
</exec>
</sequential>
</macrodef>
<!-- Options for the compilationlevels:
WHITESPACE_ONLY, SIMPLE_OPTIMIZATIONS, ADVANCED_OPTIMIZATIONS" -->
<!-- extraflags you might want to add (replace XX with two hypens) -->
<!-- <arg line='XXcompiler_flags="XXjscomp_error=checkTypes"' /> -->
<!-- <arg line='XXroot=folder/with/other/js/files' /> -->
<!-- <arg line='XXnamespace=yournamespace.yourmodule' /> -->
<!-- <arg line='XXcompiler_flags="XXformatting=PRETTY_PRINT"' /> -->
<!-- <arg line='XXcompiler_flags="XXformatting=PRINT_INPUT_DELIMITER"' /> -->
<!-- <arg line='XXcompiler_flags="XXdebug=true"' /> -->
<!-- <arg line='XXcompiler_flags="XXgenerate_exports=true"' /> -->
<!-- <arg line='XXcompiler_flags="XXexterns=someFileWithExterns.js"' /> -->
<!-- Used to compile the JavaScript into a single "compiled" file. -->
<macrodef name="closure-builder">
<attribute name="root" />
<element name="namespaces" optional="no"/>
<attribute name="outputfile" />
<attribute name="compilationlevel" default="ADVANCED_OPTIMIZATIONS" />
<element name="extraflags" optional="yes"/>
<sequential>
<exec executable="python" failonerror="true" logError="true">
<arg value="${closure-library.dir}/closure/bin/build/closurebuilder.py" />
<arg line='--root="${closure-library.dir}"' />
<arg line='--root="${closure-templates.dir}"' />
<arg line='--root="@{root}"' />
<arg line='--root="${build.dir}/templates"' />
<namespaces />
<arg line='--output_mode=compiled' />
<arg line='--compiler_jar=${compiler.jar}' />
<arg line='--output_file=@{outputfile}' />
<arg line='--compiler_flags="--compilation_level=@{compilationlevel}"' />
<arg line='--compiler_flags="--js=${closure-library.dir}/closure/goog/deps.js"' />
<arg line='--compiler_flags="--warning_level=VERBOSE"' />
<arg line="${pretty_print_formatting_arg}" />
<arg line="${print_input_delimiter_formatting_arg}" />
<extraflags />
</exec>
</sequential>
</macrodef>
</project>