blob: 8371ca505258073050d1cc85c5b0e9f3786a59cd [file] [log] [blame]
<!--
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.
-->
<!--
This build script expects two properties:
- version.qualifier : defines which version append to the version defined in the manifests.
It will probably be "alpha1", "beta4", "RC1" or even "patch-4".
- baseLocation : the full path to the SDK version of Eclipse in order to build the binary jars.
Properties could be set in the two files :
- build.properties : properties shared between developers, so under version control.
The version.qualifier property should be set there.
- local.build.properties : properties handled by developers, ignored by subversion.
The baseLocation property should be set there.
-->
<project name="ivyde" basedir="." default="build">
<property file="local.build.properties" />
<property file="build.properties" />
<property name="work.dir" value="${basedir}/work"/>
<property name="ivy.work.dir" value="${work.dir}/ivy"/>
<property name="eclipse.work.dir" value="${work.dir}/eclipse"/>
<property name="dist.dir" value="${basedir}/dist"/>
<target name="/release" description="Make the build artifacts tagged with the release version">
<property name="forceContextQualifier" value="${version.qualifier}" />
<property name="generateFeatureVersionSuffix" value="false" />
</target>
<target name="dist" depends="build,sources,checksum" description="Build every artifacts for distribution" />
<target name="clean" description="Remove every build artifacts">
<delete dir="${work.dir}" />
<delete dir="${dist.dir}" />
</target>
<target name="check-baseLocation">
<fail message="An Eclipse install is needed to run the build. Set your Eclipse install dir in the 'baseLocation' property." unless="baseLocation" />
</target>
<target name="eclipse-startup-check" depends="check-baseLocation">
<condition property="eclipse.startup">
<available file="${baseLocation}/startup.jar" />
</condition>
</target>
<target name="eclipse-startup-classpath" depends="eclipse-startup-check" if="eclipse.startup">
<property name="eclipse.classpath" value="${baseLocation}/startup.jar" />
</target>
<target name="eclipse-launcher-classpath" depends="eclipse-startup-check" unless="eclipse.startup">
<!-- store path to newest launcher JAR in path id 'newest.equinox.launcher.path.id' -->
<path id="newest.equinox.launcher.path.id">
<first count="1">
<sort>
<fileset dir="${baseLocation}/plugins" includes="**/org.eclipse.equinox.launcher_*.jar" />
<!-- Seems the default order is oldest > newest so we must reverse it.
The 'reverse' and 'date' comparators are in the internal antlib
org.apache.tools.ant.types.resources.comparators.
-->
<reverse xmlns="antlib:org.apache.tools.ant.types.resources.comparators">
<!-- 'date' inherits 'reverse's namespace -->
<date />
</reverse>
</sort>
</first>
</path>
<!-- turn the path into a property -->
<property name="eclipse.classpath" refid="newest.equinox.launcher.path.id" />
</target>
<target name="eclipse-classpath" depends="eclipse-startup-classpath,eclipse-launcher-classpath">
<echo message="Using equinox launcher jar: ${eclipse.classpath}" />
</target>
<target name="compute-version">
<tstamp />
<property name="forceContextQualifier" value="${version.qualifier}-${DSTAMP}${TSTAMP}"/>
<property name="generateFeatureVersionSuffix" value="true" />
<loadfile srcfile="org.apache.ivyde.eclipse/META-INF/MANIFEST.MF" property="build.version">
<filterchain>
<linecontainsregexp>
<regexp pattern="Bundle-Version:.*"/>
</linecontainsregexp>
<replaceregex pattern="Bundle-Version: (.*)qualifier" replace="\1${forceContextQualifier}"/>
<striplinebreaks/>
</filterchain>
</loadfile>
<echo message="Building version ${build.version}" />
</target>
<!--
======================================================================================
Build targets
======================================================================================
-->
<target name="build" depends="check-ivy-installed,eclipse-classpath,compute-version" description="Build the plugin distribution binaries">
<java classpath="${eclipse.classpath}" classname="org.eclipse.core.launcher.Main" fork="true" failonerror="true">
<arg value="-clean" />
<arg line="-application org.eclipse.pde.build.Build" />
<sysproperty key="eclipse.consoleLog" value="${eclipse.consoleLog}"/>
<sysproperty key="baseLocation" value="${baseLocation}"/>
<sysproperty key="builder" path="${basedir}/builder/component"/>
<sysproperty key="mapsPath" path="${basedir}/builder/maps"/>
<sysproperty key="buildDirectory" path="${eclipse.work.dir}" />
<sysproperty key="DSTAMP" value="${DSTAMP}" />
<sysproperty key="TSTAMP" value="${TSTAMP}" />
<sysproperty key="forceContextQualifier" value="${forceContextQualifier}" />
<sysproperty key="generateFeatureVersionSuffix" value="${generateFeatureVersionSuffix}" />
<sysproperty key="outputUpdateJars" value="true" />
<sysproperty key="build.version" value="${build.version}" />
<sysproperty key="javacDebugInfo" value="true"/>
</java>
<mkdir dir="${dist.dir}"/>
<move file="${eclipse.work.dir}/${build.version}/org.apache.ivyde.feature-${build.version}.zip" todir="${dist.dir}"/>
</target>
<target name="sources" depends="compute-version" description="Create source archive files">
<mkdir dir="${dist.dir}"/>
<zip destfile="${dist.dir}/apache-ivyde-sources-${build.version}.zip">
<fileset dir="${basedir}">
<include name="site.xml" />
<include name="build.xml" />
<include name="build.properties" />
<include name="builder/**" />
<include name="org.apache.ivy.feature/build.properties" />
<include name="org.apache.ivy.feature/feature.properties" />
<include name="org.apache.ivy.feature/feature.xml" />
<include name="org.apache.ivy.feature/LICENSE" />
<include name="org.apache.ivy.feature/NOTICE" />
<include name="org.apache.ivy.feature/.project"/>
<include name="org.apache.ivyde.eclipse/plugin.xml"/>
<include name="org.apache.ivyde.eclipse/build.properties"/>
<include name="org.apache.ivyde.eclipse/**/*.java"/>
<include name="org.apache.ivyde.eclipse/icons/**"/>
<include name="org.apache.ivyde.eclipse/META-INF/**"/>
<include name="org.apache.ivyde.eclipse/CHANGES.txt"/>
<include name="org.apache.ivyde.eclipse/.project"/>
<include name="org.apache.ivyde.eclipse/.classpath"/>
<include name="org.apache.ivyde.eclipse/.settings/**"/>
<include name="org.apache.ivyde.feature/feature.xml"/>
<include name="org.apache.ivyde.feature/feature.properties" />
<include name="org.apache.ivyde.feature/build.properties"/>
<include name="org.apache.ivyde.feature/.project"/>
<include name="org.apache.ivyde.feature/LICENCE"/>
<include name="org.apache.ivyde.feature/NOTICE"/>
<include name="signArtifacts.sh"/>
<include name="verifyArtifacts.sh"/>
</fileset>
</zip>
</target>
<!--
======================================================================================
Targets related to the installation of Ivy in the Eclipse install
======================================================================================
-->
<!-- Get the OSGi version of Ivy in the manifest in the jar -->
<target name="compute-ivy-bundle-version" unless="ivy.bundle.version">
<mkdir dir="${ivy.work.dir}/jar" />
<get src="${ivy.jar.url}" dest="${ivy.work.dir}/ivy.jar" />
<unzip overwrite="true" src="${ivy.work.dir}/ivy.jar" dest="${ivy.work.dir}/jar" />
<loadfile property="ivy.bundle.version" srcFile="${ivy.work.dir}/jar/META-INF/MANIFEST.MF">
<filterchain>
<linecontains>
<contains value="Bundle-Version:"/>
</linecontains>
<tokenfilter>
<replaceregex pattern="Bundle-Version: (.*)" replace="\1" flags="gi"/>
</tokenfilter>
<striplinebreaks/>
</filterchain>
</loadfile>
</target>
<!-- clean up every installed ivy and install the specified one -->
<target name="install-ivy-jar" depends="compute-ivy-bundle-version">
<delete>
<fileset dir="${baseLocation}/plugins/" includes="org.apache.ivy_*.jar"/>
</delete>
<get src="${ivy.jar.url}" dest="${baseLocation}/plugins/org.apache.ivy_${ivy.bundle.version}.jar" />
<echo message="Ivy ${ivy.bundle.version} has been installed in ${baseLocation}" />
</target>
<!-- Get the Ivy jar from a zip distribution -->
<target name="get-ivy-jar" unless="ivy.jar.url">
<fail>
You have to specify the Ivy to install with one of the following property:
- 'ivy.version': the version of the official Apache release to download (ex: -Divy.version=2.0.0-rc1) (older than 2.0.0-rc1 is not supported)
- 'ivy.zip.url': the url of the zip distribution (ex: -Divy.zip.url=file:///home/me/ivy-trunk/build/distrib/apache-ivy-2.0.0-rc1-local-20080926154508-bin.zip)
- 'ivy.jar.url': the url of the Ivy jar (ex: -Divy.jar.url=file:///home/me/ivy-trunk/build/artifact/jars/ivy.jar)
<condition>
<not>
<or>
<isset property="ivy.version" />
<isset property="ivy.zip.url" />
</or>
</not>
</condition>
</fail>
<mkdir dir="${ivy.work.dir}/distrib" />
<property name="ivy.zip.url" value="${mirror.url}/ant/ivy/${ivy.version}/apache-ivy-${ivy.version}-bin.zip" />
<get src="${ivy.zip.url}" usetimestamp="true" dest="${ivy.work.dir}/ivy-bin.zip" />
<unzip overwrite="true" src="${ivy.work.dir}/ivy-bin.zip" dest="${ivy.work.dir}/distrib" />
<path id="ivy.jar.path">
<first count="1">
<fileset dir="${ivy.work.dir}" includes="distrib/apache-ivy-*/ivy-*.jar"/>
</first>
</path>
<makeurl property="ivy.jar.url" file="${toString:ivy.jar.path}" />
<echo message="${ivy.jar.url}" />
</target>
<target name="install-ivy" depends="check-baseLocation,get-ivy-jar,install-ivy-jar" description="Install an Ivy bundle into the eclipse install">
<delete dir="${ivy.work.dir}" />
</target>
<target name="list-installed-ivy" depends="check-baseLocation" description="List the Ivy bundle(s) in your Eclipse install">
<path id="ivy.eclipse.paths">
<fileset dir="${baseLocation}/plugins" includes="org.apache.ivy_*.jar"/>
</path>
<echo message="The Ivy installed in ${baseLocation}: ${toString:ivy.eclipse.paths}" />
</target>
<target name="check-ivy-installed" depends="list-installed-ivy">
<fail message="No Ivy is installed. Please run 'ant install-ivy first'.">
<condition>
<resourcecount refid="ivy.eclipse.paths" when="equal" count="0" />
</condition>
</fail>
</target>
<!--
======================================================================================
Targets related to the installation of IvyDE in the Eclipse install
======================================================================================
-->
<target name="clean-installed-ivyde" description="Remove every IvyDE version installed in Eclipse">
<delete>
<fileset dir="${baseLocation}/plugins/" includes="org.apache.ivyde*.jar"/>
<fileset dir="${baseLocation}/features/" includes="org.apache.ivyde*.jar"/>
</delete>
</target>
<target name="list-installed-ivyde" depends="check-baseLocation" description="List the IvyDE plugin(s) in your Eclipse install">
<path id="ivyde.eclipse.paths">
<fileset dir="${baseLocation}/plugins" includes="org.apache.ivyde*.jar"/>
</path>
<echo message="The IvyDE installed in ${baseLocation}: ${toString:ivyde.eclipse.paths}" />
</target>
<target name="install" depends="dist,clean-installed-ivyde" description="Install the IvyDE bundle into the eclipse install">
<unzip src="${dist.dir}/org.apache.ivyde.feature-${build.version}.zip" dest="${baseLocation}"/>
</target>
<!--
======================================================================================
Targets related to the checksums of the distribution
======================================================================================
-->
<target name="checksum" description="Compute the checksum for every artifact to distribute">
<checksum algorithm="MD5" fileext=".md5" format="MD5SUM">
<fileset dir="${dist.dir}">
<include name="org.apache.ivyde.feature-*.zip" />
<include name="apache-ivyde-sources-*.zip" />
</fileset>
</checksum>
<checksum algorithm="SHA" fileext=".sha" format="MD5SUM">
<fileset dir="${dist.dir}">
<include name="org.apache.ivyde.feature-*.zip" />
<include name="apache-ivyde-sources-*.zip" />
</fileset>
</checksum>
</target>
<target name="verify-checksum" description="Verify the checksums of the artifacts to publish">
<checksum algorithm="MD5" fileext=".md5" format="MD5SUM" verifyproperty="checksum.md5.ok" >
<fileset dir="${dist.dir}">
<include name="org.apache.ivyde.feature-*.zip" />
<include name="apache-ivyde-sources-*.zip" />
</fileset>
</checksum>
<fail message="MD5 Checksum verify failed !">
<condition>
<isfalse value="${checksum.md5.ok}"/>
</condition>
</fail>
<echo message="MD5 Checksum verify passed successfully" />
<checksum algorithm="SHA" fileext=".sha" format="MD5SUM" verifyproperty="checksum.sha.ok" >
<fileset dir="${dist.dir}">
<include name="org.apache.ivyde.feature-*.zip" />
<include name="apache-ivyde-sources-*.zip" />
</fileset>
</checksum>
<fail message="SHA Checksum verify failed !">
<condition>
<isfalse value="${checksum.sha.ok}"/>
</condition>
</fail>
<echo message="SHA Checksum verify passed successfully" />
</target>
</project>