forked from LibreBooking/app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
173 lines (159 loc) · 8.11 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
<?xml version="1.0"?>
<!-- doc: https://www.phing.info/guide/hlhtml/#d5e653 -->
<!-- php and mysql command have to be in your PATH -->
<project name="librebooking" default="package">
<property name="packagename" value="librebooking" />
<property name="build.dir" value="build" />
<property name="stagingdir" value="${build.dir}/staging" />
<property name="zipdirectory" value="${build.dir}/zip" />
<property name="bundle_directory" value="${build.dir}/bundle" />
<property name="mysql.username" value="test" />
<property name="mysql.password" value="test" />
<property name="mysql.server" value="127.0.0.1" />
<property name="mysql.database" value="librebooking" />
<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="custom.tasks">
<!-- <copy todir="${phing.tasks.dir}">
<fileset dir="phing-tasks">
<include name="*.php"/>
</fileset>
</copy> -->
</target>
<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" />
<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" />
<!-- <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="stage.files">
<delete dir="${stagingdir}" failonerror="false" />
<mkdir dir="${stagingdir}" />
<copy todir="${stagingdir}" includeemptydirs="true">
<fileset dir=".">
<include name="**/*" />
<!-- config files -->
<exclude name="**/config.php" />
<exclude name="**/config.devel.php" />
<exclude name="**/*.config.php" />
<exclude name="config/log4php.config.xml" />
<!-- user files -->
<exclude name="**/uploads/images/*" />
<exclude name="**/uploads/reservation/*" />
<!-- asset resources -->
<exclude name="**.psd" />
<exclude name="**.bak" />
<exclude name="**/*.zip" />
<!-- temporary files -->
<exclude name="tpl_c/*.*" />
<exclude name="var/**" />
<!-- project / IDE files -->
<exclude name=".project" />
<exclude name=".idea/**" />
<exclude name=".vscode/**" />
<exclude name="**/*.code-workspace" />
<exclude name="**/*.sublime-*" />
<exclude name="**/*.jar" />
<!-- development libraries -->
<exclude name="composer*" />
<exclude name=".phive/**" />
<exclude name="vendor/**" />
<!-- testing -->
<exclude name="*phpunit*" />
<exclude name="**/tests/**" />
<exclude name="*test*" />
<!-- build stuff / tools -->
<exclude name="tools/**" />
<exclude name="**/*.bat" />
<exclude name="**/*.ps1" />
<exclude name="build/**" />
<exclude name="build.xml" />
<exclude name="**/phing-tasks/**" />
<exclude name=".php-cs-fixer*" />
<!-- documentation -->
<exclude name="**/doc/**" />
<exclude name="**/docs/**" />
<exclude name="phpdoc.*" />
<exclude name=".phpdoc/**" />
<!-- version control -->
<exclude name=".git*/**" />
<include name="**/qrconfig.php" />
<include name="**/.htaccess" />
</fileset>
</copy>
<copy tofile="${stagingdir}/lib/external/phpqrcode/qrconfig.php" file="./lib/external/phpqrcode/qrconfig.php" />
<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="package" description="packages all required files" depends="stage.files">
<tstamp />
<property name="zip.file.name" value="${build.dir}/${packagename}.zip" />
<zip destfile="${zip.file.name}">
<fileset dir="${stagingdir}">
<include name="**/*" />
</fileset>
</zip>
<delete dir="${bundle_directory}" failonerror="false" />
<mkdir dir="${bundle_directory}" />
<copy todir="${bundle_directory}" includeemptydirs="true">
<fileset dir="${stagingdir}">
<include name="**/*" />
</fileset>
</copy>
<delete dir="${stagingdir}" failonerror="false" />
</target>
</project>