Search in sources :

Example 21 with ArtifactKey

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

the class AbstractArtifactDependencyWalker method traverseFeature.

protected void traverseFeature(File location, Feature feature, FeatureRef featureRef, ArtifactDependencyVisitor visitor, WalkbackPath visited) {
    ArtifactDescriptor artifact = getArtifact(location, feature.getId());
    if (artifact == null) {
        // ah?
        throw new IllegalStateException("Feature " + location + " with id " + feature.getId() + " is not part of the project build target platform");
    }
    ArtifactKey key = artifact.getKey();
    ReactorProject project = artifact.getMavenProject();
    String classifier = artifact.getClassifier();
    Set<Object> installableUnits = artifact.getInstallableUnits();
    DefaultFeatureDescription description = new DefaultFeatureDescription(key, location, project, classifier, feature, featureRef, installableUnits);
    if (visitor.visitFeature(description)) {
        for (PluginRef ref : feature.getPlugins()) {
            traversePlugin(ref, visitor, visited);
        }
        for (FeatureRef ref : feature.getIncludedFeatures()) {
            traverseFeature(ref, visitor, visited);
        }
    }
}
Also used : ArtifactKey(org.eclipse.tycho.ArtifactKey) ArtifactDescriptor(org.eclipse.tycho.ArtifactDescriptor) ReactorProject(org.eclipse.tycho.ReactorProject) PluginRef(org.eclipse.tycho.model.PluginRef) FeatureRef(org.eclipse.tycho.model.FeatureRef)

Example 22 with ArtifactKey

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

the class AbstractArtifactDependencyWalker method traverseProduct.

protected void traverseProduct(ProductConfiguration product, ArtifactDependencyVisitor visitor, WalkbackPath visited) {
    if (product.useFeatures()) {
        for (FeatureRef ref : product.getFeatures()) {
            traverseFeature(ref, visitor, visited);
        }
    } else {
        for (PluginRef ref : product.getPlugins()) {
            traversePlugin(ref, visitor, visited);
        }
    }
    Set<String> bundles = new HashSet<>();
    for (ArtifactDescriptor artifact : visited.getVisited()) {
        ArtifactKey key = artifact.getKey();
        if (ArtifactType.TYPE_ECLIPSE_PLUGIN.equals(key.getType())) {
            bundles.add(key.getId());
        }
    }
    if (environments != null && product.includeLaunchers()) {
        for (TargetEnvironment environment : environments) {
            String os = environment.getOs();
            String ws = environment.getWs();
            String arch = environment.getArch();
            String id;
            // see http://jira.codehaus.org/browse/MNGECLIPSE-1075
            if (PlatformPropertiesUtils.OS_MACOSX.equals(os) && (PlatformPropertiesUtils.ARCH_X86.equals(arch) || PlatformPropertiesUtils.ARCH_PPC.equals(arch))) {
                id = "org.eclipse.equinox.launcher." + ws + "." + os;
            } else {
                id = "org.eclipse.equinox.launcher." + ws + "." + os + "." + arch;
            }
            if (!bundles.contains(id)) {
                PluginRef ref = new PluginRef("plugin");
                ref.setId(id);
                ref.setOs(os);
                ref.setWs(ws);
                ref.setArch(arch);
                ref.setUnpack(true);
                traversePlugin(ref, visitor, visited);
            }
        }
    }
}
Also used : ArtifactKey(org.eclipse.tycho.ArtifactKey) ArtifactDescriptor(org.eclipse.tycho.ArtifactDescriptor) PluginRef(org.eclipse.tycho.model.PluginRef) FeatureRef(org.eclipse.tycho.model.FeatureRef) TargetEnvironment(org.eclipse.tycho.core.shared.TargetEnvironment) HashSet(java.util.HashSet)

Example 23 with ArtifactKey

use of org.eclipse.tycho.ArtifactKey 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());
    }
}
Also used : ArtifactKey(org.eclipse.tycho.ArtifactKey) ArtifactDescriptor(org.eclipse.tycho.ArtifactDescriptor) ReactorProject(org.eclipse.tycho.ReactorProject) File(java.io.File) PluginDescription(org.eclipse.tycho.core.PluginDescription)

Example 24 with ArtifactKey

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

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

the class GeneratePomsMojo method generatePluginPom.

private void generatePluginPom(Model parent, File basedir) throws MojoExecutionException {
    ArtifactDescriptor bundle = getArtifact(basedir);
    ArtifactKey key = bundle.getKey();
    Model model;
    if ((testSuffix != null && basedir.getName().endsWith(testSuffix)) || (testSuite != null && key.getId().equals(testSuite))) {
        model = readPomTemplate("test-plugin-pom.xml");
    } else {
        model = readPomTemplate("plugin-pom.xml");
    }
    String groupId = this.groupId;
    if (groupId == null) {
        groupId = key.getId();
    }
    setParentOrAddTychoExtension(basedir, model, parent);
    model.setGroupId(groupId);
    model.setArtifactId(key.getId());
    model.setVersion(toMavenVersion(key.getVersion().toString()));
    writePom(basedir, model);
}
Also used : ArtifactKey(org.eclipse.tycho.ArtifactKey) ArtifactDescriptor(org.eclipse.tycho.ArtifactDescriptor) Model(org.apache.maven.model.Model)

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