-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
executable file
·140 lines (116 loc) · 4.35 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
<?xml version="1.0" encoding="utf-8"?>
<project name="compact_menu_2" default="xpi" basedir=".">
<description>
Compact Menu 2 extension for Firefox
</description>
<!-- properties -->
<property name="src.dir" value="src" />
<property name="dest.dir" value="." />
<property name="build.dir" value="build" />
<property name="target.app" value="fx+tb+sb+sm" />
<xmlproperty file="${src.dir}/install.rdf" />
<property name="condition.file" value="build.condition" />
<property file="${condition.file}" prefix="last." />
<!-- resources -->
<defaultexcludes add="**/.*" />
<defaultexcludes add="**/Thumbs.db" />
<defaultexcludes add="**/*.bak" />
<defaultexcludes add="**/*.orig" />
<property name="binary.files" value="**/*.png" />
<property name="jar.file" value="compact.jar" />
<property name="jar.path" value="${build.dir}/${jar.file}" />
<property name="chrome.src.dir" value="${src.dir}/chrome" />
<property name="chrome.build.dir" value="${build.dir}/chrome" />
<presetdef name="fileset-chrome.sources">
<fileset id="chrome.sources" dir="${chrome.src.dir}" />
</presetdef>
<fileset id="xpi.sources" dir="${src.dir}">
<include name="install.rdf" />
<include name="chrome.manifest" />
<include name="defaults/**" />
</fileset>
<!-- main targets -->
<target name="release" description="Make release xpi file.">
<antcall target="xpi">
<param name="update-locales.mode" value="tar" />
</antcall>
</target>
<target name="develop" description="Make develop xpi file.">
<antcall target="xpi">
<param name="debug" value="true" />
</antcall>
</target>
<target name="xpi" depends="init,jar" description="Make xpi file.">
<zip destfile="${xpi.path}">
<fileset refid="xpi.sources" />
<fileset file="${jar.path}" />
</zip>
<echo message="Debug: ${debug.mode}" />
</target>
<target name="clean" description="Delete all build files.">
<delete includeEmptyDirs="true">
<fileset dir="${dest.dir}" includes="*.xpi" />
<fileset dir="${build.dir}" />
<fileset file="${condition.file}" />
</delete>
</target>
<!-- internal targets -->
<target name="init" depends="init-properties,init-filters" />
<target name="init-properties">
<condition property="debug.mode" value="YES" else="NO">
<isset property="debug" />
</condition>
<condition property="chrome.no-updates">
<and>
<equals arg1="${debug.mode}" arg2="${last.debug.mode}" />
<not><isset property="update-locales.mode" /></not>
<not><isset property="last.update-locales.mode" /></not>
<uptodate>
<srcfiles dir="." includes="${chrome.src.dir}/**" />
<globmapper from="${chrome.src.dir}/*" to="${chrome.build.dir}/*" handledirsep="true" />
</uptodate>
</and>
</condition>
<condition property="xpi.release" value="-develop" else="">
<or>
<isset property="debug" />
<not><equals arg1="${update-locales.mode}" arg2="tar" /></not>
</or>
</condition>
<property name="xpi.file" value="${ant.project.name}-${RDF.Description.em:version}-${target.app}${xpi.release}.xpi" />
<property name="xpi.path" value="${dest.dir}/${xpi.file}" />
</target>
<target name="init-filters" depends="init-filters-debug,init-filters-release" />
<target name="init-filters-debug" if="debug">
<filterset id="debug-filter">
<filter token="debug" value="true" />
</filterset>
</target>
<target name="init-filters-release" unless="debug">
<filterset id="debug-filter">
<filter token="debug" value="false" />
</filterset>
</target>
<target name="chrome" unless="chrome.no-updates">
<echo message="debug.mode=${debug.mode} " file="${condition.file}" />
<delete dir="${chrome.build.dir}" />
<copy todir="${chrome.build.dir}" encoding="UTF-8">
<fileset-chrome.sources excludes="${binary.files}" />
<filterset refid="debug-filter" />
</copy>
<copy todir="${chrome.build.dir}">
<fileset-chrome.sources includes="${binary.files}" />
</copy>
</target>
<target name="update-locales" depends="chrome" if="update-locales.mode">
<echo message="update-locales.mode=${update-locales.mode} " file="${condition.file}" append="true" />
<exec executable="sh" failonerror="true">
<arg line="update-locales.sh --build ${update-locales.mode}" />
</exec>
</target>
<target name="jar" depends="chrome,update-locales">
<zip destfile="${jar.path}" compress="false">
<fileset dir="${chrome.build.dir}" />
</zip>
</target>
</project>