-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
126 lines (93 loc) · 4.21 KB
/
build.xml
File metadata and controls
126 lines (93 loc) · 4.21 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
<?xml version="1.0" encoding="utf-8"?>
<project name="onTime">
<!-- Setup some basic reusable properties -->
<target name="-load.properties">
<property name="build.dir" value="app/build"/>
<property name="build.htmldir" value="templates/build"/>
<!--Build version information -->
<property name="build.major" value="1"/>
<property name="build.minor" value="0"/>
<property name="src.css.dir" value="app/css"/>
<!-- <property name="compilation" value="SIMPLE_OPTIMIZATIONS"/> -->
<property name="compilation" value="WHITESPACE_ONLY"/>
<echo>Load Properties Complete</echo>
</target>
<!-- Reset Build Directory -->
<target name="-init" depends="-load.properties"
description="To record some of the information of the build step">
<tstamp>
<format property="TODAY" pattern="EEE, d MMM yyyy HH:mm:ss Z"/>
</tstamp>
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
<delete dir="${build.htmldir}"/>
<mkdir dir="${build.htmldir}"/>
<echo file="${build.dir}/tstamp.txt">Build Date: ${TODAY}
Build Version: ${build.major}.${build.minor}</echo>
<copy file="templates/app.html" todir="${build.htmldir}"/>
<copy file="compiler.jar" todir="${build.dir}"/>
<echo>Init Complete</echo>
</target>
<!-- Concatenate Javascript files -->
<target name="-js.concatenate" depends="-init">
<concat destfile="${build.dir}/app.js">
<filelist dir="app/js" files="app.js" />
<fileset dir="app/js" includes="*.js" excludes="app.js" />
<fileset dir="app/js/controllers" includes="*.js" />
<fileset dir="app/js/directives" includes="*.js" />
<fileset dir="app/js/services" includes="*.js" />
</concat>
<replace file="${build.dir}/app.js" token="'use strict';" value=""/>
<echo>Javascript Concatenation Complete</echo>
</target>
<!--Concatenate CSS files-->
<target name="-css.concatenate" depends="-init"
description="Concatenates specified CSS files">
<concat destfile="${build.dir}/styles.css">
<filelist dir="${src.css.dir}">
<file name="cosmostrap.min.css"/>
<file name="bootstrap-responsive.min.css"/>
<file name="app.css"/>
<file name="mobile.css"/>
</filelist>
</concat>
<echo>Finished</echo>
</target>
<!-- Minify the Single Javascript File -->
<target name="-js.minify" depends="-js.concatenate">
<exec dir="${build.dir}" executable="java">
<arg line="-jar compiler.jar" />
<arg line="--compilation_level=${compilation}" />
<arg line="--js=app.js" />
<arg line="--js_output_file=app.min.js" />
</exec>
</target>
<!-- Minify the Single CSS File -->
<target name="-css.minify" depends="-css.concatenate">
</target>
<!-- Create the build html file -->
<!-- <target name="-html.replace" depends="-js.concatenate,-css.concatenate"> -->
<target name="-html.replace" depends="-js.concatenate">
<!-- Replace Old Script Tags With Single Minified File-->
<replaceregexp file="${build.htmldir}/app.html"
match="<!-- CONCATENATE AND MINIFY FOR BUILD -->.+<!-- END CONCATENATE -->"
replace="<script src='/app/build/app.min.js'></script>"
flags="s"
/>
<!-- Replace Old CSS Tags With Single Minified File -->
<replaceregexp file="${build.htmldir}/app.html"
match="<!-- CONCATENATE AND MINIFY CSS FOR BUILD -->.+<!-- END CONCATENATE -->"
replace="<link rel='stylesheet' href='/app/build/styles.css' />"
flags="s"
/>
</target>
<!--Build-->
<target name="prod"
description="Builds project files for production use"
depends="
-load.properties,
-init,
-js.concatenate,
-js.minify,
-html.replace">
</target>
</project>