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();
}
}
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations