blob: dfe800563046cb647d979118686e2807f1bac156 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<project name="build-virgo-build" xmlns:ivy="antlib:org.apache.ivy.ant">
<path id="unit.test.bundles">
<pathelement location="../org.eclipse.virgo.build.p2tools"/>
</path>
<path id="bundles">
<path refid="unit.test.bundles" />
</path>
<property file="${basedir}/../build.properties"/>
<property file="${basedir}/../build.versions"/>
<import file="${basedir}/../multi-bundle/default.xml"/>
<target name="package" depends="ivy.init">
<delete dir="${package.output.dir}" quiet="true"/>
<mkdir dir="${package.output.dir}"/>
<mkdir dir="${package.output.dir}/plugins"/>
<property name="p2.tools.plugins.location" value="${package.output.dir}/plugins"/>
<!-- Prepare the minimal p2 publishing client -->
<ivy:resolve resolveId="copy.path" file="${basedir}/p2runtime-ivy.xml" transitive="true"/>
<ivy:retrieve resolveId="copy.path" pattern="${p2.tools.plugins.location}/[artifact]_[revision].[ext]" conf="p2-runtime" type="jar"/>
<ivy:resolve resolveId="copy.path" file="${basedir}/p2build-ivy.xml" transitive="true"/>
<ivy:retrieve resolveId="copy.path" pattern="${p2.tools.plugins.location}/[artifact]_[revision].[ext]" conf="p2-build" type="jar"/>
<get src="http://www.eclipse.org/downloads/download.php?file=/equinox/drops/S-3.8RC1-201205182145/org.eclipse.equinox.p2.repository.tools_2.0.100.v20120501-1314.jar&amp;r=1$" dest="${package.output.dir}/plugins/org.eclipse.equinox.p2.repository.tools_2.0.100.v20120501-1314.jar" usetimestamp="true" />
<copy todir="${package.output.dir}/configuration" failonerror="false">
<fileset dir="${basedir}/p2tools_ini" excludes="keystore"/>
<filterset>
<filter token="SIMPLE.CONFIG.VERSION" value="${org.eclipse.equinox.simpleconfigurator}"/>
<filter token="ECLIPSE.OSGI.VERSION" value="${org.eclipse.osgi}"/>
</filterset>
</copy>
<echo message="Building bundles.info for the minimal p2 client"/>
<java jar="${p2.tools.plugins.location}/org.eclipse.virgo.build.p2tools_${bundle.version}.jar" fork="true" taskname="BundlesInfoBuilder" failonerror="true" maxmemory="256m">
<arg value="${package.output.dir}"/>
</java>
<!-- Zip the minimal p2 client as artifact produced by this build -->
<mkdir dir="${artifacts.dir}"/>
<zip destfile="${package.output.file}">
<zipfileset dir="${package.output.dir}"/>
</zip>
</target>
<target name="test-e2e" depends="package">
<property name="repository.dir" value="${target.dir}/test-results/repository"/>
<property name="mirrored.repository.dir" value="${target.dir}/test-results/repository-mirrored"/>
<property name="converted.repository.dir" value="${target.dir}/test-results/repository-converted"/>
<property name="destination.dir" value="${target.dir}/test-results/install"/>
<echo message="[Test]Generate autostart p2.inf instruction for a features directory."/>
<antcall target="p2.generate-inf">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="source" value="${basedir}/e2e-testdata/features"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${basedir}/e2e-testdata/features/testFeatureA/p2.inf"/>
</antcall>
<delete file="${basedir}/e2e-testdata/features/testFeatureA/p2.inf"/>
<echo message="[Test]Publish of empty binary directory."/>
<antcall target="p2.publish-binary">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="repository" value="${repository.dir}"/>
<param name="source" value="${basedir}/e2e-testdata/binary.source/empty"/>
</antcall>
<antcall target="check-repository-exists">
<param name="repository" value="${repository.dir}"/>
</antcall>
<antcall target="check-file-not-exists">
<param name="file" value="${repository.dir}/binary"/>
</antcall>
<echo message="[Test]Publish of scripts binary directory with permissions." />
<antcall target="p2.publish-binary-chmod">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="repository" value="${repository.dir}"/>
<param name="source" value="${basedir}/e2e-testdata/binary.source/scripts"/>
<param name="chmod.args" value="testScript.sh@/bin#755"/>
</antcall>
<antcall target="check-repository-exists">
<param name="repository" value="${repository.dir}"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${repository.dir}/binary/scripts_1.0.0"/>
</antcall>
<echo message="[Test]Publish of properties binary directory with permissions." />
<antcall target="p2.publish-binary-chmod">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="repository" value="${repository.dir}"/>
<param name="source" value="${basedir}/e2e-testdata/binary.source/properties"/>
<param name="chmod.args" value="testProperties.properties@/config#600"/>
</antcall>
<antcall target="check-repository-exists">
<param name="repository" value="${repository.dir}"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${repository.dir}/binary/properties.zip_1.0.0"/>
</antcall>
<echo message="[Test]Publish of root properties binary with permissions." />
<antcall target="p2.publish-binary-chmod">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="repository" value="${repository.dir}"/>
<param name="source" value="${basedir}/e2e-testdata/binary.source/root"/>
<param name="chmod.args" value="rootProperties.properties@/#600"/>
</antcall>
<antcall target="check-repository-exists">
<param name="repository" value="${repository.dir}"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${repository.dir}/binary/root.zip_1.0.0"/>
</antcall>
<echo message="[Test]Publish bundles and features to the repository." />
<antcall target="p2.publish-bundles-features">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="repository" value="${repository.dir}"/>
<param name="source" value="${basedir}/e2e-testdata"/>
</antcall>
<antcall target="check-repository-exists">
<param name="repository" value="${repository.dir}"/>
</antcall>
<echo message="[Test]Publish bundles and features using the alternative form to the repository." />
<antcall target="p2.publish-bundles-features-alt">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="repository" value="${repository.dir}"/>
<param name="bundles" value="${basedir}/e2e-testdata/plugins-alt"/>
<param name="features" value="${basedir}/e2e-testdata/features-alt"/>
</antcall>
<antcall target="check-repository-exists">
<param name="repository" value="${repository.dir}"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${repository.dir}/features/testFeatureC_1.0.0.jar"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${repository.dir}/plugins/testBundleD_1.0.0.jar"/>
</antcall>
<echo message="[Test]Publish base.product to the repository." />
<antcall target="p2.publish-product">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="repository" value="${repository.dir}"/>
<param name="product.file.location" value="${basedir}/e2e-testdata/products/base/base.product"/>
</antcall>
<antcall target="check-repository-exists">
<param name="repository" value="${repository.dir}"/>
</antcall>
<echo message="[Test]Publish extension.product to the repository." />
<antcall target="p2.publish-product">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="repository" value="${repository.dir}"/>
<param name="product.file.location" value="${basedir}/e2e-testdata/products/extension/extension.product"/>
</antcall>
<antcall target="check-repository-exists">
<param name="repository" value="${repository.dir}"/>
</antcall>
<echo message="[Test]Categorize the features in the repository." />
<antcall target="p2.publish-category">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="repository" value="${repository.dir}"/>
<param name="category.file.location" value="${basedir}/e2e-testdata/categories/org.eclipse.virgo.categories/category.xml"/>
</antcall>
<antcall target="check-repository-exists">
<param name="repository" value="${repository.dir}"/>
</antcall>
<echo message="[Test]Install the extension propduct." />
<antcall target="p2.install-virgo-product">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="repository" value="${repository.dir}"/>
<param name="destination" value="${destination.dir}"/>
<param name="product.iu" value="extension.product"/>
</antcall>
<!-- validation! -->
<echo message="Checking if the installtion is good..."/>
<antcall target="check-installation-for-expected-artifacts">
<param name="repository" value="${repository.dir}"/>
<param name="file.to.check" value="${destination.dir}/rootProperties.properties"/>
</antcall>
<antcall target="check-installation-for-expected-artifacts">
<param name="repository" value="${repository.dir}"/>
<param name="file.to.check" value="${destination.dir}/bin/testScript.sh"/>
</antcall>
<antcall target="check-installation-for-expected-artifacts">
<param name="repository" value="${repository.dir}"/>
<param name="file.to.check" value="${destination.dir}/config/testProperties.properties"/>
</antcall>
<antcall target="check-installation-for-expected-artifacts">
<param name="repository" value="${repository.dir}"/>
<param name="file.to.check" value="${destination.dir}/plugins/testBundleC_1.0.0.jar"/>
</antcall>
<antcall target="check-installation-for-expected-artifacts">
<param name="repository" value="${repository.dir}"/>
<param name="file.to.check" value="${destination.dir}/p2/org.eclipse.equinox.p2.engine/profileRegistry/VIRGOProfile.profile"/>
</antcall>
<antcall target="check-installation-for-unexpected-artifacts">
<param name="repository" value="${repository.dir}"/>
<param name="file.to.check" value="${destination.dir}/features"/>
</antcall>
<echo message="[OK]Installation is good."/>
<echo message="[Test]Uninstall the root properties binary." />
<antcall target="p2.uninstall-iu">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="repository" value="${repository.dir}"/>
<param name="destination" value="${destination.dir}"/>
<param name="iu" value="root.zip"/>
</antcall>
<!-- if the uninstall isn't working correctly this install will fail with "IU already installed error" -->
<echo message="[Test]Install the root properties binary without getting already installed." />
<antcall target="p2.install-iu">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="repository" value="${repository.dir}"/>
<param name="destination" value="${destination.dir}"/>
<param name="iu" value="root.zip"/>
</antcall>
<echo message="[Test]Mirroring metadata from test repository." />
<antcall target="p2.mirror-metadata">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="source" value="file:${repository.dir}"/>
<param name="destination" value="${mirrored.repository.dir}"/>
<param name="roots" value="testBundleA"/>
</antcall>
<echo message="[Test]Mirroring artifacts from test repository." />
<antcall target="p2.mirror-artifacts">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="source" value="file:${repository.dir}"/>
<param name="destination" value="${mirrored.repository.dir}"/>
<param name="roots" value="testBundleA,testBundleB"/>
</antcall>
<antcall target="check-repository-exists">
<param name="repository" value="${mirrored.repository.dir}"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${mirrored.repository.dir}/plugins/testBundleA_1.0.0.jar"/>
</antcall>
<echo message="[Test]Convert test p2 repository to Ivy one." />
<delete dir="${converted.repository.dir}" quiet="true"/>
<mkdir dir="${converted.repository.dir}"/>
<antcall target="convert-p2-to-ivy">
<param name="tools.dir" value="${package.output.dir}"/>
<param name="source.plugins.dir" value="${mirrored.repository.dir}/plugins"/>
<param name="destination" value="${converted.repository.dir}"/>
<param name="offset.to.virgo.build" value="../../../.."/>
<param name="updated.build.versions.location" value="${converted.repository.dir}/updated.build.versions"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${converted.repository.dir}/updated.build.versions"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${converted.repository.dir}/build.xml"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${converted.repository.dir}/testBundleA_1.0.0/build.xml"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${converted.repository.dir}/testBundleA_1.0.0/ivy.xml"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${converted.repository.dir}/testBundleA_1.0.0/build.properties"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${converted.repository.dir}/testBundleA_1.0.0/target/artifacts/testBundleA.jar"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${converted.repository.dir}/testBundleB_1.0.0/build.xml"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${converted.repository.dir}/testBundleB_1.0.0/ivy.xml"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${converted.repository.dir}/testBundleB_1.0.0/build.properties"/>
</antcall>
<antcall target="check-file-exists">
<param name="file" value="${converted.repository.dir}/testBundleB_1.0.0/target/artifacts/testBundleB.jar"/>
</antcall>
</target>
<target name="check-repository-exists">
<condition property="isContentThere" value="true">
<resourceexists>
<file file="${repository}/content.jar"/>
</resourceexists>
</condition>
<condition property="areArtifactsThere" value="true">
<resourceexists>
<file file="${repository}/artifacts.jar"/>
</resourceexists>
</condition>
<fail message="[FAILURE] Missing metadata repository at ${repository}!" unless="isContentThere"/>
<fail message="[FAILURE] Missing artifact repository at ${repository}!" unless="areArtifactsThere"/>
<echo message="[OK]Generated repository exists at ${repository}."/>
</target>
<target name="check-file-exists">
<condition property="doesFileExist" value="true">
<resourceexists>
<file file="${file}"/>
</resourceexists>
</condition>
<fail message="[FAILURE] Missing file at ${file}!" unless="doesFileExist"/>
<echo message="[OK]File exists at ${file}."/>
</target>
<target name="check-file-not-exists">
<condition property="doesFileExist" value="true">
<resourceexists>
<file file="${file}"/>
</resourceexists>
</condition>
<fail message="[FAILURE] Unexpected file at ${file}!" if="doesFileExist"/>
<echo message="[OK]File is not existing at ${file}."/>
</target>
<target name="check-installation-for-expected-artifacts">
<condition property="isExisting" value="true">
<resourceexists>
<file file="${file.to.check}"/>
</resourceexists>
</condition>
<fail message="[FAILURE] Missing file at ${file.to.check}. The repository at ${repository} might be incorrect!" unless="isExisting"/>
</target>
<target name="check-installation-for-unexpected-artifacts">
<condition property="isExisting" value="true">
<resourceexists>
<file file="${file.to.check}"/>
</resourceexists>
</condition>
<fail message="[FAILURE] Unexpected file at ${file.to.check}. The repository at ${repository} might be incorrect!" if="isExisting"/>
</target>
</project>