use of org.eclipse.tycho.core.PluginDescription in project tycho by eclipse.
the class AbstractArtifactDependencyWalker method traversePlugin.
private void traversePlugin(PluginRef ref, ArtifactDependencyVisitor visitor, WalkbackPath visited) {
if (!matchTargetEnvironment(ref)) {
return;
}
ArtifactDescriptor artifact = artifacts.getArtifact(ArtifactType.TYPE_ECLIPSE_PLUGIN, ref.getId(), ref.getVersion());
if (artifact != null) {
ArtifactKey key = artifact.getKey();
if (visited.visited(key)) {
return;
}
File location = artifact.getLocation();
ReactorProject project = artifact.getMavenProject();
String classifier = artifact.getClassifier();
Set<Object> installableUnits = artifact.getInstallableUnits();
PluginDescription description = new DefaultPluginDescription(key, location, project, classifier, ref, installableUnits);
visited.enter(description);
try {
visitor.visitPlugin(description);
} finally {
visited.leave(description);
}
} else {
visitor.missingPlugin(ref, visited.getWalkback());
}
}
use of org.eclipse.tycho.core.PluginDescription in project tycho by eclipse.
the class OsgiBundleProject method getDependencyWalker.
@Override
public ArtifactDependencyWalker getDependencyWalker(MavenProject project) {
final DependencyArtifacts artifacts = getDependencyArtifacts(project);
final List<ClasspathEntry> cp = getClasspath(project);
return new ArtifactDependencyWalker() {
@Override
public void walk(ArtifactDependencyVisitor visitor) {
for (ClasspathEntry entry : cp) {
ArtifactDescriptor artifact = artifacts.getArtifact(entry.getArtifactKey());
ArtifactKey key = artifact.getKey();
File location = artifact.getLocation();
ReactorProject project = artifact.getMavenProject();
String classifier = artifact.getClassifier();
Set<Object> installableUnits = artifact.getInstallableUnits();
PluginDescription plugin = new DefaultPluginDescription(key, location, project, classifier, null, installableUnits);
visitor.visitPlugin(plugin);
}
}
@Override
public void traverseFeature(File location, Feature feature, ArtifactDependencyVisitor visitor) {
}
@Override
public void traverseUpdateSite(UpdateSite site, ArtifactDependencyVisitor artifactDependencyVisitor) {
}
@Override
public void traverseProduct(ProductConfiguration productConfiguration, ArtifactDependencyVisitor visitor) {
}
};
}
use of org.eclipse.tycho.core.PluginDescription in project tycho by eclipse.
the class ProductExportMojo method getBundles.
private Map<String, PluginDescription> getBundles(TargetEnvironment environment) {
final Map<String, PluginDescription> bundles = new LinkedHashMap<>();
getDependencyWalker(environment).walk(new ArtifactDependencyVisitor() {
@Override
public void visitPlugin(PluginDescription plugin) {
bundles.put(plugin.getKey().getId(), plugin);
}
});
return bundles;
}
use of org.eclipse.tycho.core.PluginDescription in project tycho by eclipse.
the class ArtifactDependencyWalkerTest method walkProduct.
protected void walkProduct(String productFile, final ArrayList<PluginDescription> plugins, final ArrayList<FeatureDescription> features) throws Exception, IOException, XmlPullParserException {
DependencyArtifacts platform = getTargetPlatform();
final ProductConfiguration product = ProductConfiguration.read(new File(productFile));
ArtifactDependencyWalker walker = new AbstractArtifactDependencyWalker(platform) {
@Override
public void walk(ArtifactDependencyVisitor visitor) {
traverseProduct(product, visitor);
}
};
walker.walk(new ArtifactDependencyVisitor() {
@Override
public void visitPlugin(PluginDescription plugin) {
plugins.add(plugin);
}
@Override
public boolean visitFeature(FeatureDescription feature) {
features.add(feature);
return true;
}
});
}
use of org.eclipse.tycho.core.PluginDescription in project tycho by eclipse.
the class ProductExportMojo method generateOSGiBundles.
private void generateOSGiBundles(Properties props, TargetEnvironment environment) throws MojoFailureException {
Map<String, BundleConfiguration> bundlesToStart = productConfiguration.getPluginConfiguration();
if (bundlesToStart == null) {
bundlesToStart = new HashMap<>();
// This is the wellknown set of bundles for Eclipse based application for 3.3 and 3.4 without p2
//
bundlesToStart.put(//
"org.eclipse.equinox.common", new BundleConfiguration("org.eclipse.equinox.common", 2, true));
//
bundlesToStart.put(//
"org.eclipse.core.runtime", new BundleConfiguration("org.eclipse.core.runtime", -1, true));
}
Map<String, PluginDescription> bundles = new LinkedHashMap<>(getBundles(environment));
StringBuilder osgiBundles = new StringBuilder();
for (PluginDescription plugin : bundles.values()) {
String bundleId = plugin.getKey().getId();
// starts
if ("org.eclipse.osgi".equals(bundleId)) {
continue;
}
if (osgiBundles.length() > 0) {
osgiBundles.append(',');
}
osgiBundles.append(bundleId);
BundleConfiguration startup = bundlesToStart.get(bundleId);
if (startup != null) {
osgiBundles.append('@');
if (startup.getStartLevel() > 0) {
osgiBundles.append(startup.getStartLevel());
}
if (startup.isAutoStart()) {
if (startup.getStartLevel() > 0) {
osgiBundles.append(':');
}
osgiBundles.append("start");
}
}
}
setPropertyIfNotNull(props, "osgi.bundles", osgiBundles.toString());
}
Aggregations