Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-dev] Filtering platform-specific bundles in MirrorApplicationService.mirrorReactor

Hi all,

I'm working on the TestMojo, and I'm trying to have it creating a p2 repository made of bundle of current module + its dependencies. Here is the code I use:
  // Copied from AssembleRepositoryMojo
  int flags = RepositoryReferenceTool.REPOSITORIES_INCLUDE_CURRENT_MODULE;
  RepositoryReferences sources = this.repositoryReferenceTool.getVisibleRepositories(this.project, this.session, flags);
  List<TargetEnvironment> environments = new ArrayList<TargetEnvironment>();
  BuildContext buildContext = new BuildContext(new MavenReactorProjectCoordinates(this.project), this.qualifier, environments);

  MirrorApplicationService mirrorApp = this.p2.getService(MirrorApplicationService.class);
  DestinationRepositoryDescriptor destinationRepoDescriptor = new DestinationRepositoryDescriptor(testDependenciesRepoDestination, "surefire test dependencies", false, false, true);
  Map<String, String> slicingOptions = new HashMap<String, String>();
  slicingOptions.put("platformfilter", TargetEnvironment.getRunningEnvironment().getOs() + ","
    + TargetEnvironment.getRunningEnvironment().getWs() + ","
    + TargetEnvironment.getRunningEnvironment().getArch());
  slicingOptions.put("followOnlyFilteredRequirements", Boolean.toString(true));
  mirrorApp.mirrorReactor(sources, destinationRepoDescriptor, Collections.EMPTY_LIST, buildContext, true, false, slicingOptions);

As you can see, I try several things to get only a mirror of what is relevant for the current platform. (environments contain only the current running environment, and I pass specifically the current environment in slicingOptions). I've also tried various combinations (leaving to defaut values, setting environment but not slicing options and vice-versa) However, I still get this error on my Linux machine:
  Caused by: Mirroring failed: Problems resolving provisioning plan.: [org.eclipse.swt.win32.win32.x86_64 3.102.0.v20130605-1544 cannot be installed in this environment because its filter is not applicable.]
    at org.eclipse.tycho.surefire.TestMojo.createInstallationFromProvisionnedApplication(
    ... 22 more
  Caused by: org.eclipse.equinox.p2.core.ProvisionException: Problems resolving provisioning plan.
    ... 23 more

Do you have any hint on what I should change to be able to have this MirrorApplicationService.mirror() working and honouring platform filtering?

Mickael Istria
Eclipse developer at JBoss, by Red Hat
My blog - My Tweets

Back to the top