-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension_packager.xml
executable file
·224 lines (190 loc) · 6.43 KB
/
extension_packager.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
<?xml version="1.0" encoding="UTF-8"?>
<!-- ================================================================== -->
<!-- redITEM packager -->
<!-- This PHING build file generates the redITEM extension package -->
<!-- To use in your environment do the following steps: -->
<!-- Change the following variables in build.properties file -->
<!-- (copy variables from build.properties.dist ) -->
<!-- - change the version in variable comp.version -->
<!-- - change the package folder path in variable package.dir -->
<!-- - execute this PHING build file -->
<!-- ================================================================== -->
<project name="com_redproductfinder" default="pack">
<!-- ============================================ -->
<!-- Create packages folder -->
<!-- ============================================ -->
<target name="prepare">
<property
name="clean-tempdir"
value="true"
override="false"/>
<if>
<not>
<isset property="package.dir" />
</not>
<then>
<fail msg="package.dir not specified, specify package.dir in build.properties file" />
</then>
</if>
<!-- Folder where the redPRODUCTFINDER repository is located -->
<property
name="extpath"
value="."
override="true"/>
<xmlproperty file="${extpath}/${extension}.xml" prefix="extensionDetails" keepRoot="false" />
<xmlproperty file="${extpath}/redCORE/redcore.xml" prefix="redCOREDetails" keepRoot="false" />
<property
name="version"
value="${extensionDetails.version}"
override="true"/>
<property
name="redCOREVersion"
value="${redCOREDetails.version}"
override="true"/>
<!-- Temp dir to create packages -->
<property
name="tmpdir"
value=".tmp"
override="true"/>
<if>
<equals arg1="clean-tempdir" arg2="1" />
<then>
<!-- Check if the temp folder exists. If not, create it -->
<if>
<available file="${tmpdir}" type="dir"/>
<then>
<echo msg="Removing old ${tmpdir}"/>
<delete dir="${tmpdir}"/>
</then>
</if>
<echo msg="Making directory to store the temporary packages at ${tmpdir}"/>
<mkdir dir="${tmpdir}"/>
</then>
</if>
</target>
<!-- ============================================ -->
<!-- Target: build -->
<!-- ============================================ -->
<!-- Copy the source files to the target folder -->
<target name="build" depends="prepare, copyredcore">
<echo msg="Copying INSTALLER files to build directory..."/>
<copy todir="${tmpdir}/${extension}">
<fileset dir="${extpath}/">
<include name="LICENSE.txt"/>
<include name="redproductfinder.xml"/>
<include name="install.php"/>
</fileset>
</copy>
<echo msg="Copying COMPONENT folder to build directory..."/>
<copy todir="${tmpdir}/${extension}/component">
<fileset dir="${extpath}/component">
<include name="**"/>
<exclude name=".*"/>
</fileset>
</copy>
<echo msg="Copying MEDIA folder to build directory..."/>
<copy todir="${tmpdir}/${extension}/media/com_${extension}">
<fileset dir="${extpath}/media/com_${extension}">
<include name="**"/>
<exclude name=".*"/>
</fileset>
</copy>
</target>
<!-- ============================================ -->
<!-- (redCORE) Target: copyredcore -->
<!-- ============================================ -->
<target name="copyredcore">
<phing phingfile="${project.basedir}/redCORE/redcore_copy_mandatory.xml"
target="copyframework"
haltonfailure="true">
<property name="redcoretargetdir" value="${tmpdir}/${extension}/redCORE" />
<property name="redcorepath" value="${project.basedir}/redCORE" />
</phing>
</target>
<!-- ============================================ -->
<!-- (DEFAULT) Target: dist -->
<!-- ============================================ -->
<target name="compress">
<echo msg="Creating ZIP archive..."/>
<!-- Extension ZIP packaging -->
<if>
<available file="${package.dir}/${extension}-v${version}.zip" property="test_zip_exists" value="Yes"/>
<then>
<echo msg="Removing old ZIP"/>
<delete file="${package.dir}/${extension}-v${version}.zip" />
</then>
</if>
<if>
<available file="${tmpdir}/${extension}-v${version}.zip" property="test_zip_exists" value="Yes"/>
<then>
<delete file="${tmpdir}/${extension}-v${version}.zip" />
</then>
</if>
<zip destfile="${tmpdir}/${extension}-v${version}.zip">
<fileset dir="${tmpdir}/${extension}">
<include name="**"/>
<exclude name=".*"/>
</fileset>
</zip>
<copy file="${tmpdir}/${extension}-v${version}.zip" tofile="${package.dir}/${extension}-v${version}.zip" />
<echo msg="Files copied and compressed in build directory OK!"/>
</target>
<target name="clean-tmp">
<delete dir="${tmpdir}"/>
</target>
<target name="prepare-compress-clean" depends="prepare, compress-clean">
<!-- needed for external cleaning and compressing -->
</target>
<target name="compress-clean" depends="compress, clean-tmp">
<!-- needed for external cleaning and compressing -->
</target>
<target name="dist" depends="build, compress-clean">
<echo msg="Build successful!"/>
</target>
<target name="pack">
<!-- Do initialization stuff -->
<if>
<not>
<available file="build.properties" type="file" />
</not>
<then>
<fail msg="File not found: build.properties" />
</then>
</if>
<property file="build.properties" override="true"/>
<property
name="extension"
value="${comp.name}"
override="true"/>
<phingcall target="dist" />
</target>
<target name="autopack">
<property
name="package.dir"
value=".dist"
override="false"/>
<property
name="extension"
value="redproductfinder"
override="false"/>
<property
name="package.delete"
value="true"
override="false"/>
<property
name="package.routine"
value="dist"
override="false"/>
<if>
<and>
<available file="${package.dir}" type="dir"/>
<equals arg1="${package.delete}" arg2="1" />
</and>
<then>
<echo msg="Removing old autopack folder"/>
<delete dir="${package.dir}"/>
</then>
</if>
<phingcall target="${package.routine}" />
</target>
</project>