This repository has been archived by the owner on Dec 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
107 lines (92 loc) · 4.02 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
<?xml version="1.0" encoding="utf-8"?>
<project default="goengine-boilerplate">
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="/usr/share/ant/lib/ant-contrib-0.6.jar" />
</classpath>
</taskdef>
<target name="goengine-boilerplate">
<tstamp>
<format property="pub_time" pattern="MM/dd/yyyy hh:mm:ss aa" />
<format property="backup_label" pattern="MM_dd_yyyy hh-mm-ss aa" />
</tstamp>
<property name="project_root" value="." />
<property name="js_dir" value="${project_root}/static/js/" />
<property name="css_dir" value="${project_root}/static/css/" />
<property name="img_dir" value="${project_root}/static/img/" />
<property name="templates_dir" value="${project_root}/templates/" />
<property name="compl_jar" value="compiler.jar"/>
<property name="backup_dir" value="backup_${backup_label}"/>
<!-- Clean up old backups -->
<delete includeemptydirs="true">
<fileset dir="${project_root}" defaultexcludes="false">
<include name="**/backup_*/**" />
</fileset>
</delete>
<!--Temp directory stores current project copy and all actions are performed under <project_root>.
This folder is also uploaded to GAE -->
<mkdir dir="${backup_dir}"/>
<!-- Create back up copy of the project files -->
<copy todir="${backup_dir}">
<fileset dir="${project_root}"/>
</copy>
<!-- Compressing js-files with Google closure compiler -->
<for param="file">
<path>
<fileset dir="${js_dir}" includes="**/*.js" excludes="*.min.js,**/*.min.js"/>
</path>
<sequential>
<dirname property="@{file}.dir" file="@{file}" />
<basename property="@{file}.name" file="@{file}" suffix=".js"/>
<exec executable="/usr/bin/java">
<arg value="-jar"/>
<arg value="${compl_jar}"/>
<arg value="--js"/>
<arg value="@{file}"/>
<arg value="--js_output_file"/>
<arg value="${@{file}.dir}/${@{file}.name}.min.js"/>
</exec>
</sequential>
</for>
<!-- Removing debug-versions of the js-files -->
<delete>
<fileset dir="${js_dir}" includes="**/*.js" excludes="**/*.min.js"/>
</delete>
<replace dir="${project_root}" value=".js">
<include name="**/*.html"/>
<replacetoken>.min.js</replacetoken>
</replace>
<!-- Replacing references to debug versions of js files with there comporessed copies -->
<replace dir="${project_root}" value=".min.js">
<include name="**/*.html"/>
<replacetoken>.js</replacetoken>
</replace>
<!-- Have to handle the Google Analytics script separately (ga.js in minified) -->
<replace dir="${project_root}" value="ga.js">
<include name="**/*.html"/>
<replacetoken>ga.min.js</replacetoken>
</replace>
<!-- Placing publish date label on all html pages -->
<replace dir="${templates_dir}" value="${pub_time}">
<include name="**/*.html"/>
<replacetoken>{last_pub_time}</replacetoken>
</replace>
<!-- Publishing project to GAE -->
<exec executable="/bin/sh">
<arg value="${project_root}/upload.sh" />
</exec>
<!-- removing all published data -->
<delete>
<dirset dir="${project_root}" excludes="${backup_dir}"/>
</delete>
<copy todir="${project_root}">
<fileset dir="${backup_dir}" includes="static,templates,layout.html"/>
</copy>
<copy todir="${js_dir}">
<fileset dir="${backup_dir}/${js_dir}"/>
</copy>
<delete>
<dirset dir="${backup_dir}"/>
</delete>
</target>
</project>