This repository was archived by the owner on Feb 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
171 lines (131 loc) · 5.78 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
<?xml version="1.0" encoding="utf-8" ?>
<project name="GcTour" basedir="." default="make">
<!-- property -->
<property file="build.prop"/>
<loadfile property="GcTour.Version" srcfile="version.txt" />
<import file="build_general_prop.xml" />
<!-- beginning projects -->
<target name="init" depends="clean">
<echo>
project: ${ant.project.name} from ${date}
version: ${GcTour.Version}
build: ${GcTour.Build}
</echo>
<echo>
directories
development: ${src.dir}
dist (final): ${build.dir}
dist (tmp): ${tmp.dir}
</echo>
<!-- create directories -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${tmp.dir}"/>
</target>
<target name="copy" depends="init" description="">
<echo>copy all files to temp path</echo>
<copy failonerror="true" todir="${tmp.dir}" flatten="true">
<fileset dir="${src.dir}/" includes="*.js,*.css" excludes="_*.*" />
</copy>
</target>
<target name="concatenate_css" depends="copy" description="Concatenate all css files">
<echo>Concat all stylesheets sources to a css</echo>
<concat destfile="${tmp.dir}/${tmp.file.cssall}"
encoding="UTF-8" outputencoding="UTF-8"
fixlastline="yes" eol="lf">
<fileset dir="${tmp.dir}/" includes="*.css" excludes="_*.*" />
</concat>
<echo>replace quotation mark to apostrophe</echo>
<replaceregexp match='"' replace="'" flags="mg" file="${tmp.dir}/${tmp.file.cssall}" />
<echo>load all stylesheets and add suffix of line a backslash</echo>
<loadfile srcfile="${tmp.dir}/${tmp.file.cssall}" property="allcss">
<filterchain>
<prefixlines prefix='\"'/>
<suffixlines suffix='\"+'/>
</filterchain>
</loadfile>
<echo>include stylesheets to the script</echo>
<replaceregexp match='"##includeallcssfiles##"+' replace="${allcss}" file="${tmp.dir}/${file.css.js}" />
</target>
<target name="concatenate_js" depends="concatenate_css" description="Concatenate all js files">
<echo>Concat all sources to a script.</echo>
<concat destfile="${tmp.dir}/${App}.user.js" fixlastline="yes" eol="lf" encoding="UTF-8">
<fileset dir="${tmp.dir}/" includes="*.js" excludes="000-header.js,_*.*" />
</concat>
</target>
<target name="compress" depends="concatenate_js" description="Compress application.js to application-min.js">
<echo>Compress script.</echo>
<apply executable="java" parallel="false" failonerror="true">
<filelist dir="${tmp.dir}" files="${App}.user.js" />
<arg line="-jar" />
<arg path="lib/yuicompressor-2.4.6.jar" />
<srcfile />
<arg line="--type js" />
<arg line="--charset utf-8" />
<arg line="--nomunge" />
<arg line="--preserve-semi" />
<arg line="--disable-optimizations" />
<arg line="-o" />
<mapper type="glob" from="${App}.user.js" to="${tmp.dir}/${App}-min.user.js" />
<targetfile />
<!-- <arg line="-v" /> -->
</apply>
</target>
<target name="make" depends="compress" description="Add Userscript-Header to the Script.">
<echo>Add current version to the header.</echo>
<replace dir="${tmp.dir}/">
<fileset dir="${tmp.dir}/" includes="00*.js,01*.js,02*.js" />
<replacefilter token="@version@" value="${GcTour.Version}" />
<replacefilter token="@build@" value="${GcTour.Build}" />
<replacefilter token="@url_require_jquery@" value="${url.jquery}" />
<replacefilter token="@url_require_ui@" value="${url.jquery-ui}" />
<replacefilter token="@url_resource_cssui@" value="${url.jquery-ui-css}" />
</replace>
<echo>Add Userscript-Header to the script.</echo>
<concat destfile="${build.dir}/${App}.user.js" fixlastline="yes" eol="lf" encoding="UTF-8">
<fileset file="${tmp.dir}/000-header.js" />
<fileset file="${tmp.dir}/${App}.user.js" />
</concat>
<echo>Add Userscript-Header to the compressed script.</echo>
<concat destfile="${build.dir}/${App}-min.user.js" fixlastline="yes" eol="lf" encoding="UTF-8">
<fileset file="${tmp.dir}/000-header.js" />
<fileset file="${tmp.dir}/${App}-min.user.js" />
</concat>
<echo>delete tmp path.</echo>
<delete dir="${tmp.dir}" />
</target>
<target name="makeff" depends="make" description="Copies the script to the GM_SCRIPTS folder in your firefox. Not enabled by default.">
<copy todir="${GcTour.dir}/">
<fileset dir="${build.dir}/" includes="${App}.user.js" />
</copy>
</target>
<target name="build.opera" depends="make">
<copy todir="${tmp.dir}/opera">
<fileset dir="opera/" includes="**" />
</copy>
<replace file="${tmp.dir}/opera/config.xml" token="@version@" value="${GcTour.Version}" />
<replace file="${tmp.dir}/opera/config.xml" token="@build@" value="${GcTour.Build}" />
<!-- download jQuery and jQuery ui -->
<get src="${url.jquery}" dest="${tmp.dir}/opera/includes/02_jquery.js" verbose="on" />
<get src="${url.jquery-ui}" dest="${tmp.dir}/opera/includes/04_jquery-ui.js" verbose="on" />
<copy file="${build.dir}/${App}.user.js" tofile="${tmp.dir}/opera/includes/GCTour.user.js"/>
<zip destfile="${build.dir}/GCTour.oex" basedir="${tmp.dir}/opera">
<patternset>
<include name="**"/>
</patternset>
</zip>
</target>
<target name="upload" depends="make" description="Upload build/gc_tour.user.js as snapshot to googlecode.">
<gcupload
username="${GCODE_user}"
password="${GCODE_password}"
projectname="gctour"
filename="build/gc_tour.user.js"
targetfilename="gc_tour.${DSTAMP}.user.js"
summary="snapshot release for version ${Version}"
labels="Type-Installer, OpSys-All" />
</target>
<target name="clean" depends="">
<delete dir="${build.dir}" />
<delete dir="${tmp.dir}" />
</target>
</project>