-
Notifications
You must be signed in to change notification settings - Fork 19
/
build.xml
206 lines (187 loc) · 9.45 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="geeklog" basedir="." default="help">
<!-- Some properties are now taken from the "build.properties" file in the root directory -->
<property file="./build.properties"/>
<property name="srcDir" value="." override="false"/>
<property name="dstDir" value="./build" override="false"/>
<!-- Define custom tasks -->
<includepath classpath="${srcDir}/system/build/tasks"/>
<taskdef name="myDiff" classname="MyDiffTask"/>
<taskdef name="MyRemoveUnchangedFiles" classname="MyRemoveUnchangedFilesTask"/>
<!-- ============================== -->
<!-- Target: help -->
<!-- ============================== -->
<target name="help">
<echo msg="Geeklog building tools"/>
<echo msg="----------------------"/>
<echo msg="First of all, change the directory to the root directory of the repository, where 'build.xml' resides."/>
<echo msg="Then, edit the 'build.properties' file in the root directory, if necessary."/>
<echo msg="For Unixy users, please use 'phing' instead of 'phing.bat' in the descriptions below."/>
<echo msg=""/>
<echo msg="To show help [this screen], enter:"/>
<echo msg="./system/build/vendor/phing/phing/bin/phing.bat[ENTER]"/>
<echo msg=""/>
<echo msg="To create an INSTALL distribution tarball, enter:"/>
<echo msg="./system/build/vendor/phing/phing/bin/phing.bat dist[ENTER]"/>
<echo msg=""/>
<echo msg="To create an UPGRADE distribution tarball, enter:"/>
<echo msg="./system/build/vendor/phing/phing/bin/phing.bat dist-upgrade[ENTER]"/>
<echo msg=""/>
<echo msg="To synchronize language files, enter:"/>
<echo msg="./system/build/vendor/phing/phing/bin/phing.bat lang[ENTER]"/>
</target>
<!-- ============================== -->
<!-- Target: lang -->
<!-- ============================== -->
<target name="lang">
<echo msg="Synchronizing language files..."/>
<if>
<os family="windows"/>
<then>
<exec executable="uplng.bat" dir="${srcDir}/system/build/lm">
<arg value="${version}"/>
</exec>
</then>
<else>
<exec executable="${srcDir}/system/build/lm/uplng.sh" dir="${srcDir}">
<arg value="${version}"/>
</exec>
</else>
</if>
<echo msg="Done."/>
</target>
<!-- ============================== -->
<!-- Target: prepare -->
<!-- ============================== -->
<target name="prepare">
<echo msg="Making directory ${dstDir}..."/>
<delete dir="${dstDir}" quiet="true"/>
<mkdir dir="${dstDir}"/>
</target>
<!-- ============================== -->
<!-- Target: build -->
<!-- ============================== -->
<target name="build" depends="prepare">
<!-- Create the "changed-files" and "removed-files" files -->
<myDiff previousVersionSHA="${previousVersionSHA}" currentVersionSHA="${currentVersionSHA}"/>
<!-- Copy files -->
<echo msg="Copying files..."/>
<copy todir="${dstDir}">
<fileset dir="${srcDir}">
<exclude name=".git"/>
<exclude name=".git/**"/>
<exclude name=".gitignore"/>
<exclude name=".idea"/>
<exclude name=".idea/**"/>
<exclude name="build"/>
<exclude name="build/**"/>
<exclude name="build.xml"/>
<exclude name="build.properties"/>
<exclude name="phpunit.xml"/>
<exclude name="**/buildpackage.php"/>
<exclude name="public_html/layout/glnet_curve"/>
<exclude name="public_html/layout/glnet_curve/**"/>
<exclude name="system/build"/>
<exclude name="system/build/**"/>
<exclude name="system/composer.phar"/>
<exclude name="**/tests"/>
<exclude name="**/tests/**"/>
<exclude name="**/*.php.dist"/>
<exclude name="*.tar.gz"/>
<exclude name="**/node_modules"/>
<exclude name="**/node_modules/**"/>
<exclude name="**/css_src/dest"/>
<exclude name="**/css_src/dest/**"/>
</fileset>
</copy>
<!-- Move *.php.dist files -->
<copy file="${srcDir}/db-config.php.dist" tofile="${dstDir}/db-config.php"/>
<copy file="${srcDir}/system/lib-custom.php.dist" tofile="${dstDir}/system/lib-custom.php"/>
<copy file="${srcDir}/public_html/siteconfig.php.dist" tofile="${dstDir}/public_html/siteconfig.php"/>
<!-- Move filemanager configuration file -->
<copy file="${srcDir}/public_html/filemanager/config/filemanager.config.default.json"
tofile="${dstDir}/public_html/filemanager/config/filemanager.config.json" overwrite="true"/>
<!-- Change permissions -->
<echo msg="Changing directory and file permissions..."/>
<chmod file="${dstDir}/db-config.php" mode="${perm_file_w}"/>
<chmod file="${dstDir}/cron-emailgeeklogdailydigest" mode="${perm_file_x}"/>
<chmod file="${dstDir}/cron-emailgeeklogdatabasebackup" mode="${perm_file_x}"/>
<chmod file="${dstDir}/backups" mode="${perm_dir_w}"/>
<chmod file="${dstDir}/data" mode="${perm_dir_w}"/>
<chmod file="${dstDir}/data/layout_cache" mode="${perm_dir_w}"/>
<chmod file="${dstDir}/data/layout_css" mode="${perm_dir_w}"/>
<chmod file="${dstDir}/logs" mode="${perm_dir_w}"/>
<chmod mode="${perm_file_w}">
<fileset dir="${dstDir}/logs">
<include name="*.log"/>
</fileset>
</chmod>
<chmod file="${dstDir}/public_html/backend" mode="${perm_dir_w}"/>
<chmod mode="${perm_file_w}">
<fileset dir="${dstDir}/public_html/backend">
<include name="*.rss"/>
</fileset>
</chmod>
<chmod file="${dstDir}/public_html/images/articles" mode="${perm_dir_w}"/>
<chmod mode="${perm_file_w}">
<fileset dir="${dstDir}/public_html/images/articles">
<include name="*,*.*"/>
</fileset>
</chmod>
<chmod file="${dstDir}/public_html/images/library" mode="${perm_dir_w}"/>
<chmod file="${dstDir}/public_html/images/library/File" mode="${perm_dir_w}"/>
<chmod file="${dstDir}/public_html/images/library/Flash" mode="${perm_dir_w}"/>
<chmod file="${dstDir}/public_html/images/library/Image" mode="${perm_dir_w}"/>
<chmod file="${dstDir}/public_html/images/library/Image/_thumbs" mode="${perm_dir_w}"/>
<chmod file="${dstDir}/public_html/images/library/Media" mode="${perm_dir_w}"/>
<chmod file="${dstDir}/public_html/images/topics" mode="${perm_dir_w}"/>
<chmod mode="${perm_file_w}">
<fileset dir="${dstDir}/public_html/images/topics">
<include name="*,*.*"/>
</fileset>
</chmod>
<chmod file="${dstDir}/public_html/images/userphotos" mode="${perm_dir_w}"/>
<chmod mode="${perm_file_w}">
<fileset dir="${dstDir}/public_html/images/userphotos">
<include name="*,*.*"/>
</fileset>
</chmod>
<chmod file="${dstDir}/public_html/images/_thumbs" mode="${perm_dir_w}"/>
<chmod file="${dstDir}/public_html/images/_thumbs/articles" mode="${perm_dir_w}"/>
<chmod file="${dstDir}/public_html/images/_thumbs/userphotos" mode="${perm_dir_w}"/>
<chmod file="${dstDir}/public_html/filemanager/config/filemanager.config.json" mode="${perm_file_w}"/>
<chmod file="${dstDir}/public_html/siteconfig.php" mode="${perm_file_w}"/>
</target>
<!-- ============================== -->
<!-- Target: dist -->
<!-- ============================== -->
<target name="dist" depends="build">
<echo msg="Creating an INSTALL package..."/>
<delete file="${project.basedir}/geeklog-${version}.tar.gz" quiet="true"/>
<tar destfile="${project.basedir}/geeklog-${version}.tar.gz" compression="gzip">
<fileset dir="${dstDir}">
<include name="*"/>
</fileset>
</tar>
<echo msg="Removing work files..."/>
<delete dir="${dstDir}"/>
<echo msg="Files copied and compressed in the current directory OK!"/>
</target>
<!-- ============================== -->
<!-- Target: dist-upgrade -->
<!-- ============================== -->
<target name="dist-upgrade" depends="build">
<echo msg="Creating an UPGRADE package..."/>
<!-- Remove unchanged file and create the "removed-files" file -->
<MyRemoveUnchangedFiles previousVersionSHA="${previousVersionSHA}" currentVersionSHA="${currentVersionSHA}" dstDir="${dstDir}"/>
<delete file="${project.basedir}/geeklog-${previousVersion}-to-${version}.tar.gz" quiet="true"/>
<tar destfile="${project.basedir}/geeklog-${previousVersion}-to-${version}.tar.gz" compression="gzip">
<fileset dir="${dstDir}">
<include name="*"/>
</fileset>
</tar>
<echo msg="Removing work files..."/>
<delete dir="${dstDir}"/>
<echo msg="Files copied and compressed in the current directory OK!"/>
</target>
</project>