Search in sources :

Example 11 with FeatureRef

use of org.eclipse.tycho.model.FeatureRef in project tycho by eclipse.

the class GeneratePomsMojo method getSiteFeaturesAndPlugins.

private Set<File> getSiteFeaturesAndPlugins(File basedir) throws MojoExecutionException {
    try {
        Set<File> result = new LinkedHashSet<>();
        UpdateSite site;
        File siteFile = new File(basedir, "site.xml");
        if (siteFile.exists()) {
            site = UpdateSite.read(siteFile);
            for (FeatureRef feature : site.getFeatures()) {
                addFeature(result, feature.getId());
            }
        }
        return result;
    } catch (Exception e) {
        throw new MojoExecutionException("Could not collect update site features and plugins", e);
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) FeatureRef(org.eclipse.tycho.model.FeatureRef) File(java.io.File) UpdateSite(org.eclipse.tycho.model.UpdateSite) BundleException(org.osgi.framework.BundleException) XmlPullParserException(org.codehaus.plexus.util.xml.pull.XmlPullParserException) IOException(java.io.IOException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException)

Example 12 with FeatureRef

use of org.eclipse.tycho.model.FeatureRef in project tycho by eclipse.

the class FeatureXmlTransformer method expandReferences.

/**
 * Replaces references in the feature model with versions from the target platform.
 *
 * @param feature
 *            The feature model to have plug-in and feature references completed.
 */
public Feature expandReferences(Feature feature, TargetPlatform targetPlatform) throws MojoFailureException {
    for (PluginRef pluginRef : feature.getPlugins()) {
        ArtifactKey plugin = resolvePluginReference(targetPlatform, pluginRef);
        pluginRef.setVersion(plugin.getVersion());
        File location = targetPlatform.getArtifactLocation(plugin);
        setDownloadAndInstallSize(pluginRef, location);
    }
    for (FeatureRef featureRef : feature.getIncludedFeatures()) {
        ArtifactKey includedFeature = resolveFeatureReference(targetPlatform, featureRef);
        featureRef.setVersion(includedFeature.getVersion());
    }
    return feature;
}
Also used : ArtifactKey(org.eclipse.tycho.ArtifactKey) PluginRef(org.eclipse.tycho.model.PluginRef) FeatureRef(org.eclipse.tycho.model.FeatureRef) JarFile(java.util.jar.JarFile) File(java.io.File)

Aggregations

FeatureRef (org.eclipse.tycho.model.FeatureRef)12 PluginRef (org.eclipse.tycho.model.PluginRef)7 File (java.io.File)5 IOException (java.io.IOException)3 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)3 ArtifactKey (org.eclipse.tycho.ArtifactKey)3 UpdateSite (org.eclipse.tycho.model.UpdateSite)3 LinkedHashSet (java.util.LinkedHashSet)2 MojoFailureException (org.apache.maven.plugin.MojoFailureException)2 XmlPullParserException (org.codehaus.plexus.util.xml.pull.XmlPullParserException)2 ArtifactDescriptor (org.eclipse.tycho.ArtifactDescriptor)2 ReactorProject (org.eclipse.tycho.ReactorProject)2 ArtifactDependencyVisitor (org.eclipse.tycho.core.ArtifactDependencyVisitor)2 Feature (org.eclipse.tycho.model.Feature)2 ProductConfiguration (org.eclipse.tycho.model.ProductConfiguration)2 SiteFeatureRef (org.eclipse.tycho.model.UpdateSite.SiteFeatureRef)2 HashSet (java.util.HashSet)1 JarFile (java.util.jar.JarFile)1 FeatureDescription (org.eclipse.tycho.core.FeatureDescription)1 TargetEnvironment (org.eclipse.tycho.core.shared.TargetEnvironment)1