forked from artefactual/atom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
216 lines (183 loc) · 8.94 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<?xml version="1.0"?>
<project name="atom" basedir="." default="build">
<!-- ===================================================================== -->
<!-- Define some globals -->
<!-- ===================================================================== -->
<property name="build.dir" value="${phing.dir}/build"/>
<!-- package.version: e.g. 1.4 -->
<exec command="cat apps/qubit/config/qubitConfiguration.class.php | grep VERSION | grep -Po '\d\.\d\.\d'" outputProperty="package.version"/>
<!-- package.is_2: e.g. True -->
<php function="version_compare" returnProperty="package.is_2">
<param value="${package.version}"/>
<param value="2.0.0"/> <!-- ALWAYS 2.0.0, DO NOT CHANGE IT -->
<param value=">="/>
</php>
<!-- package.hash: e.g. e074179cb205a43b20ac171b9917d1608a41b5dd -->
<exec command="git rev-parse HEAD" outputProperty="package.hash"/>
<exec command="git rev-parse HEAD | cut -c 1-16" outputProperty="package.hash16"/>
<!-- package.prefix -->
<if>
<equals arg1="${package.is_2}" arg2="true" />
<then>
<property name="package.prefix" value=""/>
</then>
<else>
<property name="package.prefix" value="ica"/>
</else>
</if>
<!-- package.pear.name: e.g. atom-2.0.0 -->
<property name="package.pear.name" value="${phing.project.name}-${package.version}"/>
<!-- package.name: e.g. atom-2.0.0-20030101-e6471c09494dd6fe or atom-2.0.0 -->
<exec command="git show-ref --tags | grep 0d8bfe29934c3ad6ff2394dcc84e15bb6887df95 | grep -Po '\d\.\d(\.\d){0,1}'" returnProperty="return_code" outputProperty="package.tag"/>
<if>
<equals arg1="${return_code}" arg2="0" />
<then>
<property name="package.name" value="${package.prefix}${package.pear.name}-${package.tag}"/>
</then>
<else>
<exec command="date +'%Y%m%d'" outputProperty="date" />
<property name="package.name" value="${package.prefix}${package.pear.name}-${date}-${package.hash16}"/>
</else>
</if>
<!-- ===================================================================== -->
<!-- Debug target -->
<!-- ===================================================================== -->
<target name="debug">
<echo>Debug:</echo>
<echo> - phing.dir: ${phing.dir}</echo>
<echo> - phing.file: ${phing.file}</echo>
<echo> - build.dir: ${build.dir}</echo>
<echo> - package.version: ${package.version}</echo>
<echo> - package.name: ${package.name}</echo>
</target>
<!-- ===================================================================== -->
<!-- Build target -->
<!-- ===================================================================== -->
<target name="build"
depends="debug, prepare, package"
description="Build a tarball"/>
<target name="prepare" depends="debug">
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
<exec command="make" dir="${phing.dir}/plugins/arDominionPlugin" checkreturn="true"/>
<exec command="make" dir="${phing.dir}/plugins/arArchivesCanadaPlugin" checkreturn="true"/>
<exec command="make" dir="${phing.dir}/plugins/arMeaStylePlugin" checkreturn="true"/>
<exec command="php symfony release --no-confirmation ${package.version} stable" dir="${phing.dir}" checkreturn="true"/>
</target>
<target name="package" depends="prepare">
<echo>Building pear package</echo>
<exec command="pear package" dir="${phing.dir}" checkreturn="true"/>
<move file="${phing.dir}/${package.pear.name}.tgz" tofile="${build.dir}/${package.name}.tar.gz" overwrite="true"/>
<delete file="${phing.dir}/package.xml"/>
<echo>Done! ${build.dir}/${package.name}.tar.gz</echo>
</target>
<!-- ===================================================================== -->
<!-- i18n shared targets -->
<!-- ===================================================================== -->
<target name="i18n-prepare">
<mkdir dir=".tx/i18n"/>
<exec command="which tx" returnProperty="return_code" outputProperty="tx.path"/>
<if>
<equals arg1="${return_code}" arg2="1" />
<then>
<fail message="You need to install transifex-client before!"/>
</then>
</if>
<exec command="git diff --quiet" returnProperty="return_code"/>
<if>
<equals arg1="${return_code}" arg2="0" />
<then><echo>You are good to go!</echo></then>
<else><fail message="For your safety, this target won't work if you have unstaged changes in your git tree."/></else>
</if>
</target>
<target name="i18n-extract">
<foreach param="lang" target="i18n-extract-subtask">
<fileset dir="apps/qubit/i18n/">
<type type="dir"/>
<depth max="0" min="0"/>
</fileset>
</foreach>
</target>
<target name="i18n-extract-subtask">
<exec command="php symfony i18n:extract --plugins --auto-delete --auto-save ${lang}" dir="${phing.dir}" checkreturn="true" level="debug"/>
</target>
<!-- ===================================================================== -->
<!-- i18n-push-sources target, push source strings to Transifex -->
<!-- ===================================================================== -->
<target name="i18n-push-sources"
depends="i18n-prepare, i18n-extract-sources, i18n-consolidate-sources, i18n-send-sources"
description="Push source strings to Transifex"/>
<target name="i18n-extract-sources">
<exec command="php symfony i18n:extract --plugins --auto-delete --auto-save en" dir="${phing.dir}" checkreturn="true"/>
</target>
<target name="i18n-consolidate-sources">
<exec command="php symfony i18n:consolidate en .tx/i18n/" dir="${phing.dir}" checkreturn="true"/>
</target>
<target name="i18n-send-sources">
<exec command="tx push --source" dir="${phing.dir}" checkreturn="true" logoutput="true" passthru="true"/>
<exec command="find . -wholename "*i18n/en" | xargs -IF rm -rf F"/>
</target>
<!-- ===================================================================== -->
<!-- i18n-push-translations target, push translations to Transifex -->
<!-- ===================================================================== -->
<target name="i18n-push-translations"
depends="i18n-prepare, i18n-extract, i18n-consolidate-translations, i18n-send-translations"
description="Push translations to Transifex"/>
<target name="i18n-consolidate-translations">
<foreach param="lang" target="i18n-consolidate-translations-subtask">
<fileset dir="apps/qubit/i18n/">
<type type="dir"/>
<depth max="0" min="0"/>
</fileset>
</foreach>
</target>
<target name="i18n-consolidate-translations-subtask">
<exec command="php symfony i18n:consolidate ${lang} .tx/i18n/" dir="${phing.dir}" checkreturn="true" level="debug"/>
</target>
<target name="i18n-send-translations">
<exec command="tx push --translations" dir="${phing.dir}" checkreturn="true" logoutput="true" passthru="true"/>
</target>
<!-- ===================================================================== -->
<!-- i18n-pull-translations target, pull translations from Transifex -->
<!-- ===================================================================== -->
<target name="i18n-pull-translations"
depends="i18n-prepare, i18n-fetch, i18n-rectify, i18n-update-fixtures, i18n-cleanup"
description="Pull translations from Transifex, ready to be committed"/>
<target name="i18n-fetch">
<exec command="tx pull --all" dir="${phing.dir}" checkreturn="true" logoutput="true" passthru="true"/>
<foreach param="lang" absparam="directory" target="i18n-fetch-subtask">
<fileset dir=".tx/i18n">
<type type="dir"/>
<depth max="0" min="0"/>
</fileset>
</foreach>
</target>
<target name="i18n-fetch-subtask">
<copy file="${directory}/messages.xml" tofile="apps/qubit/i18n/${lang}/messages.xml" overwrite="true"/>
</target>
<target name="i18n-rectify">
<foreach param="lang" target="i18n-rectify-subtask">
<fileset dir="apps/qubit/i18n/">
<type type="dir"/>
<depth max="0" min="0"/>
</fileset>
</foreach>
</target>
<target name="i18n-rectify-subtask">
<exec command="php symfony i18n:rectify ${lang}" dir="${phing.dir}" checkreturn="true"/>
</target>
<target name="i18n-update-fixtures">
<exec command="php symfony i18n:update-fixtures apps/qubit/i18n/" dir="${phing.dir}" checkreturn="true"/>
</target>
<target name="i18n-cleanup">
<foreach param="lang" target="i18n-cleanup-subtask">
<fileset dir="apps/qubit/i18n/">
<type type="dir"/>
<depth max="0" min="0"/>
</fileset>
</foreach>
</target>
<target name="i18n-cleanup-subtask">
<exec command="php symfony i18n:extract --auto-save --auto-delete --plugins ${lang}" dir="${phing.dir}" checkreturn="true"/>
</target>
</project>