public TargetPlatform computeTargetPlatform(
      MavenSession session, MavenProject project, List<ReactorProject> reactorProjects) {
    TargetPlatformConfiguration configuration =
        TychoProjectUtils.getTargetPlatformConfiguration(project);

    ExecutionEnvironment ee =
        projectTypes.get(project.getPackaging()).getExecutionEnvironment(project);

    TargetPlatformBuilder tpBuilder =
        resolverFactory.createTargetPlatformBuilder( //
            ee != null ? ee.getProfileName() : null, configuration.isDisableP2Mirrors());
    tpBuilder.setProjectLocation(project.getBasedir());

    addReactorProjectsToTargetPlatform(reactorProjects, tpBuilder);

    if (TargetPlatformConfiguration.POM_DEPENDENCIES_CONSIDER.equals(
        configuration.getPomDependencies())) {
      addPomDependenciesToTargetPlatform(project, tpBuilder, reactorProjects, session);
    }

    for (ArtifactRepository repository : project.getRemoteArtifactRepositories()) {
      addEntireP2RepositoryToTargetPlatform(repository, tpBuilder, session);
    }

    if (configuration.getTarget() != null) {
      addTargetFileContentToTargetPlatform(configuration, tpBuilder, session);
    }

    tpBuilder.addFilters(configuration.getFilters());

    return tpBuilder.buildTargetPlatform();
  }
Beispiel #2
0
  /** Returns the configured environments in a format suitable for the p2 tools facade. */
  private List<TargetEnvironment> getEnvironmentsForFacade() {
    // TODO use shared class everywhere?

    List<org.eclipse.tycho.core.TargetEnvironment> original =
        TychoProjectUtils.getTargetPlatformConfiguration(project).getEnvironments();
    List<TargetEnvironment> converted = new ArrayList<TargetEnvironment>(original.size());
    for (org.eclipse.tycho.core.TargetEnvironment env : original) {
      converted.add(new TargetEnvironment(env.getWs(), env.getOs(), env.getArch()));
    }
    return converted;
  }
Beispiel #3
0
  // TODO implement at eclipse: have product publisher take the executables from the context
  // repositories
  private File getEquinoxExecutableFeature() throws MojoExecutionException, MojoFailureException {
    // TODO 364134 take the executable feature from the target platform instead
    DependencyArtifacts dependencyArtifacts =
        TychoProjectUtils.getDependencyArtifacts(getProject());
    ArtifactDescriptor artifact =
        dependencyArtifacts.getArtifact(
            ArtifactType.TYPE_ECLIPSE_FEATURE, "org.eclipse.equinox.executable", null);

    if (artifact == null) {
      throw new MojoExecutionException(
          "Unable to locate the equinox launcher feature (aka delta-pack)");
    }

    File equinoxExecFeature = artifact.getLocation();
    if (equinoxExecFeature.isDirectory()) {
      return equinoxExecFeature.getAbsoluteFile();
    } else {
      File unzipped =
          new File(
              getProject().getBuild().getDirectory(),
              artifact.getKey().getId() + "-" + artifact.getKey().getVersion());
      if (unzipped.exists()) {
        return unzipped.getAbsoluteFile();
      }
      try {
        FileLocker locker = fileLockService.getFileLocker(equinoxExecFeature);
        locker.lock();
        try {
          // unzip now then:
          unzipped.mkdirs();
          deflater.setSourceFile(equinoxExecFeature);
          deflater.setDestDirectory(unzipped);
          deflater.extract();
          return unzipped.getAbsoluteFile();
        } finally {
          locker.release();
        }
      } catch (ArchiverException e) {
        throw new MojoFailureException("Unable to unzip the eqiuinox executable feature", e);
      }
    }
  }
  public DependencyArtifacts resolveDependencies(
      final MavenSession session,
      final MavenProject project,
      TargetPlatform resolutionContext,
      List<ReactorProject> reactorProjects,
      DependencyResolverConfiguration resolverConfiguration) {

    // TODO 364134 For compatibility reasons, target-platform-configuration includes settings for
    // the dependency resolution
    // --> split this information logically, e.g. through two distinct interfaces
    TargetPlatformConfiguration configuration =
        TychoProjectUtils.getTargetPlatformConfiguration(project);

    P2Resolver osgiResolverImpl = resolverFactory.createResolver();

    return doResolvePlatform(
        session,
        project,
        reactorProjects,
        resolverConfiguration,
        resolutionContext,
        osgiResolverImpl,
        configuration);
  }
 List<TargetEnvironment> getEnvironments() {
   TargetPlatformConfiguration configuration =
       TychoProjectUtils.getTargetPlatformConfiguration(project);
   return configuration.getEnvironments();
 }