aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Gradl2011-06-28 09:02:48 (EDT)
committerjsievers2011-09-23 05:17:52 (EDT)
commitd9666189ea2c07e59d77bba34db8c4cb75952a15 (patch)
tree60b7e12e77c19dd21b949a882635c453cd32dc25
parent0b925591740b440dcc19e48481e8ae25c8f772ef (diff)
downloadorg.eclipse.tycho-d9666189ea2c07e59d77bba34db8c4cb75952a15.zip
org.eclipse.tycho-d9666189ea2c07e59d77bba34db8c4cb75952a15.tar.gz
org.eclipse.tycho-d9666189ea2c07e59d77bba34db8c4cb75952a15.tar.bz2
347923 Added test for standalone mirroring use case
- In standalone case (i.e. through a tycho-extras mojo), we simply want to mirror all units from the sources, regardless of platform filters and dependency relationships. - Refactoring: Introduced dedicated method for tycho-extras mirroring mojo, e.g. because there are certain assumptions when mirroring the reactor build results into an eclipse-repositories that do not hold in the standalone case.
-rw-r--r--tycho-p2-resolver/org.eclipse.tycho.p2.tools.facade/src/main/java/org/eclipse/tycho/p2/tools/mirroring/facade/MirrorApplicationService.java37
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceImpl.java154
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/artifacts.xml31
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/content.xml110
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.0.101.R34x_v20080731.jarbin0 -> 67201 bytes
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731.jarbin0 -> 32110 bytes
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceTest.java14
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorStandaloneTests.java47
-rw-r--r--tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/AssembleRepositoryMojo.java2
9 files changed, 311 insertions, 84 deletions
diff --git a/tycho-p2-resolver/org.eclipse.tycho.p2.tools.facade/src/main/java/org/eclipse/tycho/p2/tools/mirroring/facade/MirrorApplicationService.java b/tycho-p2-resolver/org.eclipse.tycho.p2.tools.facade/src/main/java/org/eclipse/tycho/p2/tools/mirroring/facade/MirrorApplicationService.java
index 6bd6075..1944174 100644
--- a/tycho-p2-resolver/org.eclipse.tycho.p2.tools.facade/src/main/java/org/eclipse/tycho/p2/tools/mirroring/facade/MirrorApplicationService.java
+++ b/tycho-p2-resolver/org.eclipse.tycho.p2.tools.facade/src/main/java/org/eclipse/tycho/p2/tools/mirroring/facade/MirrorApplicationService.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.tycho.p2.tools.mirroring.facade;
+import java.io.File;
import java.util.Collection;
import org.eclipse.tycho.core.facade.MavenLogger;
@@ -54,25 +55,47 @@ public interface MirrorApplicationService {
* @param destination
* The p2 repository that shall be written to. The location must be a directory,
* which may be empty. Existing content is not overwritten but is appended to.
- * @param rootUnits
+ * @param seedUnits
* A set of installable units that span the content to be copied. Note that the given
* installable units are written into the destination p2 repository without checking
* if they are actually present in the source repositories. Therefore only units from
- * the source repositories should be passed via this parameter. Alternatively, this
- * parameter may be <code>null</code> to mirror all units available in the sources.
+ * the source repositories should be passed via this parameter.
* @param context
* Build context information; in particular this parameter defines a filter for
* environment specific installable units
* @param flags
- * Additional options. flag is a <em>bitwise OR</em>'ed combination of
- * {@link #MIRROR_ARTIFACTS}, {@link #INCLUDE_ALL_DEPENDENCIES},
+ * Additional options as <em>bitwise OR</em>'ed combination of
+ * {@link #MIRROR_ARTIFACTS}, {@link #INCLUDE_ALL_DEPENDENCIES}, and
* {@link #REPOSITORY_COMPRESS}
* @param logger
* The maven logger
* @throws FacadeException
* if a checked exception occurs while mirroring
*/
- public void mirror(RepositoryReferences sources, DestinationRepositoryDescriptor destination,
- Collection<?/* IInstallableUnit */> rootUnits, BuildContext context, int flags, MavenLogger logger)
+ public void mirrorReactor(RepositoryReferences sources, DestinationRepositoryDescriptor destination,
+ Collection<?/* IInstallableUnit */> seedUnits, BuildContext context, int flags, MavenLogger logger)
throws FacadeException;
+
+ /**
+ * Copies all installable units from the source repositories to the destination repository. The
+ * corresponding artifacts are also copied if the {@link #INCLUDE_ALL_DEPENDENCIES} flag is set.
+ *
+ * @param sources
+ * The p2 repositories whose content shall be copied.
+ * @param destination
+ * The p2 repository that shall be written to. The location must be a directory,
+ * which may be empty. Existing content is not overwritten but is appended to.
+ * @param flags
+ * Additional options as <em>bitwise OR</em>'ed combination of
+ * {@link #MIRROR_ARTIFACTS} and {@link #REPOSITORY_COMPRESS}
+ * @param tempDirectory
+ * A directory for storing temporary results. Typically the build target folder of a
+ * module.
+ * @param logger
+ * The maven logger
+ * @throws FacadeException
+ * if a checked exception occurs while mirroring
+ */
+ void mirrorStandalone(RepositoryReferences sources, DestinationRepositoryDescriptor destination, int flags,
+ File tempDirectory, MavenLogger logger) throws FacadeException;
}
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceImpl.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceImpl.java
index ffac028..bb5df54 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceImpl.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceImpl.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.tycho.p2.tools.mirroring;
+import java.io.File;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
@@ -39,65 +40,96 @@ public class MirrorApplicationServiceImpl implements MirrorApplicationService {
private static final String MIRROR_FAILURE_MESSAGE = "Copying p2 repository content failed";
- public void mirror(RepositoryReferences sources, DestinationRepositoryDescriptor destination,
- Collection<?> rootUnits, BuildContext context, int flags, MavenLogger logger) throws FacadeException {
- IProvisioningAgent agent = Activator.createProvisioningAgent(context.getTargetDirectory());
+ public void mirrorStandalone(RepositoryReferences sources, DestinationRepositoryDescriptor destination, int flags,
+ File tempDirectory, MavenLogger logger) throws FacadeException {
+ IProvisioningAgent agent = Activator.createProvisioningAgent(tempDirectory);
try {
- final MirrorApplication mirrorApp = new MirrorApplication(agent);
-
- setSourceRepositories(mirrorApp, sources);
-
- final RepositoryDescriptor destinationDescriptor = new RepositoryDescriptor();
- destinationDescriptor.setLocation(destination.getLocation().toURI());
- destinationDescriptor.setAppend(true);
- destinationDescriptor.setName(destination.getName());
- boolean compressed = (flags & REPOSITORY_COMPRESS) != 0;
- destinationDescriptor.setCompressed(compressed);
- if ((flags & MIRROR_ARTIFACTS) != 0) {
- // metadata and artifacts is the default
- } else {
- // only mirror metadata
- destinationDescriptor.setKind(RepositoryDescriptor.KIND_METADATA);
- }
- mirrorApp.addDestination(destinationDescriptor);
+ final MirrorApplication mirrorApp = createMirrorApplication(sources, destination, flags, agent);
- if (rootUnits == null) {
- // mirror everything
- } else {
- mirrorApp.setSourceIUs(toInstallableUnitList(rootUnits));
- }
+ try {
+ mirrorApp.setLog(new LogListener(logger));
- final SlicingOptions options = new SlicingOptions();
- boolean includeAllDepenendcies = (flags & INCLUDE_ALL_DEPENDENCIES) != 0;
- options.considerStrictDependencyOnly(!includeAllDepenendcies);
+ IStatus returnStatus = mirrorApp.run(null);
+ checkStatus(returnStatus);
- List<TargetEnvironment> environments = context.getEnvironments();
- if (environments == null) {
- mirrorForAllEnvironments(mirrorApp, options, logger);
- } else {
- mirrorForSpecifiedEnvironments(mirrorApp, options, environments, logger);
+ } catch (ProvisionException e) {
+ throw new FacadeException(MIRROR_FAILURE_MESSAGE + ": " + StatusTool.collectProblems(e.getStatus()), e);
}
} finally {
agent.stop();
}
}
- private void mirrorForAllEnvironments(final MirrorApplication mirrorApp, final SlicingOptions options,
- MavenLogger logger) throws FacadeException {
- options.forceFilterTo(true);
- executeMirroring(mirrorApp, options, logger);
+ public void mirrorReactor(RepositoryReferences sources, DestinationRepositoryDescriptor destination,
+ Collection<?> seedUnits, BuildContext context, int flags, MavenLogger logger) throws FacadeException {
+ IProvisioningAgent agent = Activator.createProvisioningAgent(context.getTargetDirectory());
+ try {
+ final MirrorApplication mirrorApp = createMirrorApplication(sources, destination, flags, agent);
+
+ // mirror scope: seed units...
+ mirrorApp.setSourceIUs(toInstallableUnitList(seedUnits));
+
+ // ... plus inclusions/dependencies
+ SlicingOptions options = new SlicingOptions();
+ boolean includeAllDependencies = (flags & INCLUDE_ALL_DEPENDENCIES) != 0;
+ options.considerStrictDependencyOnly(!includeAllDependencies);
+
+ // TODO the p2 mirror tool should support mirroring multiple environments at once
+ for (TargetEnvironment environment : context.getEnvironments()) {
+ Map<String, String> filter = environment.toFilter();
+ addFilterForFeatureJARs(filter);
+ options.setFilter(filter);
+ mirrorApp.setSlicingOptions(options);
+
+ try {
+ LogListener logListener = new LogListener(logger);
+ mirrorApp.setLog(logListener);
+
+ IStatus returnStatus = mirrorApp.run(null);
+ checkStatus(returnStatus);
+ logListener.showHelpForLoggedMessages();
+
+ } catch (ProvisionException e) {
+ throw new FacadeException(
+ MIRROR_FAILURE_MESSAGE + ": " + StatusTool.collectProblems(e.getStatus()), e);
+ }
+ }
+ } finally {
+ agent.stop();
+ }
}
- private void mirrorForSpecifiedEnvironments(final MirrorApplication mirrorApp, final SlicingOptions options,
- List<TargetEnvironment> environments, MavenLogger logger) throws FacadeException {
- // TODO the p2 mirror tool should support mirroring multiple environments at once
- for (TargetEnvironment environment : environments) {
- Map<String, String> filter = environment.toFilter();
- addFilterForFeatureJARs(filter);
- options.setFilter(filter);
+ private static MirrorApplication createMirrorApplication(RepositoryReferences sources,
+ DestinationRepositoryDescriptor destination, int flags, IProvisioningAgent agent) {
+ final MirrorApplication mirrorApp = new MirrorApplication(agent);
+
+ List<RepositoryDescriptor> sourceDescriptors = createSourceDescriptors(sources);
+ for (RepositoryDescriptor sourceDescriptor : sourceDescriptors) {
+ mirrorApp.addSource(sourceDescriptor);
+ }
+ mirrorApp.addDestination(createDestinationDescriptor(destination, flags));
+
+ // mirrorApp.setValidate( true ); // TODO Broken; fix at Eclipse
+
+ return mirrorApp;
+ }
- executeMirroring(mirrorApp, options, logger);
+ private static RepositoryDescriptor createDestinationDescriptor(DestinationRepositoryDescriptor destination,
+ int flags) {
+ final RepositoryDescriptor destinationDescriptor = new RepositoryDescriptor();
+ destinationDescriptor.setLocation(destination.getLocation().toURI());
+ destinationDescriptor.setAppend(true);
+ destinationDescriptor.setName(destination.getName());
+ boolean compressed = (flags & REPOSITORY_COMPRESS) != 0;
+ destinationDescriptor.setCompressed(compressed);
+
+ if ((flags & MIRROR_ARTIFACTS) != 0) {
+ // metadata and artifacts is the default
+ } else {
+ // only mirror metadata
+ destinationDescriptor.setKind(RepositoryDescriptor.KIND_METADATA);
}
+ return destinationDescriptor;
}
/**
@@ -107,36 +139,20 @@ public class MirrorApplicationServiceImpl implements MirrorApplicationService {
filter.put("org.eclipse.update.install.features", "true");
}
- private void executeMirroring(MirrorApplication mirrorApp, SlicingOptions options, MavenLogger logger)
- throws FacadeException {
- try {
- LogListener logListener = new LogListener(logger);
- mirrorApp.setLog(logListener);
- // mirrorApp.setValidate( true ); // TODO Broken; fix at Eclipse
-
- mirrorApp.setSlicingOptions(options);
-
- IStatus returnStatus = mirrorApp.run(null);
- checkStatus(returnStatus);
- logListener.showHelpForLoggedMessages();
-
- } catch (ProvisionException e) {
- throw new FacadeException(MIRROR_FAILURE_MESSAGE + ": " + StatusTool.collectProblems(e.getStatus()), e);
- }
- }
-
- private static void setSourceRepositories(MirrorApplication mirrorApp, RepositoryReferences sources) {
- setSourceRepositories(mirrorApp, sources.getMetadataRepositories(), RepositoryDescriptor.KIND_METADATA);
- setSourceRepositories(mirrorApp, sources.getArtifactRepositories(), RepositoryDescriptor.KIND_ARTIFACT);
+ private static List<RepositoryDescriptor> createSourceDescriptors(RepositoryReferences sources) {
+ List<RepositoryDescriptor> result = new ArrayList<RepositoryDescriptor>();
+ createSourceRepositories(result, sources.getMetadataRepositories(), RepositoryDescriptor.KIND_METADATA);
+ createSourceRepositories(result, sources.getArtifactRepositories(), RepositoryDescriptor.KIND_ARTIFACT);
+ return result;
}
- private static void setSourceRepositories(MirrorApplication mirrorApp, Collection<URI> repositoryLocations,
- String repositoryKind) {
+ private static void createSourceRepositories(List<RepositoryDescriptor> result,
+ Collection<URI> repositoryLocations, String repositoryKind) {
for (URI repositoryLocation : repositoryLocations) {
RepositoryDescriptor repository = new RepositoryDescriptor();
repository.setKind(repositoryKind);
repository.setLocation(repositoryLocation);
- mirrorApp.addSource(repository);
+ result.add(repository);
}
}
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/artifacts.xml b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/artifacts.xml
new file mode 100644
index 0000000..a3a7f27
--- /dev/null
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/artifacts.xml
@@ -0,0 +1,31 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<?artifactRepository version='1.1.0'?>
+<repository name='Exported Repository' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1.0.0'>
+ <properties size='2'>
+ <property name='p2.timestamp' value='1306337330782'/>
+ <property name='p2.compressed' value='true'/>
+ </properties>
+ <mappings size='3'>
+ <rule filter='(&amp; (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/>
+ <rule filter='(&amp; (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/>
+ <rule filter='(&amp; (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/>
+ </mappings>
+ <artifacts size='2'>
+ <artifact classifier='osgi.bundle' id='org.eclipse.equinox.launcher.gtk.linux.x86_64' version='1.0.101.R34x_v20080731'>
+ <properties size='4'>
+ <property name='artifact.size' value='67201'/>
+ <property name='download.size' value='67201'/>
+ <property name='download.md5' value='7285097a740dd188b83aa0d3dd2a195f'/>
+ <property name='download.contentType' value='application/zip'/>
+ </properties>
+ </artifact>
+ <artifact classifier='osgi.bundle' id='org.eclipse.equinox.launcher.win32.win32.x86' version='1.0.101.R34x_v20080731'>
+ <properties size='4'>
+ <property name='artifact.size' value='32110'/>
+ <property name='download.size' value='32110'/>
+ <property name='download.md5' value='80f99d80b2152835087a4b6bd4d7d8d0'/>
+ <property name='download.contentType' value='application/zip'/>
+ </properties>
+ </artifact>
+ </artifacts>
+</repository>
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/content.xml b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/content.xml
new file mode 100644
index 0000000..728c36a
--- /dev/null
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/content.xml
@@ -0,0 +1,110 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<?metadataRepository version='1.1.0'?>
+<repository name='fragments' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1.0.0'>
+ <properties size='2'>
+ <property name='p2.timestamp' value='1306337331079'/>
+ <property name='p2.compressed' value='true'/>
+ </properties>
+ <units size='4'>
+ <unit id='org.eclipse.equinox.launcher.win32.win32.x86.translated_host_properties' version='1.0.101.R34x_v20080731'>
+ <hostRequirements size='1'>
+ <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.equinox.launcher' range='[1.0.0,1.1.0)' greedy='false'/>
+ </hostRequirements>
+ <properties size='3'>
+ <property name='org.eclipse.equinox.p2.type.fragment' value='true'/>
+ <property name='df_LT.providerName' value='Eclipse.org'/>
+ <property name='df_LT.pluginName' value='Equinox Launcher Win32 X86 Fragment'/>
+ </properties>
+ <provides size='1'>
+ <provided namespace='org.eclipse.equinox.p2.localization' name='df_LT' version='1.0.0'/>
+ </provides>
+ <requires size='1'>
+ <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.equinox.launcher' range='[1.0.0,1.1.0)' greedy='false'/>
+ </requires>
+ <touchpoint id='null' version='0.0.0'/>
+ </unit>
+ <unit id='org.eclipse.equinox.launcher.win32.win32.x86' version='1.0.101.R34x_v20080731'>
+ <update id='org.eclipse.equinox.launcher.win32.win32.x86' range='[0.0.0,1.0.101.R34x_v20080731)' severity='0'/>
+ <properties size='4'>
+ <property name='df_LT.providerName' value='Eclipse.org'/>
+ <property name='df_LT.pluginName' value='Equinox Launcher Win32 X86 Fragment'/>
+ <property name='org.eclipse.equinox.p2.name' value='%pluginName'/>
+ <property name='org.eclipse.equinox.p2.provider' value='%providerName'/>
+ </properties>
+ <provides size='5'>
+ <provided namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.equinox.launcher.win32.win32.x86' version='1.0.101.R34x_v20080731'/>
+ <provided namespace='osgi.bundle' name='org.eclipse.equinox.launcher.win32.win32.x86' version='1.0.101.R34x_v20080731'/>
+ <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/>
+ <provided namespace='osgi.fragment' name='org.eclipse.equinox.launcher' version='1.0.101.R34x_v20080731'/>
+ <provided namespace='org.eclipse.equinox.p2.localization' name='df_LT' version='1.0.0'/>
+ </provides>
+ <requires size='1'>
+ <required namespace='osgi.bundle' name='org.eclipse.equinox.launcher' range='[1.0.0,1.1.0)'/>
+ </requires>
+ <filter>
+ (&amp; (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86))
+ </filter>
+ <artifacts size='1'>
+ <artifact classifier='osgi.bundle' id='org.eclipse.equinox.launcher.win32.win32.x86' version='1.0.101.R34x_v20080731'/>
+ </artifacts>
+ <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
+ <touchpointData size='1'>
+ <instructions size='1'>
+ <instruction key='manifest'>
+ Bundle-ManifestVersion: 2&#xA;Bundle-Name: %pluginName&#xA;Bundle-Version: 1.0.101.R34x_v20080731&#xA;Fragment-Host: org.eclipse.equinox.launcher;bundle-version=&quot;[1.0.0,1.1.0)&quot;&#xA;Eclipse-PlatformFilter: (&amp; (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86))&#xA;Bundle-SymbolicName: org.eclipse.equinox.launcher.win32.win32.x86; singleton:=true&#xA;Bundle-Localization: launcher.win32.win32.x86&#xA;Manifest-Version: 1.0&#xA;Bundle-Vendor: %providerName
+ </instruction>
+ </instructions>
+ </touchpointData>
+ </unit>
+ <unit id='org.eclipse.equinox.launcher.gtk.linux.x86_64' version='1.0.101.R34x_v20080731'>
+ <update id='org.eclipse.equinox.launcher.gtk.linux.x86_64' range='[0.0.0,1.0.101.R34x_v20080731)' severity='0'/>
+ <properties size='4'>
+ <property name='df_LT.providerName' value='Eclipse.org'/>
+ <property name='df_LT.pluginName' value='Equinox Launcher Linux X86_64 Fragment'/>
+ <property name='org.eclipse.equinox.p2.name' value='%pluginName'/>
+ <property name='org.eclipse.equinox.p2.provider' value='%providerName'/>
+ </properties>
+ <provides size='5'>
+ <provided namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.equinox.launcher.gtk.linux.x86_64' version='1.0.101.R34x_v20080731'/>
+ <provided namespace='osgi.bundle' name='org.eclipse.equinox.launcher.gtk.linux.x86_64' version='1.0.101.R34x_v20080731'/>
+ <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/>
+ <provided namespace='osgi.fragment' name='org.eclipse.equinox.launcher' version='1.0.101.R34x_v20080731'/>
+ <provided namespace='org.eclipse.equinox.p2.localization' name='df_LT' version='1.0.0'/>
+ </provides>
+ <requires size='1'>
+ <required namespace='osgi.bundle' name='org.eclipse.equinox.launcher' range='[1.0.0,1.1.0)'/>
+ </requires>
+ <filter>
+ (&amp; (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=x86_64))
+ </filter>
+ <artifacts size='1'>
+ <artifact classifier='osgi.bundle' id='org.eclipse.equinox.launcher.gtk.linux.x86_64' version='1.0.101.R34x_v20080731'/>
+ </artifacts>
+ <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
+ <touchpointData size='1'>
+ <instructions size='1'>
+ <instruction key='manifest'>
+ Bundle-ManifestVersion: 2&#xA;Bundle-Name: %pluginName&#xA;Bundle-Version: 1.0.101.R34x_v20080731&#xA;Fragment-Host: org.eclipse.equinox.launcher;bundle-version=&quot;[1.0.0,1.1.0)&quot;&#xA;Eclipse-PlatformFilter: (&amp; (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=x86_64))&#xA;Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.linux.x86_64;singleton:=true&#xA;Bundle-Localization: launcher.gtk.linux.x86_64&#xA;Manifest-Version: 1.0&#xA;Bundle-Vendor: %providerName
+ </instruction>
+ </instructions>
+ </touchpointData>
+ </unit>
+ <unit id='org.eclipse.equinox.launcher.gtk.linux.x86_64.translated_host_properties' version='1.0.101.R34x_v20080731'>
+ <hostRequirements size='1'>
+ <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.equinox.launcher' range='[1.0.0,1.1.0)' greedy='false'/>
+ </hostRequirements>
+ <properties size='3'>
+ <property name='org.eclipse.equinox.p2.type.fragment' value='true'/>
+ <property name='df_LT.providerName' value='Eclipse.org'/>
+ <property name='df_LT.pluginName' value='Equinox Launcher Linux X86_64 Fragment'/>
+ </properties>
+ <provides size='1'>
+ <provided namespace='org.eclipse.equinox.p2.localization' name='df_LT' version='1.0.0'/>
+ </provides>
+ <requires size='1'>
+ <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.equinox.launcher' range='[1.0.0,1.1.0)' greedy='false'/>
+ </requires>
+ <touchpoint id='null' version='0.0.0'/>
+ </unit>
+ </units>
+</repository>
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.0.101.R34x_v20080731.jar b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.0.101.R34x_v20080731.jar
new file mode 100644
index 0000000..0f5f145
--- /dev/null
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.0.101.R34x_v20080731.jar
Binary files differ
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731.jar b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731.jar
new file mode 100644
index 0000000..891ec17
--- /dev/null
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/resources/repositories/fragments/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731.jar
Binary files differ
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceTest.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceTest.java
index 92c4236..6ef3cf4 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceTest.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorApplicationServiceTest.java
@@ -78,7 +78,7 @@ public class MirrorApplicationServiceTest {
@Test
public void testMirrorFeatureWithContent() throws Exception {
- subject.mirror(sourceRepos("patch", "e342"), destinationRepo, seedFor(SIMPLE_FEATURE_IU), context,
+ subject.mirrorReactor(sourceRepos("patch", "e342"), destinationRepo, seedFor(SIMPLE_FEATURE_IU), context,
DEFAULT_FLAGS, logger);
assertEquals(Collections.emptyList(), logger.warnings);
@@ -88,7 +88,7 @@ public class MirrorApplicationServiceTest {
@Test
public void testMirrorPatch() throws Exception {
- subject.mirror(sourceRepos("patch", "e352"), destinationRepo, seedFor(FEATURE_PATCH_IU), context,
+ subject.mirrorReactor(sourceRepos("patch", "e352"), destinationRepo, seedFor(FEATURE_PATCH_IU), context,
DEFAULT_FLAGS, logger);
assertEquals(Collections.emptyList(), logger.warnings);
@@ -98,7 +98,7 @@ public class MirrorApplicationServiceTest {
@Test
public void testMirrorFeatureAndPatch() throws Exception {
- subject.mirror(sourceRepos("patch", "e352"), destinationRepo, seedFor(SIMPLE_FEATURE_IU, FEATURE_PATCH_IU),
+ subject.mirrorReactor(sourceRepos("patch", "e352"), destinationRepo, seedFor(SIMPLE_FEATURE_IU, FEATURE_PATCH_IU),
context, DEFAULT_FLAGS, logger);
assertTrue(repoFile(destinationRepo, "plugins/org.eclipse.core.runtime_3.5.0.v20090525.jar").exists());
@@ -117,13 +117,13 @@ public class MirrorApplicationServiceTest {
* since it is not easy to distinguish between patched and unpatched dependencies, only a
* warning is issued.
*/
- subject.mirror(sourceRepos("patch"), destinationRepo, seedFor(SIMPLE_FEATURE_IU), context, DEFAULT_FLAGS,
+ subject.mirrorReactor(sourceRepos("patch"), destinationRepo, seedFor(SIMPLE_FEATURE_IU), context, DEFAULT_FLAGS,
logger);
assertTrue(logger.warnings.size() > 0);
}
- private static RepositoryReferences sourceRepos(String... repoIds) {
+ static RepositoryReferences sourceRepos(String... repoIds) {
RepositoryReferences result = new RepositoryReferences();
for (String repoId : repoIds) {
result.addMetadataRepository(ResourceUtil.resolveTestResource("resources/repositories/" + repoId));
@@ -151,11 +151,11 @@ public class MirrorApplicationServiceTest {
return Collections.singleton(requirement);
}
- private static File repoFile(DestinationRepositoryDescriptor repo, String path) {
+ static File repoFile(DestinationRepositoryDescriptor repo, String path) {
return new File(repo.getLocation(), path);
}
- private static class MemoryLog implements MavenLogger {
+ static class MemoryLog implements MavenLogger {
List<String> warnings = new ArrayList<String>();
public void warn(String message) {
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorStandaloneTests.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorStandaloneTests.java
new file mode 100644
index 0000000..0be6134
--- /dev/null
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/mirroring/MirrorStandaloneTests.java
@@ -0,0 +1,47 @@
+package org.eclipse.tycho.p2.tools.mirroring;
+
+import static org.eclipse.tycho.p2.tools.mirroring.MirrorApplicationServiceTest.repoFile;
+import static org.eclipse.tycho.p2.tools.mirroring.MirrorApplicationServiceTest.sourceRepos;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.tycho.core.facade.MavenLogger;
+import org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor;
+import org.eclipse.tycho.p2.tools.mirroring.facade.MirrorApplicationService;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+public class MirrorStandaloneTests {
+ private static final int DEFAULT_FLAGS = MirrorApplicationService.MIRROR_ARTIFACTS;
+ private static final String DEFAULT_NAME = "dummy";
+
+ private DestinationRepositoryDescriptor destinationRepo;
+ private MavenLogger logger;
+
+ private MirrorApplicationServiceImpl subject;
+
+ @Rule
+ public TemporaryFolder tempFolder = new TemporaryFolder();
+
+ @Before
+ public void initTestContext() {
+ logger = new MirrorApplicationServiceTest.MemoryLog();
+ destinationRepo = new DestinationRepositoryDescriptor(tempFolder.newFolder("dest"), DEFAULT_NAME);
+
+ subject = new MirrorApplicationServiceImpl();
+ }
+
+ @Test
+ public void testMirrorAllUnits() throws Exception {
+ subject.mirrorStandalone(sourceRepos("e342", "fragments"), destinationRepo, DEFAULT_FLAGS,
+ tempFolder.getRoot(), logger);
+
+ assertTrue(repoFile(destinationRepo, "plugins/org.eclipse.core.runtime_3.4.0.v20080512.jar").exists());
+ assertTrue(repoFile(destinationRepo,
+ "plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.0.101.R34x_v20080731.jar").exists());
+ assertTrue(repoFile(destinationRepo,
+ "plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731.jar").exists());
+ }
+
+}
diff --git a/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/AssembleRepositoryMojo.java b/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/AssembleRepositoryMojo.java
index 78390aa..2da0d33 100644
--- a/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/AssembleRepositoryMojo.java
+++ b/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/AssembleRepositoryMojo.java
@@ -92,7 +92,7 @@ public class AssembleRepositoryMojo extends AbstractRepositoryMojo implements Lo
}
MirrorApplicationService mirrorApp = p2.getService(MirrorApplicationService.class);
- mirrorApp.mirror(sources, new DestinationRepositoryDescriptor(destination, repositoryName), rootIUs,
+ mirrorApp.mirrorReactor(sources, new DestinationRepositoryDescriptor(destination, repositoryName), rootIUs,
getBuildContext(), flags, new MavenLoggerAdapter(logger, false));
} catch (FacadeException e) {
throw new MojoExecutionException("Could not assemble p2 repository", e);