-
Notifications
You must be signed in to change notification settings - Fork 127
/
build.xml
252 lines (214 loc) · 10.1 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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<?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}"/>
<echo>Install production dependencies with composer</echo>
<exec command="composer install --no-dev" dir="${phing.dir}" checkreturn="true"/>
<echo>Compile css with less</echo>
<exec command="make" dir="${phing.dir}/plugins/arDominionPlugin" checkreturn="true"/>
<exec command="make" dir="${phing.dir}/plugins/arArchivesCanadaPlugin" checkreturn="true"/>
<echo>Build Bootstrap 5 theme</echo>
<exec command="npm install" dir="${phing.dir}" checkreturn="true"/>
<exec command="npm run build" dir="${phing.dir}" checkreturn="true"/>
<exec command="rm -rf node_modules" dir="${phing.dir}" checkreturn="true"/>
<echo>Run symfony release task</echo>
<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="git diff --quiet" returnProperty="return_code"/>
<if>
<equals arg1="${return_code}" arg2="0" />
<then>
<echo>You are good to go!</echo>
</then>
<else>
<input propertyName="cont" defaultValue="n" promptChar="?" validArgs="y,n">
You have unstaged changes in your git tree. Are you sure you want to continue?
</input>
<if>
<equals arg1="${cont}" arg2="n"/>
<then>
<fail message="Exiting without changes..."/>
</then>
</if>
</else>
</if>
</target>
<target name="i18n-clean-tx">
<exec command="rm -rf .tx/*"/>
</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, extract 'en' source strings to XLIFF -->
<!-- ===================================================================== -->
<target name="i18n-push-sources"
depends="i18n-clean-tx, i18n-prepare, i18n-extract-sources, i18n-consolidate-sources, i18n-cleanup-sources"
description="Extract 'en' source strings from AtoM"/>
<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-cleanup-sources">
<exec command="find . -not -path "*/\.*" -wholename "*i18n/en" -not \( -name ".tx" -prune \) | xargs -IF rm -rf F"/>
</target>
<!-- ===================================================================== -->
<!-- i18n-push-translations target, extract translations to XLIFF -->
<!-- ===================================================================== -->
<target name="i18n-push-translations"
depends="i18n-clean-tx, i18n-cleanup-create-plugin-i18n-folders-if-missing, i18n-prepare, i18n-extract, i18n-consolidate-translations"
description="Extract translations from AtoM"/>
<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>
<!-- ===================================================================== -->
<!-- i18n-pull-translations target, import translations from .tx folder -->
<!-- ===================================================================== -->
<target name="i18n-pull-translations"
depends="i18n-prepare, i18n-fetch, i18n-rectify, i18n-update-fixtures, i18n-cleanup"
description="Import translations into AtoM, ready to be committed"/>
<target name="i18n-fetch">
<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" depends="i18n-cleanup-create-plugin-i18n-folders-if-missing">
<!-- The extract task is part of Symfony, but fails if a plugin doesn't have an i18n subdirectory -->
<foreach param="lang" target="i18n-cleanup-extract-subtask">
<fileset dir="apps/qubit/i18n/">
<type type="dir"/>
<depth max="0" min="0"/>
</fileset>
</foreach>
<foreach param="plugin" target="i18n-cleanup-remove-empty-plugin-subdirs-subtask">
<fileset dir="plugins/">
<type type="dir"/>
<depth max="0" min="0"/>
</fileset>
</foreach>
</target>
<target name="i18n-cleanup-extract-subtask">
<exec command="php symfony i18n:extract --auto-save --auto-delete --plugins ${lang}" dir="${phing.dir}" checkreturn="true"/>
</target>
<target name="i18n-cleanup-remove-empty-plugin-subdirs-subtask">
<exec command="rmdir plugins/${plugin}/i18n" dir="${phing.dir}"/>
</target>
<target name="i18n-cleanup-create-plugin-i18n-folders-if-missing">
<foreach param="plugin" target="i18n-cleanup-create-plugin-subdirs-subtask">
<fileset dir="plugins/">
<type type="dir"/>
<depth max="0" min="0"/>
</fileset>
</foreach>
</target>
<target name="i18n-cleanup-create-plugin-subdirs-subtask">
<exec command="mkdir plugins/${plugin}/i18n" dir="${phing.dir}"/>
</target>
</project>