private boolean isAllowConflictingDependencies(
      MavenProject project, TargetPlatformConfiguration configuration) {
    String packaging = project.getPackaging();

    if (org.eclipse.tycho.ArtifactKey.TYPE_ECLIPSE_UPDATE_SITE.equals(packaging)
        || org.eclipse.tycho.ArtifactKey.TYPE_ECLIPSE_FEATURE.equals(packaging)) {
      Boolean allow = configuration.getAllowConflictingDependencies();
      if (allow != null) {
        return allow.booleanValue();
      }
    }

    // conflicting dependencies do not make sense for products and bundles
    return false;
  }
Пример #2
0
  @Override
  protected List<IPublisherAction> getPublisherActions(
      IArtifactFacade artifact,
      List<Map<String, String>> environments,
      OptionalResolutionAction optionalAction) {

    if (!dependenciesOnly && optionalAction != null) {
      throw new IllegalArgumentException();
    }

    List<IPublisherAction> actions = new ArrayList<IPublisherAction>();

    String packaging = artifact.getPackagingType();
    File location = artifact.getLocation();
    if (ArtifactKey.TYPE_ECLIPSE_PLUGIN.equals(packaging)
        || ArtifactKey.TYPE_ECLIPSE_TEST_PLUGIN.equals(packaging)) {
      if (dependenciesOnly && optionalAction != null) {
        actions.add(new BundleDependenciesAction(location, optionalAction));
      } else {
        actions.add(new TychoBundleAction(location));
      }
    } else if (ArtifactKey.TYPE_ECLIPSE_FEATURE.equals(packaging)) {
      Feature feature = new FeatureParser().parse(location);
      feature.setLocation(location.getAbsolutePath());
      if (dependenciesOnly) {
        actions.add(new FeatureDependenciesAction(feature));
      } else {
        actions.add(new FeaturesAction(new Feature[] {feature}));
      }
    } else if (ArtifactKey.TYPE_ECLIPSE_APPLICATION.equals(packaging)) {
      String product = new File(location, artifact.getArtifactId() + ".product").getAbsolutePath();
      try {
        IProductDescriptor productDescriptor = new ProductFile2(product);
        if (dependenciesOnly) {
          actions.add(new ProductDependenciesAction(productDescriptor, environments));
        } else {
          actions.add(new ProductAction(product, productDescriptor, null, null));
        }
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    } else if (ArtifactKey.TYPE_ECLIPSE_UPDATE_SITE.equals(packaging)) {
      if (dependenciesOnly) {
        actions.add(
            new SiteDependenciesAction(location, artifact.getArtifactId(), artifact.getVersion()));
      } else {
        actions.add(new SiteXMLAction(location.toURI(), null));
      }
    } else if (ArtifactKey.TYPE_ECLIPSE_REPOSITORY.equals(packaging)) {
      for (File productFile : getProductFiles(location)) {
        String product = productFile.getAbsolutePath();
        IProductDescriptor productDescriptor;
        try {
          productDescriptor = new ProductFile2(product);
        } catch (Exception e) {
          throw new RuntimeException("Unable to parse the product file " + product, e);
        }
        if (dependenciesOnly) {
          actions.add(new ProductDependenciesAction(productDescriptor, environments));
        }
      }
      for (File categoryFile : getCategoryFiles(location)) {
        CategoryParser cp = new CategoryParser(null);
        FileInputStream ins = null;
        try {
          try {
            ins = new FileInputStream(categoryFile);
            SiteModel siteModel = cp.parse(ins);
            actions.add(
                new CategoryDependenciesAction(
                    siteModel, artifact.getArtifactId(), artifact.getVersion()));
          } finally {
            if (ins != null) {
              ins.close();
            }
          }
        } catch (Exception e) {
          throw new RuntimeException("Unable to read category File", e);
        }
      }
    } else if (location.isFile() && location.getName().endsWith(".jar")) {
      actions.add(new TychoBundleAction(location));
    } else {
      throw new IllegalArgumentException("Unknown type of packaging " + packaging);
    }

    return actions;
  }