forked from LibreBooking/app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
197 lines (161 loc) · 8.15 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
<?xml version="1.0"?>
<project name="booked" default="package">
<property name="version" value="2.8.5"/>
<property name="is.pre.release" value="false"/>
<property name="packagename" value="booked-${version}"/>
<property name="root.dir" value="../.."/>
<property name="zipdirectory" value="${root.dir}/booked_archive/zip/${version}"/>
<property name="archive_directory" value="${root.dir}/booked_archive/src/${version}"/>
<property name="staging" value="${root.dir}/staging"/>
<property name="stagingdir" value="${staging}/booked"/>
<property name="demo.dir" value="${root.dir}/booked_archive/src/demo"/>
<property name="phing.tasks.dir" value="c:/php/pear/phing/tasks/my"/>
<available file="C:\wamp64\bin\mysql\mysql5.7.26" property="mysql.bin" value="C:\wamp64\bin\mysql\mysql5.7.26\bin"/>
<available file="C:\wamp64\bin\mysql\mysql8.0.18" property="mysql.bin" value="C:\wamp64\bin\mysql\mysql8.0.18\bin"/>
<property name="mysql.username" value="root"/>
<property name="mysql.password" value="root"/>
<property name="mysql.server" value="127.0.0.1"/>
<property name="mysql.database" value="booked"/>
<property name="sql.file.create.db" value="database_schema/create-db.sql"/>
<property name="sql.file.create.schema" value="database_schema/create-schema.sql"/>
<!-- <property name="sql.file.create.user" value="database_schema/create-user.sql"/>-->
<property name="sql.file.data" value="database_schema/create-data.sql"/>
<property name="sql.file.full" value="database_schema/full-install.sql"/>
<property name="sql.file.test.data" value="database_schema/sample-data-utf8.sql"/>
<target name="setup.db" description="setting up the latest version of the database">
<if>
<equals arg1="${mysql.password}" arg2=""/>
<then>
<input propertyName="mysql.password" defaultValue="" promptChar="?">mysql password</input>
</then>
</if>
<phingcall target="baseline.db">
<property name="mysql.password" value="${mysql.password}"/>
</phingcall>
<phingcall target="upgrade.db">
<property name="mysql.password" value="${mysql.password}"/>
</phingcall>
</target>
<target name="baseline.db" description="baseline db">
<if>
<equals arg1="${mysql.password}" arg2=""/>
<then>
<input propertyName="mysql.password" defaultValue="" promptChar="?">mysql password</input>
</then>
</if>
<echo message="Using MySQL from ${mysql.bin}"/>
<echo message="Create db file: ${sql.file.create.db}"/>
<exec command="mysql --user=${mysql.username} --password=${mysql.password} --host=${mysql.server} mysql < ${phing.dir}/${sql.file.create.db}"
checkreturn="true"
dir="${mysql.bin}"/>
<echo message="Create schema file: ${sql.file.create.schema}"/>
<exec command="${mysql.bin}\mysql --user=${mysql.username} --password=${mysql.password} --host=${mysql.server} ${mysql.database} < ${phing.dir}/${sql.file.create.schema}"
checkreturn="true"
dir="${mysql.bin}"/>
<!-- <echo message="Create user file: ${sql.file.create.user}"/>-->
<!-- <exec command="${mysql.bin}\mysql --user=${mysql.username} --password=${mysql.password} --host=${mysql.server} ${mysql.database} < ${phing.dir}/${sql.file.create.user}"-->
<!-- checkreturn="true"-->
<!-- dir="${mysql.bin}"/>-->
</target>
<target name="upgrade.db" depends="custom.tasks">
<if>
<equals arg1="${mysql.password}" arg2=""/>
<then>
<input propertyName="mysql.password" defaultValue="" promptChar="?">mysql password</input>
</then>
</if>
<exec passthru="true" escape="false" command="php ${application.startdir}/phing-tasks/UpgradeDbTask.php
${mysql.username}
${mysql.password}
${mysql.server}
${mysql.database} ${application.startdir}/database_schema"/>
<echo message="Application data file: ${sql.file.data}"/>
<exec command="${mysql.bin}\mysql --user=${mysql.username} --password=${mysql.password} --host=${mysql.server} ${mysql.database} < ${application.startdir}/${sql.file.data}"
checkreturn="true"
dir="${mysql.bin}"/>
<echo message="Test data file: ${sql.file.test.data}"/>
<exec command="mysql --user=${mysql.username} --password=${mysql.password} --host=${mysql.server} ${mysql.database} < ${application.startdir}/${sql.file.test.data}"
checkreturn="true"
passthru="true"
dir="${mysql.bin}"/>
</target>
<target name="package" description="packages all required files" depends="stage.files">
<delete dir="${zipdirectory}" failonerror="false"/>
<mkdir dir="${zipdirectory}"/>
<tstamp/>
<property name="zip.file.name" value="${zipdirectory}/${packagename}.zip"/>
<zip destfile="${zip.file.name}">
<fileset dir="${staging}">
<include name="**/*"/>
</fileset>
</zip>
<delete dir="${archive_directory}" failonerror="false"/>
<mkdir dir="${archive_directory}"/>
<copy todir="${archive_directory}" includeemptydirs="true">
<fileset dir="${staging}">
<include name="**/*"/>
</fileset>
</copy>
<delete dir="${staging}" failonerror="false"/>
</target>
<target name="stage.files">
<delete dir="${staging}" failonerror="false"/>
<mkdir dir="${staging}"/>
<mkdir dir="${stagingdir}"/>
<copy todir="${stagingdir}" includeemptydirs="true">
<fileset dir=".">
<include name="**/*"/>
<exclude name="**.psd"/>
<exclude name="**.bak"/>
<exclude name="*test*"/>
<exclude name=".project"/>
<exclude name="build.bat"/>
<exclude name="build.xml"/>
<exclude name="**/tests/**"/>
<exclude name="**/docs/**"/>
<exclude name="tpl_c/*.*"/>
<exclude name=".git*/**"/>
<exclude name=".idea"/>
<exclude name=".idea/**"/>
<exclude name=".settings/**"/>
<exclude name="_excludes.txt"/>
<exclude name="pdt_templates.xml"/>
<exclude name="**/*.zip"/>
<exclude name="**/*.jar"/>
<exclude name="**/phing-tasks/**"/>
<exclude name="*phing-tasks*"/>
<exclude name="**/uploads/images/*"/>
<exclude name="**/uploads/reservation/*"/>
<exclude name="vendor/**"/>
<exclude name="**/config.php"/>
<exclude name="**/*.config.php"/>
<exclude name="config/log4php.config.xml"/>
<exclude name="*phpunit*"/>
<exclude name="composer*"/>
<include name="**/qrconfig.php"/>
<include name="**/.htaccess"/>
</fileset>
</copy>
<copy tofile="${stagingdir}/lib/external/phpqrcode/qrconfig.php" file="./lib/external/phpqrcode/qrconfig.php"/>
<delete dir="${stagingdir}/.ebextensions" includeemptydirs="true"/>
<phingcall target="combine.db.files">
</phingcall>
<append destFile="${stagingdir}/${sql.file.full}">
<filelist dir="${stagingdir}/database_schema"
files="create-schema.sql,create-data.sql"/>
</append>
</target>
<target name="combine.db.files" depends="custom.tasks">
<exec passthru="true" escape="false" command="php ${application.startdir}/phing-tasks/CombineDbFilesTask.php
${stagingdir}/database_schema
${stagingdir}/${sql.file.create.schema}
${stagingdir}/${sql.file.data}"/>
</target>
<target name="custom.tasks">
<copy todir="${phing.tasks.dir}">
<fileset dir="phing-tasks">
<include name="*.php"/>
</fileset>
</copy>
</target>
</project>