forked from jemproject/JEM-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
141 lines (122 loc) · 6.81 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
<!DOCTYPE project> <!-- For Eclipse -->
<project name="JEM" default="build" basedir=".">
<description>Ant Build File for JEM by diesl. Based on Ant build file by Evan Fillman (mole84)</description>
<!-- load variables from config file -->
<property name="cfg.configFile" location="build.config" />
<loadproperties srcfile="${cfg.configFile}" />
<!-- load variables from package xml file -->
<buildnumber file ="build.number" />
<xmlproperty file="package/pkg_jem.xml" prefix="pkg_jem" keepRoot="false" />
<!-- auto values but should be checked -->
<property name="cfg.comName" value="com_${cfg.name}" />
<property name="cfg.comDir" value="${basedir}" /><!-- /${cfg.versionDir}/${cfg.comName} -->
<property name="cfg.buildVersionDir" value="${cfg.buildDir}" /><!-- /${cfg.versionDir} -->
<property name="cfg.adminFilesDir" location="${cfg.comDir}/admin" />
<property name="cfg.siteFilesDir" location="${cfg.comDir}/site" />
<property name="cfg.version" value="${pkg_jem.version}.${build.number}" />
<target name="build" depends="clean, init, build_package, info" />
<target name="init" description="creates nessecary directory to build with">
<mkdir dir="${cfg.buildVersionDir}" />
<mkdir dir="${cfg.buildVersionDir}/plugins" />
<mkdir dir="${cfg.buildVersionDir}/modules" />
<mkdir dir="${cfg.buildVersionDir}/components" />
</target>
<target name="build_package" depends="build_plugins, build_modules, build_component" description="packages the final package file">
<zip destfile="${cfg.buildVersionDir}/pkg_${cfg.name}_v${cfg.version}.zip">
<zipfileset dir="${cfg.buildVersionDir}/components" prefix="packages" />
<zipfileset dir="${cfg.buildVersionDir}/plugins" prefix="packages" />
<zipfileset dir="${cfg.buildVersionDir}/modules" prefix="packages" />
<zipfileset dir="package" />
</zip>
</target>
<target name="build_component" description="packages the final component file">
<zip destfile="${cfg.buildVersionDir}/components/${cfg.comName}.zip" basedir="${cfg.comDir}">
<exclude name="${cfg.buildDir}/**" />
<exclude name=".settings/**" />
<exclude name=".*" />
<exclude name="build.*" />
<exclude name="3rd/**" />
<exclude name="modules/**" />
<exclude name="package/**" />
<exclude name="plugins/**" />
</zip>
</target>
<target name="build_plugins" description="packages any plugins">
<!-- add all plugin directories here -->
<zip destfile="${cfg.buildVersionDir}/plugins/plg_search_${cfg.name}.zip" basedir="plugins/plg_search_${cfg.name}" />
<zip destfile="${cfg.buildVersionDir}/plugins/plg_finder_${cfg.name}.zip" basedir="plugins/plg_finder_${cfg.name}" />
<zip destfile="${cfg.buildVersionDir}/plugins/plg_${cfg.name}_comments.zip" basedir="plugins/plg_${cfg.name}_comments" />
<zip destfile="${cfg.buildVersionDir}/plugins/plg_${cfg.name}_mailer.zip" basedir="plugins/plg_${cfg.name}_mailer" />
</target>
<target name="build_modules" description="packages any modules">
<!-- add all module directories here -->
<zip destfile="${cfg.buildVersionDir}/modules/mod_${cfg.name}.zip" basedir="modules/mod_${cfg.name}" />
<zip destfile="${cfg.buildVersionDir}/modules/mod_${cfg.name}_wide.zip" basedir="modules/mod_${cfg.name}_wide" />
<zip destfile="${cfg.buildVersionDir}/modules/mod_${cfg.name}_cal.zip" basedir="modules/mod_${cfg.name}_cal" />
<zip destfile="${cfg.buildVersionDir}/modules/mod_${cfg.name}_teaser.zip" basedir="modules/mod_${cfg.name}_teaser" />
</target>
<!--
<target name="build_debug" description="builds any debug plugins or code">
<zip destfile="${cfg.buildVersionDir}/plugins/plg_${cfg.name}_toolbox.zip" basedir="${cfg.versionDir}/billets_plugin_toolbox" />
<zip destfile="${cfg.buildVersionDir}/plugins/plg_${cfg.name}_debug.zip" basedir="${cfg.versionDir}/billets_plugin_debug" />
</target>
-->
<target name="info" description="prints information">
<echo message="Project: ${cfg.name}" />
<echo message="Version: ${cfg.version}" />
<tstamp>
<format property="buildtime" pattern="yyyy-MM-dd'T'HH:mm:ss" />
</tstamp>
<echo message="Buildtime: ${buildtime}" />
</target>
<target name="clean" description="Destroys all generated files and dirs.">
<delete dir="${cfg.buildVersionDir}" />
<delete dir="${cfg.buildDir}" />
<delete file="${cfg.xmlfile}" />
</target>
<target name="update_localhost" depends="info" description="attemps to update files on localhost server with files from working directory">
<copy todir="${cfg.localhostRoot}/administrator/components/${cfg.comName}" overwrite="true">
<fileset dir="${cfg.adminFilesDir}" />
<fileset file="${cfg.comDir}/${cfg.name}.xml" />
<fileset file="${cfg.comDir}/script.php" />
</copy>
<copy todir="${cfg.localhostRoot}/components/${cfg.comName}" overwrite="true">
<fileset dir="${cfg.siteFilesDir}" />
</copy>
<copy todir="${cfg.localhostRoot}/media/${cfg.comName}">
<fileset dir="${cfg.comDir}/media/" />
</copy>
</target>
<target name="upload" description="attempts to upload build file to ftp server">
<fileset id="ftp.upload.fileset" dir="${cfg.buildVersionDir}">
<include name="*.zip" />
</fileset>
<echo>FTP target is ${ftp.server}</echo>
<ftp server="${ftp.server}" userid="${ftp.user}" password="${ftp.password}" action="put" remotedir="${ftp.dir}" passive="yes">
<fileset refid="ftp.upload.fileset" />
</ftp>
</target>
<target name="build_xml" description="builds an xml listing of all the files in the working copy">
<fileset id="site" dir="${cfg.siteFilesDir}" />
<echo message="${line.separator}<files folder="site">${line.separator}<filename>" file="${cfg.xmlfile}" append="false" />
<echo-fileset filesetref="site" />
<echo message="</filename>${line.separator}</files>${line.separator}" file="${cfg.xmlfile}" append="true" />
<fileset id="admin" dir="${cfg.adminFilesDir}" />
<echo message="${line.separator}<files folder="admin">${line.separator}<filename>" file="${cfg.xmlfile}" append="true" />
<echo-fileset filesetref="admin" />
<echo message="</filename>${line.separator}</files>${line.separator}" file="${cfg.xmlfile}" append="true" />
<replace file="${cfg.xmlfile}" token="${cfg.siteFilesDir}/" value="" />
<replace file="${cfg.xmlfile}" token="${cfg.adminFilesDir}/" value="" />
</target>
<macrodef name="echo-fileset" description="creates a printable directory listing">
<attribute name="filesetref" />
<sequential>
<pathconvert pathsep="</filename>${line.separator}<filename>" property="@{filesetref}.echopath">
<path>
<fileset refid="@{filesetref}" />
</path>
</pathconvert>
<echo message="${@{filesetref}.echopath}" file="${cfg.xmlfile}" append="true" />
</sequential>
</macrodef>
</project>