| <?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"/> | |
| <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="destination.dir" value="${target.dir}/test-results/install"/> | |
| <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> | |
| </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> |