| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <project name="Run as part of postBuild" default="main"> |
| <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${buildHome}/build-files/ant-contrib.jar" /> |
| <taskdef resource="org/pluginbuilder/anttasks/pluginbuildertasks.properties" classpath="${buildHome}/build-files/pluginbuilder-anttasks.jar" /> |
| |
| |
| <target name="main"> |
| <property name="UpdateSiteStagingLocation" value="${buildDirectory}/tmpUpdateSite/updateSite"/> |
| <property name="UpdateSiteFinalLocation" value="${buildResultsDirectory}/../updateSite"/> |
| <property name="siteXmlFile" value="${UpdateSiteStagingLocation}/site.xml"/> |
| |
| <antcall target="-generateUpdateSite"/> |
| <antcall target="-createNightlyBuildSiteXml"/> |
| <zip destfile="${buildResultsDirectory}/updateSite-${version.full}.zip" basedir="${UpdateSiteStagingLocation}"/> |
| <antcall target="deleteSiteXml"/> |
| <copy todir="${UpdateSiteFinalLocation}"> |
| <fileset dir="${UpdateSiteStagingLocation}" includes="**"/> |
| </copy> |
| <delete dir="${UpdateSiteStagingLocation}/../.." includes="tmpUpdateSite/**" includeemptydirs="true"/> |
| <antcall target="-p2"/> |
| </target> |
| |
| <target name="deleteSiteXml" unless="isNightlyBuild"> |
| <!-- in release builds the site.xml should not be overwritten, so older version can survive --> |
| <delete file="${siteXmlFile}"/> |
| </target> |
| |
| <!--======================================================--> |
| <!-- UpdateSite Export target, to be called from allElements --> |
| <!-- ==================================================== --> |
| <target name="updateSiteExport"> |
| <ant antfile="build.xml" dir="${buildDirectory}/features/${id}/" target="build.update.jar"> |
| <property name="feature.destination" value="${UpdateSiteStagingLocation}/features"/> |
| <property name="plugin.destination" value="${UpdateSiteStagingLocation}/plugins"/> |
| </ant> |
| </target> |
| |
| <target name="-generateUpdateSite"> |
| <!-- Create the directory structure --> |
| <mkdir dir="${UpdateSiteStagingLocation}"/> |
| <mkdir dir="${UpdateSiteStagingLocation}/features"/> |
| <mkdir dir="${UpdateSiteStagingLocation}/plugins"/> |
| <condition property="jarProcessor.sign" value="true"> |
| <istrue value="${signJars}"/> |
| </condition> |
| <!-- Build the jar files --> |
| <ant antfile="${builder}/customTargets.xml" target="allElements"> |
| <property name="genericTargets" value="${builder}/postBuild.xml"/> |
| <property name="target" value="updateSiteExport"/> |
| </ant> |
| <!-- site.xml files for integration and release builds are handled elsewhere --> |
| <antcall target="-createNightlyBuildSiteXml"/> |
| <delete dir="${buildDirectory}/temp.updatesite"/> |
| </target> |
| |
| <target name="-createNightlyBuildSiteXml"> |
| <echo>${siteXmlFile}</echo> |
| <echo file="${siteXmlFile}"><?xml version="1.0" encoding="UTF-8"?> |
| <site> |
| <description>${updateSiteDescription}</description> |
| </echo> |
| <foreach list="${pluginbuilder.features}" delimiter="," target="-appendFeatureElement" param="featureId" inheritall="true"/> |
| <echo file="${siteXmlFile}" append="true"> <category-def name="${updateSiteCategoryName}" |
| label="${updateSiteCategoryLabel}"> |
| </category-def> |
| </site></echo> |
| </target> |
| |
| <target name="-appendFeatureElement"> |
| <!-- we can not rely on ${version.full} at this point since people could use |
| a fix feature id like 0.5.0.qualifier. ${version.full} would only work if |
| the feature were set to 0.0.0 --> |
| <loadfile property="featurexml" srcfile="${buildDirectory}/features/${featureId}/feature.xml"/> |
| <SetRegex input="${featurexml}" match="^.*<feature.+?version="(.+?)".*$" property="realFeatureVersion" value="\1" /> |
| <echo file="${siteXmlFile}" append="true"> <feature |
| url="features/${featureId}_${realFeatureVersion}.jar" |
| id="${featureId}" |
| version="${realFeatureVersion}"> |
| <category name="${updateSiteCategoryName}"/> |
| </feature> |
| </echo> |
| </target> |
| |
| <target name="-p2"> |
| <condition property="is.p2" value="true"> |
| <equals arg1="${generate.p2.metadata}" arg2="true"/> |
| </condition> |
| <property name="p2archive" value="${buildResultsDirectory}/p2-repository-${version.full}.zip"/> |
| <antcall target="-createP2Archive"/> |
| <antcall target="-createP2UpdateSite"/> |
| </target> |
| |
| <target name="-createP2Archive" if="is.p2"> |
| <pathconvert property="repodir"> |
| <resources> |
| <url url="${p2.metadata.repo}"/> |
| </resources> |
| <map from="file:" to=""/> |
| </pathconvert> |
| <zip destfile="${p2archive}" basedir="${repodir}"/> |
| </target> |
| |
| <target name="-createP2UpdateSite" if="is.p2"> |
| <property name="p2updatesite" value="${buildResultsDirectory}/../p2-updateSite"/> |
| <delete dir="${p2updatesite}"/> |
| <mkdir dir="${p2updatesite}"/> |
| <unzip src="${p2archive}" dest="${p2updatesite}"/> |
| </target> |
| |
| </project> |