Search in sources :

Example 1 with ArtifactDependencyWalker

use of org.eclipse.tycho.core.ArtifactDependencyWalker 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) {
        }
    };
}
Also used : DependencyArtifacts(org.eclipse.tycho.artifacts.DependencyArtifacts) ArtifactKey(org.eclipse.tycho.ArtifactKey) ProductConfiguration(org.eclipse.tycho.model.ProductConfiguration) ReactorProject(org.eclipse.tycho.ReactorProject) ArtifactDependencyWalker(org.eclipse.tycho.core.ArtifactDependencyWalker) Feature(org.eclipse.tycho.model.Feature) ArtifactDependencyVisitor(org.eclipse.tycho.core.ArtifactDependencyVisitor) ArtifactDescriptor(org.eclipse.tycho.ArtifactDescriptor) ClasspathEntry(org.eclipse.tycho.classpath.ClasspathEntry) File(java.io.File) PluginDescription(org.eclipse.tycho.core.PluginDescription) UpdateSite(org.eclipse.tycho.model.UpdateSite)

Example 2 with ArtifactDependencyWalker

use of org.eclipse.tycho.core.ArtifactDependencyWalker 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;
        }
    });
}
Also used : AbstractArtifactDependencyWalker(org.eclipse.tycho.core.osgitools.AbstractArtifactDependencyWalker) DependencyArtifacts(org.eclipse.tycho.artifacts.DependencyArtifacts) ProductConfiguration(org.eclipse.tycho.model.ProductConfiguration) FeatureDescription(org.eclipse.tycho.core.FeatureDescription) AbstractArtifactDependencyWalker(org.eclipse.tycho.core.osgitools.AbstractArtifactDependencyWalker) ArtifactDependencyWalker(org.eclipse.tycho.core.ArtifactDependencyWalker) File(java.io.File) PluginDescription(org.eclipse.tycho.core.PluginDescription) ArtifactDependencyVisitor(org.eclipse.tycho.core.ArtifactDependencyVisitor)

Aggregations

File (java.io.File)2 DependencyArtifacts (org.eclipse.tycho.artifacts.DependencyArtifacts)2 ArtifactDependencyVisitor (org.eclipse.tycho.core.ArtifactDependencyVisitor)2 ArtifactDependencyWalker (org.eclipse.tycho.core.ArtifactDependencyWalker)2 PluginDescription (org.eclipse.tycho.core.PluginDescription)2 ProductConfiguration (org.eclipse.tycho.model.ProductConfiguration)2 ArtifactDescriptor (org.eclipse.tycho.ArtifactDescriptor)1 ArtifactKey (org.eclipse.tycho.ArtifactKey)1 ReactorProject (org.eclipse.tycho.ReactorProject)1 ClasspathEntry (org.eclipse.tycho.classpath.ClasspathEntry)1 FeatureDescription (org.eclipse.tycho.core.FeatureDescription)1 AbstractArtifactDependencyWalker (org.eclipse.tycho.core.osgitools.AbstractArtifactDependencyWalker)1 Feature (org.eclipse.tycho.model.Feature)1 UpdateSite (org.eclipse.tycho.model.UpdateSite)1