blob: 188e987a62d1315462058e09e4dd0e59c99338f2 [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="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="/updatesite" description="Make the feature zip package deployable in an update site">
<property name="outputUpdateJars" value="true" />
</target>
<target name="dist" depends="build-ivy-feature-zip,/updatesite,build,sources,updatesite:build,updatesite:optimize,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="eclipse-startup-check">
<fail message="An Eclipse install is needed to run the build. Set your Eclipse install dir into the baseLocation property." unless="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>
<target name="build" depends="eclipse-classpath,compute-version" description="Build the plugin distribution binaries">
<property name="outputUpdateJars" value="false" />
<java classpath="${eclipse.classpath}" classname="org.eclipse.core.launcher.Main" fork="true" failonerror="true">
<arg value="-clean" />
<arg value="-consolelog" />
<arg line="-application org.eclipse.pde.build.Build" />
<sysproperty key="baseLocation" value="${baseLocation}"/>
<sysproperty key="builder" path="${basedir}/builder/component"/>
<sysproperty key="mapsPath" path="${basedir}/builder/maps"/>
<sysproperty key="buildDirectory" path="${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="${outputUpdateJars}" />
<sysproperty key="build.version" value="${build.version}" />
<sysproperty key="javacDebugInfo" value="true"/>
</java>
<mkdir dir="${dist.dir}"/>
<move file="${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>
<target name="updatesite:build" depends="/updatesite,build" description="Build the distribution binaries and put them into the update-site">
<mkdir dir="${dist.dir}/updatesite" />
<unzip src="${dist.dir}/org.apache.ivyde.feature-${build.version}.zip" dest="${dist.dir}/updatesite" />
</target>
<target name="updatesite:optimize" depends="updatesite:pack-jars,updatesite:build-digest" description="Optimize the update site" />
<target name="updatesite:pack-jars" depends="eclipse-classpath">
<java classpath="${eclipse.classpath}" classname="org.eclipse.core.launcher.Main" fork="true" failonerror="true">
<arg value="-consolelog" />
<arg line="-application org.eclipse.update.core.siteOptimizer"/>
<arg line="-jarProcessor -verbose -processAll -pack"/>
<arg line="-outputDir ${dist.dir}/updatesite/plugins"/>
<arg line="${dist.dir}/updatesite/plugins"/>
</java>
</target>
<target name="updatesite:build-digest" depends="eclipse-classpath">
<mkdir dir="${dist.dir}/updatesite/" />
<copy file="${basedir}/site.xml" tofile="${dist.dir}/updatesite/site.xml" />
<!-- see http://wiki.eclipse.org/Update_Site_Optimization -->
<java classpath="${eclipse.classpath}" classname="org.eclipse.core.launcher.Main" fork="true" failonerror="true">
<arg value="-consolelog" />
<arg line="-application org.eclipse.update.core.siteOptimizer"/>
<arg line="-digestBuilder -digestOutputDir=${dist.dir}/updatesite/"/>
<arg line="-siteXML=${dist.dir}/updatesite/site.xml"/>
</java>
</target>
<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="updatesite/plugins/org.apache.ivy*.jar" />
<include name="updatesite/plugins/org.apache.ivy*.jar.pack.gz" />
<include name="updatesite/features/org.apache.ivy*.jar" />
<include name="updatesite/features/org.apache.ivy*.jar.pack.gz" />
<include name="org.apache.ivy.feature-*.zip" />
<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="updatesite/plugins/org.apache.ivy*.jar" />
<include name="updatesite/plugins/org.apache.ivy*.jar.pack.gz" />
<include name="updatesite/features/org.apache.ivy*.jar" />
<include name="updatesite/features/org.apache.ivy*.jar.pack.gz" />
<include name="org.apache.ivy.feature-*.zip" />
<include name="org.apache.ivyde.feature-*.zip" />
<include name="apache-ivyde-sources-*.zip" />
</fileset>
</checksum>
</target>
<target name="build-ivy-feature" description="Build the feature of Ivy">
<mkdir dir="${dist.dir}/updatesite/features" />
<jar destfile="${dist.dir}/updatesite/features/org.apache.ivy.feature_2.0.0.beta2.jar">
<fileset dir="org.apache.ivy.feature">
<include name="feature.properties" />
<include name="feature.xml"/>
<include name="LICENCE"/>
<include name="NOTICE"/>
</fileset>
</jar>
</target>
<target name="build-ivy-feature-zip" depends="copy-ivy-bundle,build-ivy-feature" description="Build the zip distribution of the Ivy feature">
<zip destfile="${dist.dir}/org.apache.ivy.feature-2.0.0.beta2.zip">
<fileset dir="${dist.dir}/updatesite/">
<include name="features/org.apache.ivy.feature_2.0.0.beta2.jar" />
<include name="plugins/org.apache.ivy_2.0.0.beta2.jar"/>
</fileset>
</zip>
</target>
<target name="copy-ivy-bundle" description="Put the Ivy bundle into the update site">
<mkdir dir="${dist.dir}/updatesite/plugins" />
<copy file="${baseLocation}/plugins/org.apache.ivy_2.0.0.beta2.jar" tofile="${dist.dir}/updatesite/plugins/org.apache.ivy_2.0.0.beta2.jar" />
</target>
<!-- due to a bug in the packaging of Ivy, some repackaging is needed (IVY-828,IVY-802) -->
<target name="install-ivy">
<get src="http://apache.org/dist/ant/ivy/2.0.0-beta2/apache-ivy-2.0.0-beta2-bin.zip" usetimestamp="true" dest="apache-ivy-2.0.0-beta2-bin.zip" />
<mkdir dir="work-ivy/orig" />
<unzip overwrite="true" src="apache-ivy-2.0.0-beta2-bin.zip" dest="ivy-work/orig" />
<unzip overwrite="true" src="ivy-work/orig/apache-ivy-2.0.0-beta2/ivy-2.0.0-beta2.jar" dest="ivy-work/unpacked" />
<replaceregexp file="ivy-work/unpacked/META-INF/MANIFEST.MF" match="Bundle-Version: 0\.0\.0" replace="Bundle-Version: 2.0.0.beta2" byline="true"/>
<jar destfile="${baseLocation}/plugins/org.apache.ivy_2.0.0.beta2.jar" manifest="ivy-work/unpacked/META-INF/MANIFEST.MF">
<fileset dir="ivy-work/unpacked/" />
</jar>
<delete dir="work-ivy" />
</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="updatesite/plugins/org.apache.ivy*.jar" />
<include name="updatesite/plugins/org.apache.ivy*.jar.pack.gz" />
<include name="updatesite/features/org.apache.ivy*.jar" />
<include name="updatesite/features/org.apache.ivy*.jar.pack.gz" />
<include name="org.apache.ivy.feature-*.zip" />
<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="updatesite/plugins/org.apache.ivy*.jar" />
<include name="updatesite/plugins/org.apache.ivy*.jar.pack.gz" />
<include name="updatesite/features/org.apache.ivy*.jar" />
<include name="updatesite/features/org.apache.ivy*.jar.pack.gz" />
<include name="org.apache.ivy.feature-*.zip" />
<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>