| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
|
| 3 |
<project name="portal" default="all" basedir=".."> |
| 4 |
|
| 5 |
<property file="${basedir}/override.properties" /> |
| 6 |
<property file="${basedir}/build.properties" /> |
| 7 |
|
| 8 |
<taskdef resource="net/sf/antcontrib/antlib.xml"> |
| 9 |
<classpath> |
| 10 |
<pathelement location="${basedir}/lib/ant-contrib-1.0b2.jar" /> |
| 11 |
</classpath> |
| 12 |
</taskdef> |
| 13 |
|
| 14 |
<property name="files.dir" value="${portal.home}/files"/> |
| 15 |
<property name="patches.dir" value="${portal.home}/patches"/> |
| 16 |
|
| 17 |
<property name="shell.cmd" value="sh"/> |
| 18 |
<property name="shell.options" value="-c"/> |
| 19 |
|
| 20 |
<target name="check.os" |
| 21 |
description="--> Check OS"> |
| 22 |
<condition property="isWindows"> |
| 23 |
<os family="windows" /> |
| 24 |
</condition> |
| 25 |
</target> |
| 26 |
|
| 27 |
<target name="setup.shell" depends="check.os" if="isWindows" |
| 28 |
description="--> Setup shell parameters"> |
| 29 |
<property name="shell.cmd" value="cmd.exe"/> |
| 30 |
<property name="shell.options" value="/c"/> |
| 31 |
</target> |
| 32 |
|
| 33 |
<!-- =================================================================== --> |
| 34 |
<!-- REMOVE PORTAL --> |
| 35 |
<!-- =================================================================== --> |
| 36 |
|
| 37 |
<target name="remove" |
| 38 |
description="--> Remove portal"> |
| 39 |
<delete dir="${portal.dir}"/> |
| 40 |
</target> |
| 41 |
|
| 42 |
<!-- =================================================================== --> |
| 43 |
<!-- CLEAN PORTAL --> |
| 44 |
<!-- =================================================================== --> |
| 45 |
|
| 46 |
<target name="clean" |
| 47 |
description="--> Clean portal"> |
| 48 |
<exec |
| 49 |
executable="${shell.cmd}" |
| 50 |
failonerror="true" |
| 51 |
dir="${portal.dir}" |
| 52 |
> |
| 53 |
<arg line="${shell.options} 'maven ${jetspeed2.build.options} allClean'"/> |
| 54 |
</exec> |
| 55 |
|
| 56 |
</target> |
| 57 |
|
| 58 |
<!-- =================================================================== --> |
| 59 |
<!-- CHECKOUT PORTAL --> |
| 60 |
<!-- =================================================================== --> |
| 61 |
|
| 62 |
<target name="checkout" |
| 63 |
description="--> Checkout portal"> |
| 64 |
<delete dir="${portal.dir}"/> |
| 65 |
<exec |
| 66 |
executable="svn" |
| 67 |
dir="${portal.home}" |
| 68 |
> |
| 69 |
<arg line="checkout http://svn.apache.org/repos/asf/portals/jetspeed-2/trunk/ --revision ${jetspeed2.revision} jetspeed-2"/> |
| 70 |
</exec> |
| 71 |
|
| 72 |
</target> |
| 73 |
|
| 74 |
<!-- =================================================================== --> |
| 75 |
<!-- UPDATE PORTAL --> |
| 76 |
<!-- =================================================================== --> |
| 77 |
|
| 78 |
<target name="update" |
| 79 |
description="--> Update portal"> |
| 80 |
<antcall target="files"/> |
| 81 |
<antcall target="patches"/> |
| 82 |
<antcall target="update.psml"/> |
| 83 |
<antcall target="files.for.custom"/> |
| 84 |
<antcall target="patches.for.custom"/> |
| 85 |
<antcall target="update.portal.info"/> |
| 86 |
</target> |
| 87 |
|
| 88 |
<target name="update.base" |
| 89 |
description="--> Update portal"> |
| 90 |
<antcall target="files"/> |
| 91 |
<antcall target="patches"/> |
| 92 |
</target> |
| 93 |
|
| 94 |
<target name="files"> |
| 95 |
<!-- remove files from jetspeed2 --> |
| 96 |
<for list="${portal.delete.files}" param="delete.file"> |
| 97 |
<sequential> |
| 98 |
<delete file="${portal.dir}/@{delete.file}"/> |
| 99 |
</sequential> |
| 100 |
</for> |
| 101 |
<!-- remove directories from jetspeed2 --> |
| 102 |
<for list="${portal.delete.directories}" param="delete.directory"> |
| 103 |
<sequential> |
| 104 |
<delete dir="${portal.dir}/@{delete.directory}"/> |
| 105 |
</sequential> |
| 106 |
</for> |
| 107 |
|
| 108 |
<!-- copy files to jetspeed2 --> |
| 109 |
<mkdir dir="${files.dir}"/> |
| 110 |
<copy todir="${portal.dir}"> |
| 111 |
<fileset dir="${files.dir}"> |
| 112 |
<include name="**"/> |
| 113 |
</fileset> |
| 114 |
</copy> |
| 115 |
</target> |
| 116 |
|
| 117 |
<target name="files.for.custom" unless="build.dist"> |
| 118 |
<!-- Additional Files --> |
| 119 |
<!-- remove files from jetspeed2 --> |
| 120 |
<for list="${additional.portal.delete.files}" param="delete.file"> |
| 121 |
<sequential> |
| 122 |
<delete file="${portal.dir}/@{delete.file}"/> |
| 123 |
</sequential> |
| 124 |
</for> |
| 125 |
<!-- remove directories from jetspeed2 --> |
| 126 |
<for list="${additional.portal.delete.directories}" param="delete.directory"> |
| 127 |
<sequential> |
| 128 |
<delete dir="${portal.dir}/@{delete.directory}"/> |
| 129 |
</sequential> |
| 130 |
</for> |
| 131 |
|
| 132 |
<!-- copy files to jetspeed2 --> |
| 133 |
<mkdir dir="${additional.portal.files.dir}"/> |
| 134 |
<copy todir="${portal.dir}"> |
| 135 |
<fileset dir="${additional.portal.files.dir}"> |
| 136 |
<include name="**"/> |
| 137 |
</fileset> |
| 138 |
</copy> |
| 139 |
|
| 140 |
</target> |
| 141 |
|
| 142 |
<target name="patches"> |
| 143 |
<for list="${portal.patch.files}" param="patch.file"> |
| 144 |
<sequential> |
| 145 |
<patch patchfile="${patches.dir}/@{patch.file}" |
| 146 |
dir="${portal.dir}" |
| 147 |
originalfile="${portal.dir}/@{patch.file}" |
| 148 |
ignorewhitespace="yes" |
| 149 |
strip="0"/> |
| 150 |
</sequential> |
| 151 |
</for> |
| 152 |
</target> |
| 153 |
|
| 154 |
<target name="patches.for.custom" unless="build.dist"> |
| 155 |
<!-- Additional Patches --> |
| 156 |
<for list="${additional.portal.patch.files}" param="patch.file"> |
| 157 |
<sequential> |
| 158 |
<patch patchfile="${additional.portal.patches.dir}/@{patch.file}" |
| 159 |
dir="${portal.dir}" |
| 160 |
originalfile="${portal.dir}/@{patch.file}" |
| 161 |
ignorewhitespace="yes" |
| 162 |
strip="0"/> |
| 163 |
</sequential> |
| 164 |
</for> |
| 165 |
</target> |
| 166 |
|
| 167 |
<target name="update.psml"> |
| 168 |
<!-- copy files to jetspeed2 --> |
| 169 |
<delete dir="${files.dir}/src/webapp/WEB-INF/pages"/> |
| 170 |
<mkdir dir="${files.dir}/src/webapp/WEB-INF/pages"/> |
| 171 |
<copy todir="${portal.dir}/src/webapp/WEB-INF/pages"> |
| 172 |
<fileset dir="${portal.psml.dir}/${portal.psml.name}"> |
| 173 |
<include name="**"/> |
| 174 |
</fileset> |
| 175 |
</copy> |
| 176 |
</target> |
| 177 |
|
| 178 |
<target name="update.portal.info" |
| 179 |
description="--> Update portal info"> |
| 180 |
<replace |
| 181 |
file="${portal.dir}/${container.info.file}" |
| 182 |
encoding="UTF-8" |
| 183 |
token="@@CONTAINER_NAME@@" |
| 184 |
value="${container.name}" /> |
| 185 |
<replace |
| 186 |
file="${portal.dir}/${container.info.file}" |
| 187 |
encoding="UTF-8" |
| 188 |
token="@@CONTAINER_SEPARATOR@@" |
| 189 |
value="${container.separator}" /> |
| 190 |
<replace |
| 191 |
file="${portal.dir}/${container.info.file}" |
| 192 |
encoding="UTF-8" |
| 193 |
token="@@CONTAINER_VERSION_MAJOR@@" |
| 194 |
value="${container.version.major}" /> |
| 195 |
<replace |
| 196 |
file="${portal.dir}/${container.info.file}" |
| 197 |
encoding="UTF-8" |
| 198 |
token="@@CONTAINER_VERSION_MINOR@@" |
| 199 |
value="${container.version.minor}" /> |
| 200 |
|
| 201 |
<!-- nextgen layout decorator footer --> |
| 202 |
<replace |
| 203 |
file="${portal.dir}/src/webapp/decorations/layout/nextgen/footer.vm" |
| 204 |
encoding="UTF-8" |
| 205 |
token="@@PORTAL_VERSION@@" |
| 206 |
value="${portal.version}" /> |
| 207 |
|
| 208 |
<!-- Replace with a new password --> |
| 209 |
<for list="${portal.seed.files}" param="seed.file"> |
| 210 |
<sequential> |
| 211 |
<replace |
| 212 |
file="${portal.dir}/@{seed.file}" |
| 213 |
encoding="UTF-8" |
| 214 |
token="##ADMIN_PASSWORD##" |
| 215 |
value="${portal.admin.password}" /> |
| 216 |
<replace |
| 217 |
file="${portal.dir}/@{seed.file}" |
| 218 |
encoding="UTF-8" |
| 219 |
token="##MANAGER_PASSWORD##" |
| 220 |
value="${portal.manager.password}" /> |
| 221 |
<replace |
| 222 |
file="${portal.dir}/@{seed.file}" |
| 223 |
encoding="UTF-8" |
| 224 |
token="##SITE_PASSWORD##" |
| 225 |
value="${portal.site.password}" /> |
| 226 |
</sequential> |
| 227 |
</for> |
| 228 |
</target> |
| 229 |
|
| 230 |
<!-- =================================================================== --> |
| 231 |
<!-- BUILD PORTAL --> |
| 232 |
<!-- =================================================================== --> |
| 233 |
|
| 234 |
<target name="build" depends="setup.shell" |
| 235 |
description="--> Build Portal"> |
| 236 |
<!-- initMavenPlugin --> |
| 237 |
<exec |
| 238 |
executable="${shell.cmd}" |
| 239 |
failonerror="true" |
| 240 |
dir="${portal.dir}" |
| 241 |
> |
| 242 |
<arg line="${shell.options} 'maven ${jetspeed2.build.options} initMavenPlugin'"/> |
| 243 |
</exec> |
| 244 |
|
| 245 |
<!-- allBuild --> |
| 246 |
<exec |
| 247 |
executable="${shell.cmd}" |
| 248 |
failonerror="true" |
| 249 |
dir="${portal.dir}" |
| 250 |
> |
| 251 |
<arg line="${shell.options} 'maven ${jetspeed2.build.options} ${jetspeed2.deploy.options} allBuild'"/> |
| 252 |
</exec> |
| 253 |
|
| 254 |
</target> |
| 255 |
|
| 256 |
<!-- =================================================================== --> |
| 257 |
<!-- DEPLOY PORTAL --> |
| 258 |
<!-- =================================================================== --> |
| 259 |
|
| 260 |
<target name="deploy" depends="setup.shell" |
| 261 |
description="--> Deploy Portal"> |
| 262 |
<!-- j2:portal.genapp --> |
| 263 |
<exec |
| 264 |
executable="${shell.cmd}" |
| 265 |
failonerror="true" |
| 266 |
dir="${portal.dir}" |
| 267 |
> |
| 268 |
<arg line="${shell.options} 'maven ${jetspeed2.build.options} ${jetspeed2.deploy.options} j2:portal.genapp'"/> |
| 269 |
</exec> |
| 270 |
<!-- war:install j2:minStart --> |
| 271 |
<exec |
| 272 |
executable="${shell.cmd}" |
| 273 |
failonerror="true" |
| 274 |
dir="${org.apache.jetspeed.portal.home}" |
| 275 |
> |
| 276 |
<arg line="${shell.options} 'maven ${jetspeed2.build.options} ${jetspeed2.deploy.options} war:install j2:minStart'"/> |
| 277 |
</exec> |
| 278 |
|
| 279 |
</target> |
| 280 |
|
| 281 |
<target name="deploy.for.dist" depends="setup.shell" |
| 282 |
description="--> Deploy Portal For Distribution"> |
| 283 |
<!-- j2:portal.genapp --> |
| 284 |
<exec |
| 285 |
executable="${shell.cmd}" |
| 286 |
failonerror="true" |
| 287 |
dir="${portal.dir}" |
| 288 |
> |
| 289 |
<arg line="${shell.options} 'maven ${jetspeed2.build.options} ${jetspeed2.dist.deploy.options} j2:portal.genapp'"/> |
| 290 |
</exec> |
| 291 |
<!-- war:install j2:minStart --> |
| 292 |
<exec |
| 293 |
executable="${shell.cmd}" |
| 294 |
failonerror="true" |
| 295 |
dir="${org.apache.jetspeed.portal.home}" |
| 296 |
> |
| 297 |
<arg line="${shell.options} 'maven ${jetspeed2.build.options} ${jetspeed2.dist.deploy.options} war:install j2:minStart'"/> |
| 298 |
</exec> |
| 299 |
|
| 300 |
</target> |
| 301 |
|
| 302 |
</project> |
| 303 |
|