Search in sources :

Example 36 with ArtifactKey

use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.

the class LocalDependencyResolver method addProjects.

private void addProjects(MavenSession session, DefaultDependencyArtifacts platform) {
    File parentDir = null;
    for (MavenProject project : session.getProjects()) {
        ReactorProject projectProxy = DefaultReactorProject.adapt(project);
        TychoProject dr = projectTypes.get(project.getPackaging());
        if (dr != null) {
            ArtifactKey key = dr.getArtifactKey(projectProxy);
            platform.removeAll(key.getType(), key.getId());
            platform.addReactorArtifact(key, projectProxy, null, null);
            if (parentDir == null || isSubdir(project.getBasedir(), parentDir)) {
                parentDir = project.getBasedir();
            }
        }
    }
}
Also used : DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) ArtifactKey(org.eclipse.tycho.ArtifactKey) MavenProject(org.apache.maven.project.MavenProject) AbstractTychoProject(org.eclipse.tycho.core.osgitools.AbstractTychoProject) TychoProject(org.eclipse.tycho.core.TychoProject) DefaultReactorProject(org.eclipse.tycho.core.osgitools.DefaultReactorProject) ReactorProject(org.eclipse.tycho.ReactorProject) File(java.io.File)

Example 37 with ArtifactKey

use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.

the class LocalDependencyResolver method getArtifactKey.

public ArtifactKey getArtifactKey(MavenSession session, File plugin) {
    OsgiManifest mf = manifestReader.loadManifest(plugin);
    ArtifactKey key = mf.toArtifactKey();
    return key;
}
Also used : DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) ArtifactKey(org.eclipse.tycho.ArtifactKey) OsgiManifest(org.eclipse.tycho.core.osgitools.OsgiManifest)

Example 38 with ArtifactKey

use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.

the class LocalDependencyResolver method resolveDependencies.

@Override
public DependencyArtifacts resolveDependencies(MavenSession session, MavenProject project, TargetPlatform resolutionContext, List<ReactorProject> reactorProjects, DependencyResolverConfiguration resolverConfiguration) {
    DefaultDependencyArtifacts platform = new DefaultDependencyArtifacts(DefaultReactorProject.adapt(project));
    for (File site : layout.getSites()) {
        for (File plugin : layout.getPlugins(site)) {
            ArtifactKey artifactKey = getArtifactKey(session, plugin);
            if (artifactKey != null) {
                platform.addArtifactFile(artifactKey, plugin, null);
            }
        }
        for (File feature : layout.getFeatures(site)) {
            Feature desc = Feature.loadFeature(feature);
            ArtifactKey key = new DefaultArtifactKey(ArtifactType.TYPE_ECLIPSE_FEATURE, desc.getId(), desc.getVersion());
            platform.addArtifactFile(key, feature, null);
        }
    }
    addProjects(session, platform);
    addDependencies(session, project, platform);
    if (platform.isEmpty()) {
        getLogger().warn("Could not find any bundles or features in " + layout.getLocation());
    }
    return platform;
}
Also used : DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) ArtifactKey(org.eclipse.tycho.ArtifactKey) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) File(java.io.File) Feature(org.eclipse.tycho.model.Feature)

Example 39 with ArtifactKey

use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.

the class ProvisionedInstallationDescription method getSystemBundle.

@Override
public ArtifactDescriptor getSystemBundle() {
    if (systemBundleDescriptor != null) {
        return systemBundleDescriptor;
    }
    File pluginsDir = new File(location, "plugins");
    File[] systemBundles = pluginsDir.listFiles(new FileFilter() {

        @Override
        public boolean accept(File file) {
            return file.isFile() && file.getName().startsWith(EquinoxContainer.NAME + "_");
        }
    });
    File systemBundle;
    if (systemBundles.length == 0) {
        throw new IllegalArgumentException("No framework bundle " + EquinoxContainer.NAME + " found in " + pluginsDir);
    } else if (systemBundles.length > 1) {
        throw new IllegalArgumentException("Multiple versions of the framework bundle " + EquinoxContainer.NAME + " found in " + pluginsDir);
    } else {
        systemBundle = systemBundles[0];
    }
    String version = bundleReader.loadManifest(systemBundle).getBundleVersion();
    ArtifactKey systemBundleKey = new DefaultArtifactKey(ArtifactType.TYPE_ECLIPSE_PLUGIN, EquinoxContainer.NAME, version);
    systemBundleDescriptor = new DefaultArtifactDescriptor(systemBundleKey, systemBundle, null, null, null);
    return systemBundleDescriptor;
}
Also used : DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) ArtifactKey(org.eclipse.tycho.ArtifactKey) DefaultArtifactDescriptor(org.eclipse.tycho.core.osgitools.DefaultArtifactDescriptor) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) FileFilter(java.io.FileFilter) File(java.io.File)

Example 40 with ArtifactKey

use of org.eclipse.tycho.ArtifactKey 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

ArtifactKey (org.eclipse.tycho.ArtifactKey)41 File (java.io.File)19 DefaultArtifactKey (org.eclipse.tycho.DefaultArtifactKey)15 Test (org.junit.Test)14 ArtifactDescriptor (org.eclipse.tycho.ArtifactDescriptor)13 ReactorProject (org.eclipse.tycho.ReactorProject)8 DefaultArtifactDescriptor (org.eclipse.tycho.core.osgitools.DefaultArtifactDescriptor)6 DefaultDependencyArtifacts (org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts)6 DefaultReactorProject (org.eclipse.tycho.core.osgitools.DefaultReactorProject)5 LinkedHashMap (java.util.LinkedHashMap)3 MavenProject (org.apache.maven.project.MavenProject)3 BundleStartLevel (org.eclipse.sisu.equinox.launching.BundleStartLevel)3 DependencyArtifacts (org.eclipse.tycho.artifacts.DependencyArtifacts)3 FeatureRef (org.eclipse.tycho.model.FeatureRef)3 PluginRef (org.eclipse.tycho.model.PluginRef)3 Version (org.osgi.framework.Version)3 Element (de.pdark.decentxml.Element)2 Map (java.util.Map)2 Artifact (org.apache.maven.artifact.Artifact)2 Dependency (org.apache.maven.model.Dependency)2