| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
|
| 3 |
<project name="portlet" 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 |
<!-- Shell Setup --> |
| 15 |
<property name="shell.cmd" value="sh"/> |
| 16 |
<property name="shell.options" value="-c"/> |
| 17 |
|
| 18 |
<target name="check.os" |
| 19 |
description="--> Check OS"> |
| 20 |
<condition property="isWindows"> |
| 21 |
<os family="windows" /> |
| 22 |
</condition> |
| 23 |
</target> |
| 24 |
|
| 25 |
<target name="setup.shell" depends="check.os" if="isWindows" |
| 26 |
description="--> Setup shell parameters"> |
| 27 |
<property name="shell.cmd" value="cmd.exe"/> |
| 28 |
<property name="shell.options" value="/c"/> |
| 29 |
</target> |
| 30 |
|
| 31 |
<target name="setup.params" |
| 32 |
description="--> Setup Parameters"> |
| 33 |
<property file="${portlet.resource.file}"/> |
| 34 |
<property name="portlet.dir" value="${portlets.build.dir}/${portlet.name}"/> |
| 35 |
<property name="files.dir" value="${portlets.home}/files/${portlet.name}"/> |
| 36 |
<property name="patches.dir" value="${portlets.home}/patches/${portlet.name}"/> |
| 37 |
</target> |
| 38 |
|
| 39 |
<!-- =================================================================== --> |
| 40 |
<!-- CHECKOUT PORTLET --> |
| 41 |
<!-- =================================================================== --> |
| 42 |
|
| 43 |
<target name="checkout" depends="setup.params" |
| 44 |
description="--> Checkout Portlet from CVS"> |
| 45 |
<mkdir dir="${portlets.build.dir}"/> |
| 46 |
<antcall target="checkout.from.${portlet.ws.type}"/> |
| 47 |
</target> |
| 48 |
|
| 49 |
<!-- =================================================================== --> |
| 50 |
<!-- CHECKOUT PORTLET FROM CVS --> |
| 51 |
<!-- =================================================================== --> |
| 52 |
|
| 53 |
<target name="checkout.from.cvs" depends="setup.params" |
| 54 |
description="--> Checkout Portlet from CVS"> |
| 55 |
<delete dir="${portlet.dir}"/> |
| 56 |
<exec |
| 57 |
executable="cvs" |
| 58 |
dir="${portlets.build.dir}" |
| 59 |
> |
| 60 |
<arg line="${cvs.repository.path} co -r ${cvs.revision} -d ${cvs.output.dir} ${cvs.module.name}"/> |
| 61 |
</exec> |
| 62 |
|
| 63 |
</target> |
| 64 |
|
| 65 |
<!-- =================================================================== --> |
| 66 |
<!-- CHECKOUT PORTLET FROM SVN --> |
| 67 |
<!-- =================================================================== --> |
| 68 |
|
| 69 |
<target name="checkout.from.svn" depends="setup.params" |
| 70 |
description="--> Checkout Portlet from SVN"> |
| 71 |
<delete dir="${portlet.dir}"/> |
| 72 |
<exec |
| 73 |
executable="cvs" |
| 74 |
dir="${portlets.build.dir}" |
| 75 |
> |
| 76 |
<arg line="checkout ${svn.repository.path} --revision ${svn.revision} ${svn.module.name}"/> |
| 77 |
</exec> |
| 78 |
|
| 79 |
</target> |
| 80 |
|
| 81 |
<!-- =================================================================== --> |
| 82 |
<!-- CHECKOUT PORTLET FROM LOCAL DIRECTORY --> |
| 83 |
<!-- =================================================================== --> |
| 84 |
|
| 85 |
<target name="checkout.from.localcopy" depends="setup.params" |
| 86 |
description="--> Checkout Portlet from Local Directory"> |
| 87 |
<delete dir="${portlet.dir}"/> |
| 88 |
<copy todir="${portlets.build.dir}/${localcopy.module.name}"> |
| 89 |
<fileset dir="${localcopy.local.path}"> |
| 90 |
<include name="**"/> |
| 91 |
</fileset> |
| 92 |
</copy> |
| 93 |
|
| 94 |
</target> |
| 95 |
|
| 96 |
<!-- =================================================================== --> |
| 97 |
<!-- REMOVE PORTLET --> |
| 98 |
<!-- =================================================================== --> |
| 99 |
|
| 100 |
<target name="remove" depends="setup.params" |
| 101 |
description="--> Remove Portlet"> |
| 102 |
<delete dir="${portlet.dir}"/> |
| 103 |
</target> |
| 104 |
|
| 105 |
<!-- =================================================================== --> |
| 106 |
<!-- CLEAN PORTAL --> |
| 107 |
<!-- =================================================================== --> |
| 108 |
|
| 109 |
<target name="clean" depends="setup.params" |
| 110 |
description="--> Clean Portlet"> |
| 111 |
<antcall target="clean.by.${portlet.build.type}"/> |
| 112 |
</target> |
| 113 |
|
| 114 |
<!-- =================================================================== --> |
| 115 |
<!-- CLEAN PORTAL BY MAVEN 1 --> |
| 116 |
<!-- =================================================================== --> |
| 117 |
|
| 118 |
<target name="clean.by.maven1" depends="setup.params" |
| 119 |
description="--> Clean Portlet by Maven 1"> |
| 120 |
<exec |
| 121 |
executable="${shell.cmd}" |
| 122 |
failonerror="true" |
| 123 |
dir="${portlet.dir}" |
| 124 |
> |
| 125 |
<arg line="${shell.options} 'maven clean'"/> |
| 126 |
</exec> |
| 127 |
|
| 128 |
</target> |
| 129 |
|
| 130 |
<!-- =================================================================== --> |
| 131 |
<!-- CLEAN PORTAL BY MAVEN 2 --> |
| 132 |
<!-- =================================================================== --> |
| 133 |
|
| 134 |
<target name="clean.by.maven2" depends="setup.params" |
| 135 |
description="--> Clean Portlet by Maven 2"> |
| 136 |
<exec |
| 137 |
executable="${shell.cmd}" |
| 138 |
failonerror="true" |
| 139 |
dir="${portlet.dir}" |
| 140 |
> |
| 141 |
<arg line="${shell.options} 'mvn clean'"/> |
| 142 |
</exec> |
| 143 |
|
| 144 |
</target> |
| 145 |
|
| 146 |
<!-- =================================================================== --> |
| 147 |
<!-- UPDATE PORTLET --> |
| 148 |
<!-- =================================================================== --> |
| 149 |
|
| 150 |
<target name="update" depends="setup.params" |
| 151 |
description="--> Update Portlet"> |
| 152 |
<antcall target="files"/> |
| 153 |
<antcall target="patches"/> |
| 154 |
</target> |
| 155 |
|
| 156 |
<target name="files"> |
| 157 |
<!-- remove files from portlet --> |
| 158 |
<for list="${portlet.delete.files}" param="delete.file"> |
| 159 |
<sequential> |
| 160 |
<delete file="${portlet.dir}/@{delete.file}"/> |
| 161 |
</sequential> |
| 162 |
</for> |
| 163 |
<!-- remove directories from portlet --> |
| 164 |
<for list="${portlet.delete.directories}" param="delete.directory"> |
| 165 |
<sequential> |
| 166 |
<delete dir="${portlet.dir}/@{delete.directory}"/> |
| 167 |
</sequential> |
| 168 |
</for> |
| 169 |
|
| 170 |
<!-- copy files to portlet --> |
| 171 |
<mkdir dir="${files.dir}"/> |
| 172 |
<copy todir="${portlet.dir}"> |
| 173 |
<fileset dir="${files.dir}"> |
| 174 |
<include name="**"/> |
| 175 |
</fileset> |
| 176 |
</copy> |
| 177 |
|
| 178 |
</target> |
| 179 |
|
| 180 |
<target name="patches"> |
| 181 |
<for list="${portlet.patch.files}" param="patch.file"> |
| 182 |
<sequential> |
| 183 |
<patch patchfile="${patches.dir}/@{patch.file}" |
| 184 |
dir="${portlet.dir}" |
| 185 |
originalfile="${portlet.dir}/@{patch.file}" |
| 186 |
ignorewhitespace="yes" |
| 187 |
strip="0"/> |
| 188 |
</sequential> |
| 189 |
</for> |
| 190 |
</target> |
| 191 |
|
| 192 |
<!-- =================================================================== --> |
| 193 |
<!-- BUILD PORTLET --> |
| 194 |
<!-- =================================================================== --> |
| 195 |
|
| 196 |
<target name="build" depends="setup.params" |
| 197 |
description="--> Build Portlet"> |
| 198 |
<antcall target="build.by.${portlet.build.type}"/> |
| 199 |
</target> |
| 200 |
|
| 201 |
<!-- =================================================================== --> |
| 202 |
<!-- BUILD PORTLET BY MAVEN 1 --> |
| 203 |
<!-- =================================================================== --> |
| 204 |
|
| 205 |
<target name="build.by.maven1" depends="setup.params" |
| 206 |
description="--> Build Portlet by Maven 1"> |
| 207 |
<!-- build --> |
| 208 |
<exec |
| 209 |
executable="${shell.cmd}" |
| 210 |
failonerror="true" |
| 211 |
dir="${portlet.dir}" |
| 212 |
> |
| 213 |
<arg line="${shell.options} 'maven war'"/> |
| 214 |
</exec> |
| 215 |
|
| 216 |
</target> |
| 217 |
|
| 218 |
<!-- =================================================================== --> |
| 219 |
<!-- BUILD PORTLET BY MAVEN 2 --> |
| 220 |
<!-- =================================================================== --> |
| 221 |
|
| 222 |
<target name="build.by.maven2" depends="setup.params" |
| 223 |
description="--> Build Portlet by Maven 2"> |
| 224 |
<!-- build --> |
| 225 |
<exec |
| 226 |
executable="${shell.cmd}" |
| 227 |
failonerror="true" |
| 228 |
dir="${portlet.dir}" |
| 229 |
> |
| 230 |
<arg line="${shell.options} 'mvn install'"/> |
| 231 |
</exec> |
| 232 |
|
| 233 |
</target> |
| 234 |
|
| 235 |
<!-- =================================================================== --> |
| 236 |
<!-- DEPLOY PORTAL --> |
| 237 |
<!-- =================================================================== --> |
| 238 |
|
| 239 |
<target name="deploy" depends="setup.params" |
| 240 |
description="--> Deploy Portlet"> |
| 241 |
<antcall target="deploy.by.${portlet.build.type}"/> |
| 242 |
</target> |
| 243 |
|
| 244 |
|
| 245 |
<!-- =================================================================== --> |
| 246 |
<!-- DEPLOY PORTAL BY MAVEN 1 --> |
| 247 |
<!-- =================================================================== --> |
| 248 |
|
| 249 |
<target name="deploy.by.maven1" depends="setup.params" |
| 250 |
description="--> Deploy Portlet by Maven 1"> |
| 251 |
<delete dir="${org.apache.jetspeed.deploy.war.dir}/${portlet.name}"/> |
| 252 |
<delete file="${org.apache.jetspeed.deploy.war.dir}/${portlet.name}.war"/> |
| 253 |
|
| 254 |
<copy |
| 255 |
tofile="${portlets.war.dir}/${portlet.name}.war" |
| 256 |
overwrite="true" failonerror="true" > |
| 257 |
<fileset dir="${portlet.dir}/target" casesensitive="yes"> |
| 258 |
<include name="*.war"/> |
| 259 |
</fileset> |
| 260 |
</copy> |
| 261 |
|
| 262 |
</target> |
| 263 |
|
| 264 |
<!-- =================================================================== --> |
| 265 |
<!-- DEPLOY PORTAL BY MAVEN 2 --> |
| 266 |
<!-- =================================================================== --> |
| 267 |
|
| 268 |
<target name="deploy.by.maven2" depends="setup.params" |
| 269 |
description="--> Deploy Portlet by Maven 2"> |
| 270 |
<delete dir="${org.apache.jetspeed.deploy.war.dir}/${portlet.name}"/> |
| 271 |
<delete file="${org.apache.jetspeed.deploy.war.dir}/${portlet.name}.war"/> |
| 272 |
|
| 273 |
<copy |
| 274 |
tofile="${portlets.war.dir}/${portlet.name}.war" |
| 275 |
overwrite="true" failonerror="true" > |
| 276 |
<fileset dir="${portlet.dir}" casesensitive="yes"> |
| 277 |
<include name="**/*.war"/> |
| 278 |
</fileset> |
| 279 |
</copy> |
| 280 |
|
| 281 |
</target> |
| 282 |
|
| 283 |
</project> |
| 284 |
|